You are on page 1of 5

pwd - parent working directory --> home/cicd

whoami - user name --> neha


hostname - virtual box name we craeted --> neha-vbox
ls -l - to list all the files
ifconfig -- check ip address
ping -- to connect to ip address

DevOps Environment Setup:

Devops Tools Installation Steps:

List of Opensource software tools/packages needed to run on Ubuntu 18.04 Desktop VM


is as follows:
https://releases.ubuntu.com/18.04/ Desktop Version
1. Git SCM Open source distributed version control system https://git-scm.com
2. Open Java Development Kit JDK/JRE 8 https://openjdk.java.net
3. Jenkins automation server https://www.jenkins.io/
4. Apache Maven software project management and comprehension tool.
http://maven.apache.org/
5. Selenium Web driver browser-based regression automation suites.
https://www.selenium.dev/
6. Sonarqube Open source Community Edition for Code Quality and Security.
https://www.sonarqube.org/
7. JFROG Artifactory Open source CE. https://jfrog.com/artifactory
8. A Self-hosted Git service. https://docs.gitea.io/en-us/install-from-binary/
9. PostgreSQL Open Source Relational Database:
https://www.postgresql.org/download/
10. Apache Tomcat Open source implementation of the Java Servlet, JavaServer Pages,
https://tomcat.apache.org/
11. Ansible Configuration management and deployment tool https://www.ansible.com/
12. Docker Docker container, Docker compose/swarm App Containerization and
orchestration. https://www.docker.com
13. Kubernetes Open-source system for automating deployment of container.
https://kubernetes.io/
14. Monitoring tools:
a.Grafana Open source monitoring tool. https://grafana.com/oss/
b.Logstash Open source server side monitoring https://www.elastic.co/logstash

$ sudo apt-get update // install packages


$ sudo apt install net-tools //pull and install net tools
$ sudo apt install openssh-server //
$ sudo apt install vim // to install vim editor
$ sudo apt-get install wget unzip -y //to install unzip package

To copy files from windows machine to VM.


From Windows Prompt
scp <file>cicduser@<vm ip.address>:/home/cicd

## Install OpenJDK
$ sudo apt-get install openjdk-8-jdk -y
$ sudo apt-get install openjdk-8-jre -y
$ java -version

##Install Apache Tomcat Server


cd /home/cicd/cicdtools/tomcat
wget https://mirrors.estointernet.in/apache/tomcat/tomcat-8/v8.5.59/bin/apache-
tomcat-8.5.59.tar.gz
## Install Sonarqube
$ sudo sysctl -w vm.max_map_count=262144
$ sudo sysctl -w fs.file-max=65536
$ sudo vi /etc/security/limits.conf
##Add these two lines before end of file.
sonarqube - nofile 65536
sonarqube - nproc 4096

## Install and Setup PostgreSQL 10 Database For SonarQube


$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-
pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
$ wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key
add -
$ sudo apt-get -y install postgresql postgresql-contrib
$ sudo systemctl start postgresql
$ sudo systemctl enable postgresql
$ sudo passwd postgres
$ su - postgres
createuser sonar
psql
ALTER USER sonar WITH ENCRYPTED password 'sonar';
CREATE DATABASE sonarqube OWNER sonar;
grant all privileges on DATABASE sonarqube to sonar;
\q
exit

cd /home/cicd/cicdtools/sonarqube/
$ sudo wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-
7.5.zip
$ unzip sonarqube-7.5.zip
$ sudo vi ~/sonarqube-7.5/conf/sonar.properties
##Modify the following lines.
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube
sonar.web.host=0.0.0.0
sonar.web.port=9000
sonar.web.javaAdditionalOpts=-server
sonar.search.javaOpts=-Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError
sonar.log.level=INFO
sonar.path.logs=logs
##To Start the Sonarqube
$ ./sonarqube-7.5/bin/linux-x86-64/sonar.sh start
status
stop

## Access the sonarqube on url:


http://localhost:9000
login: admin passwd: admin

#####Install git
$ sudo apt update
$ sudo apt install git
$ git --version

##Install Gitea
cd /home/cicd/cicdtools/gitea
$ wget -O gitea https://dl.gitea.io/gitea/1.12.5/gitea-1.12.5-linux-amd64
$ chmod +x gitea
$ ./gitea &

##Invoke Gitea on url


http://localhost:3000
##Setup the postgresql database for gitea
username/password is sonar/sonar
database name: sonarqube
### Then setup a new user by registering your own username/password.

###Install maven
$ sudo apt update
$ sudo apt install maven
$ mvn -version

#Install Jenkins
$ sudo apt update
$ wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
$ sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ >
/etc/apt/sources.list.d/jenkins.list'
$ sudo apt update
$ sudo apt install jenkins
$ systemctl status jenkins
$ sudo ufw allow 8080
$ sudo ufw allow OpenSSH
$ sudo ufw enable
$ sudo ufw status

#Install DockerY
https://linuxize.com/post/how-to-install-and-use-docker-on-ubuntu-18-04/
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-
ubuntu-18-04
$ sudo apt update
$ sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-
properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64]
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt update
$ sudo apt install docker-ce
$ sudo systemctl status docker
$ sudo usermod -aG docker ${USER}
#sudo usermod -aG docker <username>
$ su - ${USER}
$ id -nG
#####################################
##Install Ansible
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-
ansible-on-ubuntu-18-04
$ sudo apt-get update
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt update
$ sudo apt install ansible
$ sudo apt install python-pip
$ sudo pip install docker-py

##Install JFrog Artifactory


$ cd /home/cicd/cicdtools/jfrog
$ docker container stop docker-artifactory-oss
$ docker container rm docker-artifactory-oss
$ docker run -d --name docker-artifactory-oss -p 5040:8082 -v
/home/cicd/cicdtools/jfrog/artifactory:/var/opt/jfrog/artifactory
docker.bintray.io/jfrog/artifactory-oss:7.5.7

##Install CAdvisor Monitoring tool


$ docker container run --detach=true \
--volume=/:/roots:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker:/var/lib/docker:ro \
--publish=8090:8080 \
--name=cadvisor \
google/cadvisor:latest

##Install Grafana Monitoring tool


$ docker container run -d --name grafana -p 3001:3000 \
-v grafana_config:/etc/grafana \
-v grafana_data:/var/lib/grafana \
-v grafana_log:/var/log/grafana \
grafana/grafana

##Start up script for tools sonarqube, jfrog, gitea


cat ~/cicdtools/mytools_start.sh
sudo chmod 777 /var/run/docker.sock
sudo sysctl -w vm.max_map_count=262144
./tomcat8/apache-tomcat-8.5.56/bin/shutdown.sh
./sonarqube/sonarqube-7.5/bin/linux-x86-64/sonar.sh stop
./jfrog/docker-artifactory.sh
./tomcat8/apache-tomcat-8.5.56/bin/startup.sh
./sonarqube/sonarqube-7.5/bin/linux-x86-64/sonar.sh start
./gitea/gitea &

#################################################################
wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-
v0.24.0-linux64.tar.gz
tar -xvzf geckodriver*
chmod +x geckodriver
sudo mv geckodriver /usr/bin/
###############################################################

Maven:
mvn archetype:generate -DgroupId=com.devops -DartifactId=Demo1
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

mvn archetype:generate -DgroupId=com.devops -DartifactId=Demo2


-DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

Demo1/2>mvn compile
mvn clean
mvn test
mvn clean package
mvn test-compile
mvn verify
mvn install
mvn deploy

You might also like