Hey everyone! Today we're going to setup Jenkins on a RHEL style (CentOS) server. What is Jenkins, you might be asking? From the source:
"The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project."
That sums it up really well, I think.
What can Jenkins do for us? Specifically, in software development or dev operations, it can assist with Continuous Integration. Jenkins will build your software, clone the repository, run the project, and do pretty much whatever you can think of. It has a vast array of plugins and extensions to cater to a number of different software development languages.
First, if you're going to follow along with this guide, make sure
wget is installed on your CentOS/RHEL box.
sudo yum install wget -y
Next, we want to pull down Jenkins and install it:
wget https://pkg.jenkins.io/redhat-stable/jenkins-2.138.1-1.1.noarch.rpm sudo rpm -Uvh jenkins-2.138.1-1.1.noarch.rpm
At the time of this writing, Jenkins 2.138.1-1.1 is the latest version.
Next, you'll need java installed. There are a few different methods for installing specific versions and applying them, but for this case, Java 8 in the repos will work:
sudo yum install java -y
Assuming you're not doing this on your local workstation, you'll want to open up the port 8080 to access the browser. If you're running Jenkins on the same computer you're using, then visit
localhost:8080 for this next section. Otherwise:
sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp sudo firewall-cmd --reload
Now, we can start Jenkins and enable on boot (optional):
sudo systemctl start jenkins && sudo systemctl enable jenkins
Visit the ip address of the server followed by 8080 to access Jenkins:
You're probably going to get prompted for the secret password, and instructions on where it's located.
Throw that in the login and continue on through the setup! I create a separate user alongside admin and make that user the administrator.
Go ahead and install the recommended plugins as well if asked.
That takes care of the initial setup! In three words or less, how easy was that? Easy? Very easy? Not so easy?
The last thing we'll do in this session is head over to system security settings.
Manage Jenkins > Configure Global Security
Here, I have Enable Security checked, Jenkins' own user database selected (with Allow users to sign up Disabled), and Matrix-based security as the Authorization method. Add your username to the User/group and give yourself total permissions. For this example, I'm leaving Anonymous Users and Authenticated Users unchecked across the board.
The next thing we'll do is use Jenkins to manage a Linux box and build a sample project (Golang anyone?!). This will be scratching the surface at what Jenkins is really capable of but it should give you some ideas to start playing with in your own lab!
Thanks for reading! Please leave a comment with any feedback you might have.