Install Jenkins from the terminal on Ubuntu 19.10

Joseph Syverson
Dec 24, 2019 · 4 min read

The following process is easy, but easily finding instructions for doing so was time-consuming, if not difficult. So, this tutorial…

Published: 2018/12/23


Jenkins needs Java and Docker to work. Problems: (1) Java is owned by Oracle and (2) Docker doesn’t have functional repositories for Ubuntu 19.10 yet.

Please leave comments below if this doesn’t work!


First, update your system:

sudo apt-get update

Java:

# add the Linux Uprising reposudo add-apt-repository ppa:linuxuprising/java# update your system againsudo apt-get update# install javasudo apt install openjdk-11-jresudo apt install openjdk-11-jre-headless

Docker:

sudo apt-get remove docker docker-engine docker.io containerd runcsudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
#the following line should return 'Ok'
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88

The last line above should return:

pub   rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <docker@docker.com>
sub rsa4096 2017-02-22 [S]

There is currently a lack of corresponding data for Ubuntu 19.10 in the Docker repositories. The documentation provides a clue for how to solve the problem, but it is not explicit. The following is the line presented by the Docker install documentation (do not run this line if you have Ubuntu 19.10):

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

Line three returns the name of your distribution version. In this case, it is eoan. However, because there are missing packages for eoan, we’ll change the line to refer to the previous version of Ubuntu (disco):

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
disco \
stable"

Update your system now that you’ve added the repository, then install the necessary software:

sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io

Finally, verify that you Docker works:

sudo docker run hello-world

The response should be:

Unable to find image hello-world:latest locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:4fe721ccc2e8dc7362278a29dc660d833570ec2682f4e4194f4ee23e415e1064
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/

Finally, Jenkins:

# the following command should return 'OK'wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

The documentation says we need to add the repository to our list manually. So, open the config file for your package manager, apt's repositories:

sudo nano /etc/apt/sources.list

Once you have the text editor open, use the arrow keys navigate to the bottom of the file. Copy, then paste (hold Ctrl Shift V to paste text into the Terminal) the address for the Jenkins repository:

deb https://pkg.jenkins.io/debian binary/
The bottom line of your file should look like this

Update from your repos again:

sudo apt-get update

Let’s get Jenkins now that our computer knows where to find it:

sudo apt-get install jenkins

Start and enable Jenkins to complete the install process:

sudo systemctl start jenkinssudo systemctl enable jenkins

Now, open up a tab in your browser and navigate to Jenkin’s default port: localhost:8080. You’ll be prompted there to paste a default password stored in your system.

In your terminal, run:

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

Copy the output from the above command (Ctrl Shift C)and paste it in the text box in your browser window:

After clicking the Continue button, install the suggested plugins, unless you want to customize your initial setup.

Then, enter your user information, then click Save and Continue:

Confirm the port that you want Jenkins to run on. The default is 8080 and unless you have a reason for not using that port (say, you’re already running something on that port), then just go with the default and click Save and Finish:

To enter the graphical Jenkins app, just click the Start using Jenkins button:

All done. Please leave comments if this doesn’t work! Thanks.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade