Thursday, 30 September 2021

Project Script

 Docker Compose file for Dokuwiki


version: '2'

services:

  dokuwiki:

    image: docker.io/bitnami/dokuwiki:20200729

    ports:

      - '80:8080'

      - '443:8443'

    volumes:

      - 'dokuwiki_data:/bitnami/dokuwiki'

volumes:

  dokuwiki_data:

    driver: local




bash: Tomcat

#!/bin/bash
set -x



echo ""
echo "........................................"
echo "Installation of application"
echo "........................................"
echo "Today's date: `date`"
echo "........................................"
echo ""
sudo apt-get update
echo "........................................"
echo "apt update completed........................................"
sudo apt-get install default-jdk -y
echo "installing java........................................"

java -version
echo "installing tomcat 8........................................"

sudo apt-get install tomcat8 -y
sudo apt-get install tomcat8-docs tomcat8-examples tomcat8-admin -y

sudo cp -r /usr/share/tomcat8-admin/* /var/lib/tomcat8/webapps/ -v
echo "changing port from 8080 to 4000........................................"

sudo sed -i 's/8080/4000/g' /var/lib/tomcat8/conf/server.xml
echo "set up a user in tomcat........................................"

CONTENT="<role rolename=\"manager-script\"/>\n<user username=\"tomcat\" password=\"password\" roles=\"manager-script\"/>"
C=$(echo $CONTENT | sed 's/\//\\\//g')
sed "/<\/tomcat-users>/ s/.*/${C}\n&/" /var/lib/tomcat8/conf/tomcat-users.xml >> file
mv /var/lib/tomcat8/conf/tomcat-users.xml /var/lib/tomcat8/conf/tomcat-users.xml.bck
mv file /var/lib/tomcat8/conf/tomcat-users.xml 
echo "add memory to jvm........................................"

sed -i 's/JAVA_OPTS/#/g' /etc/default/tomcat8
echo "JAVA_OPTS=\"-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx512m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC\"" >> /etc/default/tomcat8
echo "restart tomcat........................................"

sudo systemctl restart tomcat8
echo "check status........................................"
echo this script was written by team excellence use with permission

sudo systemctl status tomcat8

exit


Wednesday, 15 September 2021

How to install Artifactory on a Centos Linux Machine

 Step 1

Launch a Centos 8 instance in AWS

Launch instance...select AWS Market...search for CentOS 8 (x86_64) - with Updates HVM






Launch instance and open Port 8081, 8082

We have clubbed all the commands and created a simple script to install the Jfrog on CentOS 8. The benefit of using script is that we can run all the steps just executing the script at one shot. And also we can keep the script and use at any/multiple time.

Step 2:  Log into the instance. Create a file, The vi editor are our favorite hence using same.

vi install_jfrog_centos8.sh

Paste the given below content and save the file.

#/bin/bash
#
# Install jfrog on CentOS 8
# Blog: https://sharadchhetri.com

# Disable the SELINUX on CentOS 8
# set temporary permissive selinux mode. reboot not require
sudo setenforce 0
# In next reboot,the below line will help to set disable selinux permanently.
sudo sed -i s/^SELINUX=.*$/SELINUX=disabled/ /etc/selinux/config

# jfrog oss 7.x require Java 11, installing wget and openjdk
sudo yum install -y wget java-11-openjdk*

# download jfrog repo and directly keep in /etc/yum.repos.d dir
sudo wget https://bintray.com/jfrog/artifactory-rpms/rpm -O /etc/yum.repos.d/bintray-jfrog-artifactory-oss-rpms.repo

# install jfrog-artifactory-oss (open source)
sudo yum install -y jfrog-artifactory-oss

# yaml files are indent sensitive. So do not remove spaces while copying. Keep as it is.
# creating system.yaml
cat <system.yaml
configVersion: 1
shared:
    extraJavaOpts: "-server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC"
    security:
    node:
    database:
EOF

# copying above created system.yaml and replacing by original one. It backup the original system.yaml file also.
sudo cp -brvf system.yaml /var/opt/jfrog/artifactory/etc/system.yaml

# enable artifactoyr.service as well as start the service at a same time
sudo systemctl enable --now artifactory


Step 2: Give executable permission to the script.

sudo chmod +x install_jfrog_centos8.sh

Step 3: Now execute the script.

sh install_jfrog_centos8.sh

You may get errors like below. Dont be alarmed. Arti factory is still installed



Step 4: Once the script is finished successfully, now open the web browser and hit the Jfrog IP address at port number 8081 and do the post setup.
Syntax: http://<-jfrog-ip-or-fqdn->:8081

For example, as per our jfrog server ip address in web browser we have typed http://192.168.33.10:8081. This will open the Jfrog Dashboard in web browser from where you can do the rest of the post setup. 

Username:admin

pswd: password

To again login in Jfrog, you can use Syntax: http://<-jfrog-ip-or-fqdn->:8081. Now you can easily manage the artifacts from Jfrog Artifactory. For DevOps, integerate the Jfrog Artifactory with CI/CD pipelines.










How to upgrade Maven

  java.lang.IllegalStateException I had installed maven in my ubuntu using command  apt install maven This installed maven in path /usr/shar...