Page 1

LinuxDady.Com How to setup jenkins step by step for beginners

For more information visit

How to setup Jenkins step by step BY DEEPAK KUMAR · PUBLISHED JULY 11, 2019 · UPDATED JULY 11, 2019

In this tutorial we are going to learn how to setup Jenkins server in our infra. But before installation of Jenkins set your mind about required hardware for Jenkins and how many jobs will run on your jenkins server at a time. This is important because if you will not plan your jenkins server hardware configuration then job execution and build process will impact on jenkins server.

How to setup jenkins? Pr required hardware preferred for jenkins server in production environment RAM : 16 GB CPU : 2 Dual cores JAVA : Above JDK 1.8 OS : Centos/Rhel This hardware requirement is only a basic idea which is given on official website of jenkins. But mainly it’s depended on how many projects or job you are running at a time. If you are running single job at time, then why 16 GB RAM. So, it depends on need.

How to install jenkins? There are mainly two way to install jenkins. So, it’s depended on your requirement which one you want to follow. Here we will discuss both ways. ▪ ▪

From yum or rpm package. From .war file.

How to setup jenkins from yum repository As you know jenkins is written in java language so its basic requirement is java should be installed on our base machine where we are installing jenkins. We can also install java manually by download its package from its office website. But that is time consuming so we are installing it by yum .

1 yum install java* -y

Java has been successfully installed in our base machine now check java version. 1 java -version

Jenkins package is not available in default repository of centos or redhat. So, we have to add jenkins EPEL. Let’s do it. 1 yum install wget* -y 2 wget -O /etc/yum.repos.d/jenkins.repo 3 rpm --import

[Click & Read:– Jenkins server and it’s basic terminology] [Click & Read:– Aws application load balancer configuration step by step]

After adding EPEL now jenkins package will be in our jenkins EPEL. So, we can simply install it with the help of yum command. 1 yum install jenkins -y

I think you better understood how to install Jenkins server. Now just only check service is up properly or not. 1 systemctl start jenkins.service 2 systemctl enable jenkins.service 3 systemctl restart jenkins.service 4 systemctl status jenkins.service

/var/lib/jenkins is jenkins default home directory. So, have a look of it properly. Because jenkins will put all data here and jenkins config.xml file is also available here that we can change accordingly if required. 1 cd /var/lib/jenkins/ 2 ls

We have competed all step how to set jenkins. Now open your browser and hit below URL from your browser. But change your server IP address according. Also check your firewall, selinux and SG if you are using aws ec2 instance. 1

when you will hit above URL in your browser it will prompt for default password and will tell location where jenkins generated default password during installation.

So, go to location and copy paste password and click on –> Continue 1 cat /var/lib/jenkins/secrets/initialAdminPassword

Jenkins first time login and select option . You want to install plugin automatically or manually.

When required plugin will installed then create jenkins dashboard login user name and password according to requirement.

Username and password for jenkins dashboard has been created. So have a look below.

How to setup jenkins second way The second way of jenkins installation is by jenkins.war file. But first you have to download package from jenkins official website and then copy .war file at

your required location. The benefit of doing this is there is not internet dependency on base machine and limitation of jenkins installation by yum or rpm is only root privilege or root user can install jenkins setup. But with the help of .war file normal user can setup jenkins without any permission issue. Download package from below link. 1

If you are using Linux based operating system, then simple copy below link into your terminal. 1 wget 2 ls

Now let’s run jenkins.war file that we have download. You can run with the help of nohup and & shown as fig. & sign will start jenkins service in the background and nohup file will record all logs. 1 java -jar jenkins.war

Service of jenkins has been started via .war file. So take access from URL and set default password. 1

Now default password will generate where you have put your jenkins.war file. Copy that file and try to login and set your desired password. Next step will be same as above.

Conclusion In this tutorial we have learnt how to setup jenkins server in our IT infra from both method. We can use any method depend of our requirement. I will recommend you use jenkins.war file for installation because we can install it without internet and root user dependency. Still if you have any query let me know. I will try my best to resolve them.

Interview question on Jenkins 1. How to check jenkins version 2. What is hardware requirement for jenkins server? 3. What is jenkins home directory?

4. How we will take backup of jenkins if required? 5. Can we install jenkins without internet if yes how? 6. What is daily routine use cases of jenkins in your infra ?

Profile for LinuxDady In this tutorial we are going to learn how to setup Jenkins server in our infra. But befo... In this tutorial we are going to learn how to setup Jenkins server in our infra. But befo...

Profile for linuxdady