If your system does not come with git or jdk, you also need to install one
yum install git java
< h2 id="blogTitle1">1. Installation
The first method
sudo wget -O /etc/yum.repos.d/jenkins .repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install jenkins
The second method
Directly download the rpm installation
The address of each version https:/ /pkg.jenkins.io/
wget https://pkg.jenkins.io/redhat/jenkins-2.156-1.1.noarch.rpm
rpm -ivh jenkins-2.156-1.1.noarch.rpm
2. Configuration
vim /etc/sysconfig/jenkins
#listening port
JENKINS_PORT="8080"
3. Configure permissions
In order to avoid various problems with permissions, use root directly here
Change the user to root
vim /etc/sysconfig/jenkins
#Modify configuration
$JENKINS_USER="root"
Modify directory permissions
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
restart
service jenkins restart
ps -ef | grep jenkins
4. Start
systemctl start jenkins
I failed to start here:
The error message is Starting Jenkins bash: /usr/bin/java: No such file or directory
It is a problem with the configuration of the java environment.
Find your jdk directory, I’m in usr/local/java/jdk1 .8.0_171/
, just create a soft link:
ln -s /usr/local/java/jdk1 .8.0_171/bin/java /usr/bin/java
Then restart
5. Installation
Visit jenkins address http:
p>
p>
Execute the command to view the password:
cat /var/lib/jenkins/secrets/initialAdminPassword
Plugin installation selection recommended plug-in
Installation in progress
After the plug-in is installed, an administrator account will be created
Complete the installation
Run:
yum install git java
p>
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/ jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install jenkins
wget https://pkg.jenkins.io/redhat/jenkins-2.156-1.1.noarch.rpm
rpm -ivh jenkins-2.156-1.1.noarch.rpm
vim /etc/sysconfig/jenkins
#listening port
JENKINS_PORT="8080"
vim /etc/sysconfig/jenkins
#Modify configuration
$JENKINS_USER="root"
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
service jenkins restart
ps -ef | grep jenkins
systemctl start jenkins
ln -s /usr /local/java/jdk1.8.0_171/bin/java /usr/bin/java
cat /var/lib/jenkins/secrets/initialAdminPassword
p>