<\/span><\/h2>\r\n\r\n\r\n\r\nJenkins is written in Java, and that is why we need the Java installed on our system along with some dependencies:<\/p>\r\n\r\n\r\n\r\n
sudo apt install openjdk-11-jdk default-jre gnupg2 apt-transport-https wget -y<\/pre>\r\n\r\n\r\n\r\nTo check whether Java is installed execute the following command:<\/p>\r\n\r\n\r\n\r\n
java -version<\/pre>\r\n\r\n\r\n\r\nYou should receive the following output:<\/p>\r\n\r\n\r\n\r\n
root@vps:~# java -version\r\nopenjdk version \"11.0.14\" 2022-01-18\r\nOpenJDK Runtime Environment (build 11.0.14+9-post-Debian-1deb11u1)\r\nOpenJDK 64-Bit Server VM (build 11.0.14+9-post-Debian-1deb11u1, mixed mode, sharing)<\/pre>\r\n\r\n\r\n\r\n<\/span>Step 3. Add Jenkins GPG key and PPA<\/span><\/h2>\r\n\r\n\r\n\r\nBy default the repository of Debian 11, does not contain the Jenkins, so we need to add manually the key and the PPA.<\/p>\r\n\r\n\r\n\r\n
wget https:\/\/pkg.jenkins.io\/debian-stable\/jenkins.io.key\r\n\r\nsudo apt-key add jenkins.io.key<\/pre>\r\n\r\n\r\n\r\nOnce, the GPG key is added next is to add the PPA:<\/p>\r\n\r\n\r\n\r\n
echo \"deb https:\/\/pkg.jenkins.io\/debian-stable binary\/\" | tee \/etc\/apt\/sources.list.d\/jenkins.list<\/pre>\r\n\r\n\r\n\r\nUpdate the repository before you install Jenkins:<\/p>\r\n\r\n\r\n\r\n
sudo apt update -y<\/pre>\r\n\r\n\r\n\r\nOnce, the system is updated with the latest packages, install Jenkins.<\/p>\r\n\r\n\r\n\r\n
<\/span>Step 4. Install Jenkins<\/span><\/h2>\r\n\r\n\r\n\r\nsudo apt-get install jenkins -y<\/pre>\r\n\r\n\r\n\r\nAfter the installation, start and enable the Jenkins service, in order for the service to start automatically after system reboot.<\/p>\r\n\r\n\r\n\r\n
sudo systemctl start jenkins && sudo systemctl enable jenkins<\/pre>\r\n\r\n\r\n\r\nTo check the status of the service execute the following command:<\/p>\r\n\r\n\r\n\r\n
sudo systemctl status jenkins<\/pre>\r\n\r\n\r\n\r\nYou should receive the following output:<\/p>\r\n\r\n\r\n\r\n
root@vps:~# sudo systemctl status jenkins\r\n\u25cf jenkins.service - LSB: Start Jenkins at boot time\r\n Loaded: loaded (\/etc\/init.d\/jenkins; generated)\r\n Active: active (exited) since Sat 2022-02-12 04:50:43 EST; 1min 35s ago\r\n Docs: man:systemd-sysv-generator(8)\r\n Tasks: 0 (limit: 4678)\r\n Memory: 0B\r\n CPU: 0\r\n CGroup: \/system.slice\/jenkins.service\r\n\r\nFeb 12 04:50:41 test.vps systemd[1]: Starting LSB: Start Jenkins at boot time...\r\nFeb 12 04:50:41 test.vps jenkins[37526]: Correct java version found\r\nFeb 12 04:50:42 test.vps su[37564]: (to jenkins) root on none\r\nFeb 12 04:50:42 test.vps su[37564]: pam_unix(su-l:session): session opened for user jenkins(uid=114) by (uid=0)\r\nFeb 12 04:50:42 test.vps su[37564]: pam_unix(su-l:session): session closed for user jenkins\r\nFeb 12 04:50:43 test.vps jenkins[37526]: Starting Jenkins Automation Server: jenkins.\r\nFeb 12 04:50:43 test.vps systemd[1]: Started LSB: Start Jenkins at boot time.<\/pre>\r\n\r\n\r\n\r\nAnother way to check if Jenkins, is active and running is to check port 8080<\/b><\/p>\r\n\r\n\r\n\r\nnetstat -tunlp | grep 8080<\/pre>\r\n\r\n\r\n\r\nYou should receive the following output:<\/p>\r\n\r\n\r\n\r\n
root@vps:~# netstat -tunlp | grep 8080\r\ntcp6 0 0 :::8080<\/b> :::* LISTEN 37591\/jenkins<\/b>: \/usr<\/pre>\r\n\r\n\r\n\r\n