Setting Up Jenkins on Ubuntu Server From Scratch

  Java, Jenkins, Maven, Nexus

Installing and configuring Jenkins

On Debian-based distributions, such as Ubuntu, you can install Jenkins through apt-get.

Recent versions are available in an apt repository. Please make sure to back up any current Hudson or Jenkins files you may have.

Change into your home directory where you have write access rights and enter the following sequence of commands to install Jenkins:

$ wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
$ sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
$ sudo apt-get update
$ sudo apt-get install jenkins

Jenkins will be launched as a daemon on system boot. See /etc/init.d/jJenkins for more details. The  installation also creates a user ‘jenkins’  to run this service.
A log file will be placed in /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.

By default, Jenkins listens on port 8080 which is usually occupied by a web / app container. To avoid future problems, we change Jenkins default port to 8082. To do that, just edit the file /etc/default/jenkins and modify the appropriate line to:

HTTP_PORT=8082

Here, port 8082 was chosen but you can specify any available port here. Because we edited a configuration file, we need to restart the Jenkins service:

$ sudo service jenkins restart

After the restart, you should be able to access Jenkins with the URL http://<ip-of-your-ubuntu-server>:8082.

LEAVE A COMMENT