Jenkins[1] is a well-known automation server often used for automating tasks involving building, testing, and deploying applications in a continuous integration/continuous development (CI/CD) format. In this tutorial, I will explain how to install and configure Jenkins and create a job that installs PackStack[2] (a proof of concept OpenStack cloud).
For this how-to, I created a CentOS VM in GNOME Boxes[3] that will be used to run Jenkins as a master and also deploy the job on the same machine. Jenkins uses port 8080 as default, so make sure that port is not in use. Jenkins can also be installed as a Docker container.1. Download the Generic Java WAR[4] file.
2. In a terminal, change to the Download directory and execute the following command:
java -jar jenkins.war
3. Go to http://localhost:8080
and copy the password from the given path:
cat /home/jenkins/.jenkins/secrets/initialAdminPassword
4. Create the first Admin user.
5. Add your SSH key found under ~/.ssh/id_rsa.pub
to User-name (top-right)→Configure→SSH Public Keys
. This will be used to SSH into hosts without providing a password. If you don't have an id_rsa.pub
, you can create a key by using the ssh-keygen
command. Initially, you must execute ssh-copy-id user@host-ip
to set up passwordless authentication.
Also, your Jenkins user should be added to the wheel group and should have passwordless sudo permissions as shown.
6. Configure matrix-based security[5] for your Admin user and other users. By default, Jenkins provides all permissions to any user, which is NOT at all recommended. I've given all permissions to the Admin user.
7. Now to the fun