DEV Community

Cover image for Install Jenkins in Ubuntu 18.04
Z. QIU
Z. QIU

Posted on • Edited on

Install Jenkins in Ubuntu 18.04

Info: This post is one of the article in context of this post: Huawei Cloud ECS server notes

Install firstly Java:

sudo apt update
sudo apt install openjdk-8-jdk
Enter fullscreen mode Exit fullscreen mode

Add official Jenkins source key into Ubuntu source:

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'
Enter fullscreen mode Exit fullscreen mode

Update apt source and install Jenkins:

sudo apt update
sudo apt install jenkins
Enter fullscreen mode Exit fullscreen mode

Service Jenkins shall automatically start once the installation finishes. One can check its status using:

systemctl status jenkins
Enter fullscreen mode Exit fullscreen mode

or

serviec jenkins status
Enter fullscreen mode Exit fullscreen mode

Alt Text

We can use systemctl cmd to stop/start/restart jenkins service.

Default port of Jenkins is 8080, thus one can visit Jenkins in browser via address: http://localhost:8080/. In order to change default port of Jenkins, one should modify file /etc/default/jenkins:

vim /etc/default/jenkins
Enter fullscreen mode Exit fullscreen mode

Change HTTP_PORT to his/her expected port id:

# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=8080
Enter fullscreen mode Exit fullscreen mode

Jenkins requires the default password when user logs in for ths first time. The initial Password can be viewed using:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Enter fullscreen mode Exit fullscreen mode

Top comments (0)