Install jenkins on cent OS 7.
1] Create user jenkins
[root@localhost ~]# adduser jenkins
[root@localhost ~]# passwd jenkins
Changing password for user jenkins.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#
2] Provide sudo access to user jenkins
3] Enable the Jenkins repository
[jenkins@localhost ~]$ curl --silent --location
http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee
/etc/yum.repos.d/jenkins.repo
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for jenkins:
[jenkins]
name=Jenkins-stable
baseurl=http://pkg.jenkins.io/redhat-stable
gpgcheck=1
[jenkins@localhost ~]$ cat /etc/yum.repos.d/jenkins.repo
[jenkins]
name=Jenkins-stable
baseurl=http://pkg.jenkins.io/redhat-stable
gpgcheck=1
[jenkins@localhost ~]$ sudo rpm --import
https://jenkins-ci.org/redhat/jenkins-ci.org.key
4] Install jenkins package.
[jenkins@localhost ~]$ sudo yum install jenkins
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
jenkins
| 2.9 kB 00:00:00
jenkins/primary_db
| 29 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package jenkins.noarch 0:2.176.1-1.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================
=========================
Package Arch Version
Repository Size
======================================================================
=========================
Installing:
jenkins noarch 2.176.1-1.1
jenkins 74 M
Transaction Summary
======================================================================
=========================
Install 1 Package
Total download size: 74 M
Installed size: 74 M
Is this ok [y/d/N]: y
Downloading packages:
jenkins-2.176.1-1.1.noarch.rpm
| 74 MB 00:01:08
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : jenkins-2.176.1-1.1.noarch
1/1
Verifying : jenkins-2.176.1-1.1.noarch
1/1
Installed:
jenkins.noarch 0:2.176.1-1.1
Complete!
5] Start jenkins service
[jenkins@localhost ~]$ sudo systemctl start jenkins
[jenkins@localhost ~]$ sudo systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset:
disabled)
Active: active (running) since Wed 2019-06-12 15:05:15 IST; 6s ago
Docs: man:systemd-sysv-generator(8)
Process: 22471 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited,
status=0/SUCCESS)
Tasks: 21
CGroup: /system.slice/jenkins.service
└─22492 /etc/alternatives/java
-Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headl...
Jun 12 15:05:13 localhost.localdomain systemd[1]: Starting LSB: Jenkins
Automation Server...
Jun 12 15:05:13 localhost.localdomain runuser[22476]:
pam_unix(runuser:session): session o...0)
Jun 12 15:05:15 localhost.localdomain jenkins[22471]: Starting Jenkins [
OK ]
Jun 12 15:05:15 localhost.localdomain systemd[1]: Started LSB: Jenkins
Automation Server.
Hint: Some lines were ellipsized, use -l to show in full.
[jenkins@localhost ~]$
[jenkins@localhost ~]$ sudo systemctl enable jenkins
6] Enable port on machine for jenkins URL
[jenkins@localhost ~]$ sudo firewall-cmd --permanent --zone=public
--add-port=8080/tcp
sudo firewall-cmd --reload
[jenkins@localhost ~]$ netstat -tulpn | grep :8080
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp6 0 0 :::8080 :::*
LISTEN 22492/java
7] Connect jenkins using below link
==> http://192.168.*.*:8080
8] Select password from given location file.
[jenkins@localhost ~]$ cat /var/lib/jenkins/secrets/initialAdminPassword
c548bf029c674115b99ea3b0f25203e2
9] Click on install suggested plugin.