Install Jenkins on Debian


Before we start, let's ask ourselves the question: What is Jenkins? Jenkins is an open source continuous integration server written in java that stands out for its ease of use. We could go into what this continuous integration and continuous delivery (CI/CD) stuff is all about, but we'll leave that to you to investigate. Installing Jenkins takes no more than 10 minutes. The first thing we need is to have java 8 installed, as versions 10 and 11 are not supported by Jenkins.
sudo apt update sudo apt install openjdk-8-jdk
We are going to install Jenkins from its repositories, therefore we will need to import the GPG key
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
Now we need to add the Jenkins repository to our apt, at this point it's a bit up to the consumer to put it in the main list by editing
vi /etc/apt/sources.list y añadiendo el repositorio deb http://pkg.jenkins.io/debian-stable binary/
or creating a list for Jenkins
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Whenever we add new repositories we have to update apt because otherwise it is as if we have done nothing.
sudo apt update
Once the update is complete, we can install
sudo apt install jenkins
And finally we start the service and configure it to start with the system
sudo systemctl start jenkins sudo systemctl enable jenkins
With these simple steps we would already have Jenkins installed on our machine running on http on port 8080. Ummm http? better let's give it some security where we have 2 options Apache, Nginx,.... as a reverse proxy, either by doing the following or both why not?
sudo openssl pkcs12 -inkey dominio.net.key -in dominio.net.pem -export -out keys.pkcs12 sudo keytool -importkeystore -srckeystore keys.pkcs12 -srcstoretype pkcs12 -destkeystore /var/lib/jenkins/jenkins.jks
These commands will prompt you to enter a password, edit
vi /etc/sysconfig/jenkins
and in the configuration leave the following line as this one
JENKINS_ARGS="--httpPort=-1 --httpsPort=8443 --httpsKeyStore=/var/lib/jenkins/jenkins.jks --httpsKeyStorePassword=the password that you entered before"
We restart Jenkins
sudo systemctl restart jenkins
Ready, we have our Jenkins listening on https on port 8443, personally I would also add a reverse proxy apache. This was just the installation, we will create a second post or expand this one with the first steps after the installation.


Gracias por leer nuestros posts.

No hay comentarios

Comenta la entrada