Jenkins is one of the oldest and most popular CI/CD tools. It dominates the market and is a requirement for more than 50% of job positions. However, Jenkins is a complicated solution, installing it requires a lot of heavy lifting and can become a pain. In this article, I will uncover the fastest way to deploy Jenkins using only one command.
Step 1. Install Docker
We will need to meet a prerequisite which is having Docker on our system. If you already have docker installed, move straight to Step 2.
Older versions of Docker were called docker, docker.io, or docker-engine. If these are installed, uninstall them:
sudo apt-get remove docker docker-engine docker.io containerd runc
Update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Use the following command to set up the stable repository:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Update the apt package index, and install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:
sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io
More detailed instructions for all supported platforms can be found on a website: https://docs.docker.com/engine/install/ubuntu/
Step 2. The command
I’ll just leave it here:
docker run -d -p 8080:8080 jenkins/jenkins
in this command:
-d starts the container in a daemon mode
-p 8080:8080 exposes the required port to outside
If you want to have persistent storage, you can also bind your local volume inside the container:
docker run -d -p 8080:8080 jenkins/jenkins -v /your/home:/var/jenkins_home
Step 3. Some extra clicks in the UI
Open http://127.0.0.1:8080 in your browser.
Jenkins will ask for an initial password, you can obtain it from docker logs using the following command:
docker logs $(docker ps | grep jenkins | awk '{print $1 }')
Click through the setup wizard, wait until basic plugins are installed, and enjoy your fresh Jenkins installation!
Apply for individual mentorship here: https://yourdevopsmentor.com/apply/
Connect with me on Linkedin: https://www.linkedin.com/in/vladimir-mukhin-devops/
If you enjoyed the article, check out other blogs as well: https://yourdevopsmentor.com/blog/
Originally published on https://yourdevopsmentor.com/
Top comments (0)