In this post, let’s look at the steps to install and configure the most used DevOps tools in the current IT industry which are in high demand.
Before moving ahead, we recommend beginners to have a little grasp on what is DevOps, why DevOps was introduced and DevOps working by referring to our blog An Introduction To DevOps.
Ahead of installing we request the user to review the following system requirements.
- Stable Internet connection.
- Ubuntu 16.4
- Root user privileges.
- Minimum 4 GB RAM and 500GB hard drive.
What you will learn:
“What you will learn” after reading this post. You will be able to Install and configure the below listed open source DevOps tools.
1. Install or upgrade Java to version 8
- Set JAVA_HOME
2. Install and configure Git
- Git Configuration.
- Initialize a Git Repository.
- Add And Commit Files To GitHub Repository.
3. Install Maven
- Configure Maven.
- Update PATH Environment Variable.
4. Install Jenkins
- Adjust Firewall.
- Setting Up Jenkins.
- Getting Started With Jenkins Through Web UI.
5. Install Tomcat
- Download And Install Tomcat Server
- Start Tomcat Server
- Stop Tomcat Server
- Configure Tomcat Server
- Change The Default PORT
6. Install Apache ANT
- Installing Apache ANT
- Check Version Of Apache ANT
7. Install Chef
- Install NTP Service
- Enable NTP Service
- Start NTP Service
- Download Chef Development Kit File For Ubuntu
- Install Chef Development Kit
- Hands-on With A Simple Example.
8. Install Docker
- Installing Docker
- Start Docker Services
- Hands-on With Docker Commands
9. Nagios Installation
- Create User And Group For Nagios
- Download And Install Nagios
- Setup Apache 2 With Authentication
- Configure Nagios
- Download And Install Nagios Plugins
- Verify The Settings
- Start The Nagios Services
- Access The Web UI Of NagiosStep 1: Before installing java make sure the newest versions of all packages are currently installed on the Ubuntu system.
sudo apt-get update -y
Step 2: Nowadays most of the software uses Java version 8 and above because Java version 8 is a superlative release of the world’s #1 development platform. Follow the steps below to download and install Java 8.sudo apt-get install openjdk-8-jre-headless -y
Step 3: Set JAVA_HOME Environment Variables.vim .bashrc
Once you open the bashrc_profile, insert the following two lines at the end of the file.export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64export PATH=$PATH:$JAVA_HOME/bin
Note: Use the command esc : wq! to save and exit the .bashrc file.
Step 4: Use the below command to see the newly installed java.java -version
We can see from the above screenshot Java 8 is successfully installed.
Now Let us see the steps to install and configure GIT which is the most popular version control software.
Step 1: To install git use the following command in the terminal.sudo apt-get install git -y
As you can see GIT is already present in Ubuntu if it is not installed then use the above command to install GIT in your system.
Step 2: To check the git version you can use the below command:git –version
Step 3: Before using GIT repository we have to configure the “email id” and the “username”. Thus use the following commands to configure.git config –global user.name “Your Name”git config –global user.email your email address
As you have configured the “user name” and “email id”, all the above information is stored in the below gitconfig file~/.gitconfig
Step 4: Create and Initialize a GIT repository using the below commands.mkdir -p /home/acadgild/myprojectcd /home/acadgild/myproject/git init
Step 5: Add and Commit files to GIT repository by using the below commands.vim wordcount.pygit add .git commit -m “First Commit”
You have successfully installed and configured the GIT. Now you are ready to use this open source distributed version control system.
Maven is one of the best build automation tools which is mostly used for building Java-based projects.
Maven addresses two aspects of building software:
- First, it describes how software is built,
- Second, it describes its dependencies.
Step 1: Use the below command to install maven.sudo apt-get install maven
Step 2: Update and set the MAVEN_HOME environment variable in bashrc_profilesudo vim .bashrc
Once you open the bashrc profile type the below two lines at the end of the file.export MAVEN_HOME=/usr/share/mavenexport PATH=$PATH:$MAVEN_HOME/bin
Note: Use the command esc : wq! to save and exit the .bashrc file.
Step 3: Now to update the changes which we have made in the bash_profile type the below command.source .bashrc
You have successfully installed Maven.
Jenkins is a continuous integration server which is written in Java. It can handle any type of build or continuous integration. It is used by different teams of different sizes for those projects that may have heterogeneous languages like Java, .net, PHP, etc
Follow the below steps to install Jenkins.
Step 1: Add the Jenkins Debian repository.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’
Step 2: Once the Jenkins repository is created in the following path, update the repository and install Jenkins using the below commands.sudo apt-get update -ysudo apt-get install jenkins -y
Step 3: Jenkins service will start automatically after the installation and you can check the status of the Jenkins service by using the below command.sudo service jenkins status
If you want to start the Jenkins manually then use the below command.sudo service jenkins start
If you want to stop the Jenkins manually then you can use the below command.sudo service jenkins stop
Step 4: If you are installing Jenkins on remote Ubuntu server that protected by a firewall
All you have to do is you need to open the port 8080 because this is the default port which will be used by Jenkins web UI.
Let us the below commands to open the port 8080:sudo ufw allow 8080sudo ufw status
Getting started with Jenkins web UI
Step 5: As the Jenkins service is already started, we can use the below command to launch the Jenkins Web UI.
Open the browser and type the below URLhttp://localhost:8080
Below is the page which will be displayed.
The first time/ First, you have to enter the password which is located in the below location/var/lib/jenkins/secrets/initialAdminPassword
Now we will fetch the password from the above location given using the below command.sudo less /var/lib/jenkins/secrets/initialAdminPassword
Now copy the password and paste it to the browser in the given field of the password.
Step 6: Once you are done with the above step you will get the next page.
In this step, click on “Install suggested plugins” to start with the installation of Jenkins packages.
Once you click on “Install suggested plugins” it will start the installation of the plugin so you have to wait for complete the installation.
Note: In my case, there is one plugin called pipeline is not installed but am sure in your case it might not list the above plugin and you will be able to see the successful message.
Step 7: Now click on the “continue” and fill the user details shown in the below image.
All you have to do is you have to fill the details which are shown in the below image.
Step 8: Once you finish the filling procedure, click on the “save and continue” button.
You will see the below page once after selecting the “save and continue” button.
Now here in the above image, you can see the Jenkins URL where we can access the web UI of the Jenkins, just click on the save and finish button which is the final step to install Jenkins.
You can now start exploring Jenkins features by visiting the official page
Apache Tomcat server is one of the best web servers which is highly used to deploy web applications.
For Example, if your application contains server-side programming languages like PHP then these languages need a server to run that’s why we use tomcat server.
In this part, we will see the steps to install and configure Tomcat 8.5.X
To find the latest version of the Apache Tomcat click on this link.
Now we will start the installation steps of Apache Tomcat Server
Step 1: create one folder called “tomcat” or directory in your home directory by the below command.mkdir tomcatcd tomcat
Step 2: Copy the address link of Apache tomcat tarball.
Step 3: Open a terminal and type the below command to download the tar file by the below command.wget https://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.42/bin/apache-tomcat-8.5.42.tar.gz
Step 4: Extract the tarball in the tomcat folder which we have created earlier using the below command.tar -zxvf apache-tomcat-8.5.42.tar.gz
Step 5: Update the bashrc profile(Environment Variable. with the path of tomcat where we have extracted by the below command //where is the ending braces.vim .bashrc
Once you open the .bashrc file now press “i” to write the below lines to the file.export TOMCAT_HOME=/home/acadgild/tomcat/apache-tomcat-8.5.42export PATH=$PATH:$TOMCAT_HOME/bin
Note: Use the command esc : wq! to save and exit the .bashrc file.
Step 6: Now to update the changes which we have made in the bash_profile use the below command.source .bashrc
Step 7: Edit the tomcat-users.xml file which is in the conf directory of tomcat.
Ensure to remove comments <! – and –> which is at the beginning and ending of the configuration part of the tomcat-users.xml file.
After editing the tomcat-users.xml file the code looks like:
Now, save the File.
Change the default PORT from 8080 to 9005
Step 8: Open and edit the file server.xml which is in the conf directory and change the connector port to a different value by using the below command.vim server.xml
Now we have successfully completed the configuration of tomcat server.
Start Tomcat Server
Let’s start the tomcat server and check whether if it is working.
Step 9: Start Tomcat Server by using the below command.startup.sh
Step 10: Launch the web UI of Tomcat by entering the below URL in a web browser.localhost:9005
Once after launching the web UI we can see that tomcat is successfully installed.
ANT stands for Another Neat Device. Is a java based build device and mainly used to build the software, to build scripts like compiling, executing tests, and packaging.
An alternative to this tool is apache maven which is more functionality than apache ANT but it depends on the company use case which they want to use to build the software.
Lets Starts with the installation of apache ANT which is very simple.
Step 1: Install Apache Ant by the below command.
- sudo ap-get install ant -y
Sometimes Apache ANT is preinstalled in some of the Ubuntu version (16.4 and above .. As you can see in the above image the ANT is already installed.’
In your case if it is not installed then follow the step 1.
Step 2: Check whether it is installed or not.
Chef is a configuration management tool for dealing with machine setup on physical servers, virtual machines and in the cloud. Many companies use Chef Software to control and manage their infrastructure including Facebook, Etsy, Cheezburger, and Indiegogo
Before starting the installation of chef we need NTP service so we will install NTP service first.
Install NTP service
Step 1: Install NTP Service by using the below command.sudo apt-get install ntp -y
Step 2: Start the NTP Service by using the below command.
- sudo service ntp start
Now let’s start with the chef installation.
Step 1: Create a new directory called chef under the home directory by using the below command.mkdir chef
Step 2: Download chef tarball into your system by using the below command.Wget https://packages.chef.io/files/stable/chefserver/12.19.31/ubuntu/18.04/chef-server-core_12.19.31-1_amd64.deb
Step 3: Install the downloaded file by using the below command.sudo dpkg -i chef_15.1.8-1_amd64.deb
As you can see we have successfully installed chef development kit in our system.
Hands On on chef with a simple example
Let’s consider an example where we have to create a file called hello world and we have to add some contents in that file so how we will do it using chef.
Step 1: Create a script file in the Ruby scripting language by using the below command.vim hello-world.rb
Step 2: Write contents to the file hello-world.rb which we have created earlier.
Now we will run the file to see if we are able to create a file called acadgild and display the contents like “welcome to acadgild”.
Step 3: Run the script using the chef using the below command.
- chef-apply hello-world.rb
As you can see in the above result after running the command we have successfully created the file called “acadgild” and we have written “welcome to acadgild” in the file.
Step 4: Check the results by using the below commands.lscat acadgild
We have successfully run the chef job and you can see the result in the above screenshot.
Docker is an open source tool which is designed to create, deploy and run the applications using containers. The container is a kind of virtual machine which allows the developer to package the application with all its dependencies and libraries.
Now, let us see the steps to install docker.
Step 1: To ensure the download are valid, add the GPG key for the official docker repository in to your system by the below command.curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
Step 2: Add the docker repositories to the apt resources by the below command.sudo add-apt-repository “deb[arch=amd64]https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
Step 3: Update package database with the docker package which is added through the repository using the below command.sudo apt-get update -y
Step 4: Make sure you are installing docker from docker repositories and not from ubuntu repositories by using the below command.apt-cache policy docker-ce
Step 5: Install the docker community edition using the below command.sudo apt-get install -y docker-ce
Step 6: Check docker services are running by using below command.sudo systemctl status docker
Docker Commands without Sudo Privileges
To execute the docker command every time you have to type the password using sudo so to run the docker commands without sudo or root privileges run the below command.
Step 7: Create a group docker by the below command.sudo groupadd docker
Step 8: Add the user to the docker group by using the below command.sudo usermod -aG docker $USER
Step 8: To check the commands which are supported by the docker type the following command in the terminal.docker
Step 9: To view the information of docker enter the following command in the terminal.
- docker info
Working with Docker Images
Docker containers are run from docker images. Most of the images you will get it from the docker hub.image which is nothing but an environment like linux, unix, ubuntu.
Anybody can build and host their Docker images on Docker Hub, so most applications and Linux distributions you’ll need to run Docker containers have images that are hosted on Docker Hub.
Step 10: To check whether you have access and can download the image from docker hub use the below command.sudo docker run hello-world
Step 11: Search for the ubuntu image by using the below command.sudo docker search ubuntu
In the OFFICIAL column, OK indicates an image built and supported by the company behind the project.
Step 12: Pull the image from docker hub by the below commandsudo docker pull ubuntu
Docker Operations On Containers
Step 13: create the container using below command.sudo docker run -it ubuntu
Step 14: Start the container using below command.sudo docker start <container ID>
Step 15: Stop the container using below command.sudo docker start container ID
As you can see we have successfully installed docker in our system and performed some basic task and executed the commands on docker.
Nagios is the most popular, open source, a powerful monitoring system for any kind of infrastructure. Infrastructure refers to the basic systems and services that a country or organization needs in order to function properly. It enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. Nagios has the capability of monitoring application, services, entire IT infrastructure.
Now, let us follow the below steps to install Nagios.
Step 1: Use following commands to install required packages for Nagios.sudo apt-get install apache2 php libapache2-mod-php php-gd libgd-dev
Step 2: Create a Nagios user by the below command.sudo adduser nagios
Step 3: Create group for nagios user by the below command.sudo groupadd naggpsudo usermod -a -G naggp nagiossudo usermod -a -G naggp www-data
Once, after installing the dependencies and creation of/, creating user, and group now we will install the core services of nagios
Step 4: Create a new directory called nagios under home directory by using the below command.mkdir -nagioscd nagios
Step 5: Download the latest version of nagios core by the using below commandwget href=“https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.3.tar.gz”>https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.3.tar.gz
Step 6: Extract the downloaded file by using the below command.
- tar -zxzf nagios-4.4.3.tar.gz
Step 7: Install nagios core by using the below commandscd nagios-4.4.3<br>sudo ./configure –with-command-group=naggp<br>sudo make all<br>sudo make install<br>sudo make install-init<br>sudo make install-daemoninit<br>sudo make install-config<br>sudo make install-commandmode<br>sudo make install-exfoliation
Now copy event handler’s scripts under libexec directory. These binaries provides multiple events triggers for your Nagios web interface.
Step 8: Copy event handler’s scripts by using the below command.
- sudo cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
- sudo chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
Setup apache with authentication
Step 9: Create an Apache configuration file for your Nagios server.
- sudo vim /etc/apache2/conf-available/nagios.conf
Add the following lines to the above nagios.conf fileScriptAlias /nagios/cgi-bin “/usr/local/nagios/sbin”<Directory “/usr/local/nagios/sbin”>Options ExecCGIAllowOverride NoneOrder allow,denyAllow from allAuthName “Restricted Area”AuthType BasicAuthUserFile /usr/local/nagios/etc/htpasswd.usersRequire valid-user</Directory>Alias /nagios “/usr/local/nagios/share”<Directory “/usr/local/nagios/share”>Options NoneAllowOverride NoneOrder allow,denyAllow from allAuthName “Restricted Area”AuthType BasicAuthUserFile /usr/local/nagios/etc/htpasswd.usersRequire valid-user</Directory>
Step 10: Setup apache authentication for user nagiosadminsudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Step 11: enable Apache configuration and restart Apache service.sudo a2enconf nagiossudo a2enmod cgi rewritesudo service apache2 restart