BUILD PIPELINE WITH JENKINS - AppGambit - Medium

Jenkins is a free and open-source automation server. It helps automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery.

supports version control tools, including, Subversion, Git, Mercurial,  and RTC, and can execute Apache Ant, Apache Maven, and sbt based projects as well as arbitrary shell scripts and Windows batch commands. Jenkins is free software. In this post are learning how to Install Jenkins on Ubuntu.

Installing Jenkins in Ubuntu.

First, add the repository key to the system:

$ wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -

When the key is added, the system will return OK. Next, append the Debian package repository address to the server’s sources.list:

$ sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

When both of these are in place, run update so that apt will use the new repository:

$ sudo apt update
$ sudo apt install openjdk-8-jre-headless

Finally, install Jenkins and its dependencies:

$ sudo apt install jenkins

Now that Jenkins and its dependencies are in place, we’ll start the Jenkins server.

$ sudo systemctl restart jenkins
$ sudo systemctl status jenkins
$ a2enmod proxy
$ a2enmod proxy_http
$ a2enmod headers

Installation is finished, now point your jenkins-domain to this server’s ip.

jenkins is running in port 8080 by default, lets route all traffic to that port by a apache2 reverse proxy.

add this in /etc/apache2/sites-avalable/jenkins.conf

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName jenkins-domain.com
ServerAlias jenkins-domain.com

<Proxy http://127.0.0.1:8080/>
   Order deny,allow
   Allow from all
</Proxy>

ProxyPass     /  http://127.0.0.1:8080/ nocanon
ProxyPassReverse  /  http://127.0.0.1:8080/
ProxyPassReverse  /  http:/jenkins-domain.com/

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

To set up your installation, visit Jenkins on its default port, 8080, using your server domain name or IP address: http://jenkins-domain.com

You should see the Unlock Jenkins screen, which displays the location of the initial password:

Unlock Jenkins screen

In the terminal window, use the cat command to display the password:

$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword

paste that password on the website and continue installation.

SSL is a MUST.

this is how we install Jenkins on Ubuntu.

Leave a Reply

Your email address will not be published. Required fields are marked *