Prerequisites:
- Jenkins requires Java to run.
- Make sure port 8080 (default Jenkins port) is open if you’re using a firewall.
sudo apt update
sudo apt install fontconfig openjdk-17-jre -y
Create a jenkins script
vim jenkins.sh
#!/bin/bash
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins -y
Add execution permission
chmod +x jenkins.sh
Execute the script
./jenkins.sh
If Jenkins fails to start because a port is in use, run sudo systemctl edit jenkins
and add the following
[Service]
Environment="JENKINS_PORT=8081"
Here, "8081" was chosen but you can put another port available.
Start Jenkins and enable it to run on boot:
sudo systemctl start jenkins
sudo systemctl enable jenkins
Now, just hit the address with http://your_server_ip:8080
the page should appear as below
To get the initial password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
You can select “Install suggested plugins” or customize as needed.
wait until the process is completed
Set up the admin user and password for Jenkins.
After setting up the user, you can configure instance details or skip to the main Jenkins dashboard.
Top comments (0)