DEV Community

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

Posted on • Edited on

1

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

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more