How to install and configure Jenkins on Ubuntu 20.04?
Jenkins is an open-source automation server that helps to automate the building, testing, and deployment of applications. It's widely used in the software development industry to streamline the development process. In this article, we will learn how to install and configure Jenkins on Ubuntu 20.04.
Prerequisites
Before we begin, make sure you have a user account with sudo privileges. If you don't have one, create one using the following command
sudo adduser your_username
After adding the user account, add the user to the sudo group using the following command
sudo usermod -aG sudo your_username
Step 1: Update the system
Before installing any new package, it's always a good practice to update the system. Run the following command to update the system
sudo apt-get update
Step 2: Install Java
Jenkins is built in Java, so we need to install Java on our system. Run the following command to install Java
sudo apt-get install default-jdk
Step 3: Install Jenkins
To install Jenkins on Ubuntu, follow the steps below
Add the Jenkins GPG key using the following command
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
Add the Jenkins repository to the apt sources list using the following command
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Update the apt package list to include the newly added repository.
sudo apt-get update
Finally, install Jenkins using the following command
sudo apt-get install jenkins
Step 4: Configure Jenkins
After the installation is complete, you can access Jenkins by navigating to http://localhost:8080 in your web browser. The first time you access Jenkins, you will be prompted to enter the initial administrator password. You can find the password in the following file
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Enter the password and click on "Continue". Then, you can choose the default plugins or select the ones you need. After that, you will be asked to create the first admin user.
Step 5: Secure Jenkins
Jenkins comes with basic security features, but it's recommended to enable more advanced security features to protect your installation. To enable advanced security features, follow the steps below
Click on "Manage Jenkins" from the Jenkins dashboard.
Click on "Configure Global Security".
Choose "Matrix-based Security" and create a user with "Overall Administer" permissions.
Click on "Save" to apply the changes.
Step 6: Install Plugins
Jenkins has a wide range of plugins that can help you to customize your installation according to your needs. To install plugins, follow the steps below
Click on "Manage Jenkins" from the Jenkins dashboard.
Click on "Manage Plugins".
In the "Available" tab, select the plugins you want to install and click on "Install".
Restart Jenkins to apply the changes.
Conclusion
In this article, we learned how to install and configure Jenkins on Ubuntu 20.04. Jenkins is a powerful automation tool that can help you to streamline your development process and improve the efficiency of your development environment. With Jenkins, you can automate the building, testing, and deployment of your applications, and ensure that they run consistently across different platforms.
Comments
Post a Comment
Comments are always welcome, that will help us to motivate ourselves and improve our services. Thanks!!