How to install and configure Jenkins in Ubuntu?

To install and configure Jenkins on Ubuntu, you can follow these steps:

  1. To install Java: First, make sure that Java is already installed on the system. You can use the following command to check the Java version:
java -version

If Java is not installed yet, please use the following command to install OpenJDK:

sudo apt update
sudo apt install default-jdk
  1. Install Jenkins: Add the official repository for Jenkins and install Jenkins. Execute the following command:
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'
sudo apt update
sudo apt install jenkins
  1. Start Jenkins: Begin the Jenkins service and set it to automatically start.
sudo systemctl start jenkins
sudo systemctl enable jenkins
  1. Set up Jenkins: Access the Jenkins web interface by entering http://localhost:8080 in your browser. When accessing for the first time, you will need to enter the initial password, which can be found in the /var/lib/jenkins/secrets/initialAdminPassword file. Follow the on-screen instructions to complete the initialization setup for Jenkins, including installing necessary plugins.
  2. Set up Jenkins plugins: Log in to the Jenkins backend, select “Manage Jenkins” -> “Manage Plugins” -> “Available” tab, and install the required plugins, such as Git, Maven, etc.
  3. Set up Jenkins nodes: If you need to run Jenkins tasks on other computers, you can configure Jenkins nodes. In the Jenkins backend, select “Manage Jenkins” -> “Manage Nodes” -> “New Node”, enter the node information and save.

By following the steps above, you can install and configure Jenkins in Ubuntu, and start using Jenkins for continuous integration and deployment.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds