Steps involved in Installation and Configuration of Open Source DevOps Tools:
In our last tutorial, we listed some of the top 10 best DevOps tools in 2018. In this tutorial, I will focus on the installation and configuration of some of the commonly used OPEN-SOURCE tools in DevOps.
Read Through => Sequential DevOps Training Series
In our upcoming tutorial on DevOps, we will learn about how Microsoft VSTS and AWS support DevOps activities.
But not all the organization’s use of commercial tools. Some rely on open source tools for Continuous Integration and Continuous Delivery.
You can consider this tutorial as a cheat sheet and not as a LINUX TRAINING guide. You can keep it handy when you are trying to install them on Red Hat Linux 7.5.
Table of Contents:
- Installation and Configuration of Open Source DevOps Tools
- #1) Install or Update Java to Version 8
- #2) Install and Configure GIT
- #3) Installing Maven
- #4) Installing Jenkins
- #5) Installing Tomcat
- #6) Installing JFrog Artifactory OSS
- #7) Installing MySQL 5.7
- #8) Installing SonarQube
- #9) Installing Docker
- #10) Installing Ansible
- Summary
- Was this helpful?
- Recommended Reading
Installation and Configuration of Open Source DevOps Tools
Pre-Requisite:
- Internet connection on the Red Hat Linux machine.
- If your organization uses a proxy server to connect to internet then ensure if the proxy settings are configured.
- Root user privileges.
#1) Install or Update Java to Version 8
Firstly while installing certain open source tools, it is very important to update all the packages to the latest version by using the below command
# yum update -y
Most of the software tools use JDK 8 and above. Download the JDK package in RPM format file using the wget command. Wget Linux utility helps to download the files from the web. If it is not installed then follow the instructions below to install it.
# cd /opt/niranjan
# yum install wget
# wget –no-check-certificate –no-cookies –header “Cookie: oraclelicense=accept-securebackup-cookie”
Check this.
You can get the path of RPM file from this URL
# rpm -ivh jdk-8u171-linux-x64.rpm
# java -version
#2) Install and Configure GIT
Let’s see how to install and configure GIT which is the most popular version control software.
# yum install git –y
GIT is installed in /usr/bin. Check the version of the GIT installed.
# git –version
GIT Configuration
Let’s now configure the user name and email id for the GIT repository.
# git config –global user.name “V Niranjan”
# git config –global user.email vniranjan72@outlook.com
The above information is stored in the .gitconfig file which is in the home directory.
CD to your home directory and look at the file.
Initialise a GIT repository
# cd /opt/niranjan/demoproject
# git init
Add and Commit files to GIT repository
Add some files to the repository and run the below commands.
# git add
# git commit –m “First Commit”
#3) Installing Maven
Maven is a utility which is used for any project build using a project object model (POM). Download the appropriate maven binaries from here.
In this case, let’s look to download and install Maven 3.5.3 version. Also, note that JDK 8 or 9 is a pre-requisite to install Maven.
# wget http://www-us.apache.org/dist/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz
# tar xzf apache-maven-3.5.3-bin.tar.gz
Add the bin directory of the newly created directory to the PATH env variable and run the command to test maven.
# mvn -version
#4) Installing Jenkins
Jenkins is the most popular Continuous Integration tools. Jenkins is not available by default on the RHEL repositories. Enable the Jenkins repository and Install by running the following commands.
# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
# rpm –import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
Install Jenkins as follows
# yum install jenkins –y
Changing default Jenkins Port
If in case you need to use the other port than 8080 for jenkins then edit the file /etc/sysconfig/jenkins and modify the parameter JENKINS_PORT to use some other port number.
Start Jenkins Service
Start Jenkins service by running the following command:
# service jenkins start
Stop Jenkins Service
Stop Jenkins service by using the following command:
# service jenkins stop
Launch Jenkins
Once Jenkins service is started, proceed to launch Jenkins by entering the URL http://<HostnameOrIPAddress>:8089
Enter the password from the file given and click on Continue.
Click on Install suggested plugins
Post this you will be asked to create a ADMIN user id and password.
Click on Save and Finish. Jenkins is now ready for use.
Note: Since the port used here is 8089 than the default one 8080 make sure that this port is opened on the firewall or in the AWS security group if installing on AWS Cloud.
#5) Installing Tomcat
Apache Tomcat is one of the popular web servers that is used for web applications deployment. In this section, we will see how to install and configure Tomcat 8.x.
To start, use this link to find out the latest stable version of Tomcat 8.x and install using wget.
Copy the tar.gz file location under “Core” which will be as shown below and use it in the wget command.
http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.31/bin/apache-tomcat-8.5.31.tar.gz
Extract the file using the command below into the directory /opt/niranjan/tomcat
# tar -xvf apache-tomcat-8.5.31.tar.gz
After extraction move it to a smaller understandable directory such as /opt/niranjan/tomcat which will be the final installed directory.
Configure Tomcat
Do the following changes in tomcat-users.xml which are in the conf directory. Ensure to remove comments <!– and –> which is above and below the lines.
<role rolename=”manager-gui”/> <role rolename=”manager-script”/> <user username=”tomcat” password=”tomcat” roles=”tomcat,manager-gui,manager-script”/>
Save and exit.
Change the default PORT from 8080 to 9005
Open the file server.xml and change the connector port to a different value.
Save and exit.
Start Tomcat by running the file startup.sh
Launch Tomcat using URL http://<HostnameOrIPAddress:9005/
#6) Installing JFrog Artifactory OSS
To install JFrog Artifactory, which is a popular binary distribution repository manager, follow the steps as shown below which is just similar to Jenkins installation.
# wget https://bintray.com/jfrog/artifactory-rpms/rpm -O bintray-jfrog-artifactory-rpms.repo
# mv bintray-jfrog-artifactory-rpms.repo /etc/yum.repos.d/
# yum install jfrog-artifactory-oss
Start Artifactory
The service can only be started or stopped as a root user only.
# service artifactory start
Test Artifactory
Launch Artifactory by using the URL
http://<HostnameOrIPAddress>:8081/artifactory
Initial steps would ask you to create an admin id and password.
Alternate ways to install Artifactory
- Install and run as a DOCKER image.
- Download the Artifactory ZIP file from here , copy it to the linux machine using a utility like Winscp , extract it and simply run <Path>/bin/artifactory.sh
#7) Installing MySQL 5.7
Most of the times for application deployment or for certain tools like SonarQube there could be a need to setup MySQL for database operations as well. To install MySQL 5.7 follow the steps as shown.
Download the RPM package for MySQL for installation.
# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
# rpm -ivh mysql57-community-release-el7-7.noarch.rpm
# yum install mysql-community-server
Start MySQL Server
# service mysqld start
# mysql –version
Configuring MySQL
To configure MySQL we need to run the secure installation which helps us to setup the root password for MySQL DB operations.
MySQL version 5.7 generates a temporary password in /var/log/mysqld.log which will be used during the secure installation of MySQL.
# grep ‘temporary password’ /var/log/mysqld.log
Run the command as given below and setup the root password to login to MySQL.
# mysql_secure_installation
Proceed further with the other options and setup as per the need. Once completed login to MySQL as
# mysql –u root -p
#8) Installing SonarQube
SonarQube is the most widely used code analysis tool, hence inorder to install it during the continuous integration follow the steps below. SonarQube requires a backend database and we will see how it is configured with MySQL database.
Create the database and user in MySQL
Since we have seen how to install MySQL in the previous section, login and run the following SQL commands.
mysql> CREATE DATABASE sonardb CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> CREATE USER ‘sonaruser’ IDENTIFIED BY ‘sonaruser’;
mysql> GRANT ALL ON sonardb.* TO ‘sonaruser’@’%’ IDENTIFIED BY ‘sonaruser’;
mysql> GRANT ALL ON sonardb.* TO ‘sonaruser’@’localhost’ IDENTIFIED BY ‘sonaruser’;
mysql> FLUSH PRIVILEGES;
Install SonarQube
# wget -O /etc/yum.repos.d/sonar.repo http://downloads.sourceforge.net/project/sonar-pkg/rpm/sonar.repo
# yum install sonar –y
Configure SonarQube
Open the sonar properties file and enter the database details to connect with.
# vi /opt/sonar/conf/sonar.properties
Update the username and password as shown below in the file.
sonar.jdbc.username=sonaruser
sonar.jdbc.password=sonaruser
Scroll down to the MySQL section and update it as below. Add the hostname or IP address. Save and exit the file once done.
#—– MySQL 5.6 or greater
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported. It cannot be changed.
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonardb?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
Start SonarQube
Run the following command to start the SonarQube service
# service sonar start
Test the SonarQube Installation
Launch the URL using http://<HostnameOrIPAddress>:9000
#9) Installing Docker
To install Docker CE edition which is a very popular containerization platform, you need to follow the below steps.
# yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo
# yum -y –enablerepo=rhui-REGION-rhel-server-extras install container-selinux
# yum install docker-ce –y
# docker –version
# service docker start
# docker run –it hello-world
# docker images
#10) Installing Ansible
To install Ansible which is an open-source IT automation tool for configuration management and deployment of application, follow the steps as shown below.
Firstly enable the Extra Packages repository which contains add-on software’s for linux and install ansible as a root user.
# wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# rpm -ivh epel-release-latest-7.noarch.rpm
# yum install ansible –y
# ansible –version
Configuration of Ansible
Ansible configuration are managed in a file called ansible.cfg. To enable the hosts, uncomment the inventory value.
# vi /etc/ansible/ansible.cfg
All the required hosts to connect to and manage can be added to the required host groups in the ansible hosts file.
# vi /etc/ansible/hosts
Post the ansible configuration and inventory file setup you will also need to setup password less SSH key authentication which enables the client machines or nodes to be connected from the master and vice versa.
Before performing the above or below configuration, it is better to have a common user across all the servers and the user be added to the /etc/sudoers file to ensure that the tasks which will be run through ansible have admin or root privileges.
So in a nutshell, control machine or nodes can be connected through SSH using the below 2 commands. The below commands have to be run on both the master and client machines.
“ssh-keygen” and “ssh-copy-id user@nodemachine “
To test the connectivity run the command
“ansible all –m ping”
Summary
In this tutorial, we saw how to install the most commonly used open-source tools in any DevOps environment.
As DevOps talks about the speed of delivery, I am sure that this tutorial or cheat sheet should help all of your DevOps enthusiasts to quickly get started on installing these tools in your environment and help the entire team/organization to automate the Continuous Integration and Continuous Delivery process.
Watch out our upcoming tutorial to know more about Frequently asked DevOps interview questions and answers.