Jenkins is an open-source automation tool based on Java. It helps developers to build, test, and deploy software projects automatically. Jenkins is an important part of DevOps, allowing you to continuously deliver your software by integrating with different technologies. It offers a lot of plugins that help you to integrate various DevOps stages. Jenkins is a self-contained Java-based program that can be run on Linux, macOS, and other Unix-like operating systems.

This post will show you how to install Jenkins on Arch Linux.

Step 1 – Configure Repository

By default, the default repository is outdated in Arch Linux, so you will need to modify the default mirror list. You can do it by editing the mirrorlist configuration file:

nano  /etc/pacman.d/mirrorlist

Remove all lines and add the following lines:

## Score: 0.7, United States
Server = http://mirror.us.leaseweb.net/archlinux/$repo/os/$arch
## Score: 0.8, United States
Server = http://lug.mtu.edu/archlinux/$repo/os/$arch
Server = http://mirror.nl.leaseweb.net/archlinux/$repo/os/$arch
## Score: 0.9, United Kingdom
Server = http://mirror.bytemark.co.uk/archlinux/$repo/os/$arch
## Score: 1.5, United Kingdom
Server = http://mirrors.manchester.m247.com/arch-linux/$repo/os/$arch
Server = http://archlinux.dcc.fc.up.pt/$repo/os/$arch
## Score: 6.6, United States
Server = http://mirror.cs.pitt.edu/archlinux/$repo/os/$arch
## Score: 6.7, United States
Server = http://mirrors.acm.wpi.edu/archlinux/$repo/os/$arch
## Score: 6.8, United States
Server = http://ftp.osuosl.org/pub/archlinux/$repo/os/$arch
## Score: 7.1, India
Server = http://mirror.cse.iitk.ac.in/archlinux/$repo/os/$arch
## Score: 10.1, United States
Server = http://mirrors.xmission.com/archlinux/$repo/os/$arch

Save and close the file, then update all the package indexes with the following command:

pacman -Syu

Step 2 – Install Jenkins

By default, the Jenkins package is included in the Arch Linux default repository. You can install it easily with the following command.

pacman -S jenkins

You will also need to install the fontconfig package on your server. You can install it using the following command.

pacman -S fontconfig

Jenkins also installs Java automatically. You can check whether you have installed Java with the following command.

archlinux-java status

You will get the following output.

Available Java environments:
  java-11-openjdk (default)

To check the Java version, run the following command.

java --version

You should see the following output.

openjdk 11.0.17 2022-10-18
OpenJDK Runtime Environment (build 11.0.17+1)
OpenJDK 64-Bit Server VM (build 11.0.17+1, mixed mode)

Step 3 – Configure Jenkins

Next, you will need to edit the Jenkins default configuration file and define your Java path.

nano /etc/conf.d/jenkins

Change the following lines:

JAVA=/usr/lib/jvm/java-11-openjdk/bin/java   
JAVA_ARGS="-Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true"

Save and close the file, then reload the systemd daemon to apply the changes.

systemctl daemon-reload

Now, start the Jenkins service using the following command.

systemctl start jenkins

You can check the status of Jenkins with the following command.

systemctl status jenkins

You should see the following output.

● jenkins.service - Extendable continuous integration server
     Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; preset: disabled)
     Active: active (running) since Wed 2023-01-04 23:44:26 EST; 25s ago
   Main PID: 75311 (sh)
      Tasks: 40 (limit: 2362)
     Memory: 240.1M
     CGroup: /system.slice/jenkins.service
             ├─75311 /bin/sh -c "eval \$JENKINS_COMMAND_LINE"
             └─75312 /usr/lib/jvm/java-11-openjdk/bin/java -Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true -jar /usr/share/java/jenki>

Jan 04 23:44:35 archlinux jenkins[75312]: *************************************************************
Jan 04 23:44:35 archlinux jenkins[75312]: *************************************************************
Jan 04 23:44:35 archlinux jenkins[75312]: *************************************************************
Jan 04 23:44:35 archlinux jenkins[75312]: Jenkins initial setup is required. An admin user has been created and a password generated.
Jan 04 23:44:35 archlinux jenkins[75312]: Please use the following password to proceed to installation:
Jan 04 23:44:35 archlinux jenkins[75312]: d8c00da0dc784653ad1dfbe40d8e0b17
Jan 04 23:44:35 archlinux jenkins[75312]: This may also be found at: /var/lib/jenkins/secrets/initialAdminPassword
Jan 04 23:44:35 archlinux jenkins[75312]: *************************************************************
Jan 04 23:44:35 archlinux jenkins[75312]: *************************************************************
Jan 04 23:44:35 archlinux jenkins[75312]: *************************************************************

Step 4 – Access Jenkins Dashboard

At this point, Jenkins is installed and listens on port 8090. You can check it with the following command.

ss -antpl | grep java

You should see the following output.

LISTEN 0      0                  *:8090             *:*    users:(("java",pid=74709,fd=8))

Now, open your web browser and access the Jenkins web interface using the URL http://your-server-ip:8090. You should see the Jenkins login screen.
jenkins password screen
Next, retrieve the Jenkins root password using the following command.

cat /var/lib/jenkins/secrets/initialAdminPassword

You should see the Jenkins password in the following output.

d8c00da0dc784653ad1dfbe40d8e0b17

Type the above password in the Jenkins screen and click on the Continue button. You should see the Jenkins plugin installation screen.
jenkins plugin installation screen
Click on the Install suggested plugins. You should see the admin user creation screen.
jenkins admin user creation
Set your admin username, password, and email, then click on the Save and Continue button. You should see the Instance configuration screen.
jenkins instance configuration
Set your Jenkins URL and click on the Save and Finish button. You should see the following screen.
jenkins installed
Click on Start using Jenkins. You should see the Jenkins dashboard on the following screen.
jenkins dashboard

Conclusion

In this tutorial, we explained how to install Jenkins on Arch Linux 8. You can now integrate Jenkins with any software technology and start to build, test and deploy your application automatically. You can also try to deploy Jenkins on dedicated server hosting from Atlantic.Net!