jenkins installation rpm method

# If starting from jenkins 2.357, the jdk version uses at least jdk11

# Install the dependent environment required by jenkins

yum -y install jdk1.8.0_161

java -version

# Configure the JAVA_HOME environment variable

vim /etc/profile

export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_161

export JRE_HOME=$JAVA_HOME/jre

export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

source /etc/profile

# Verify that the JAVA_HOME environment is configured correctly

echo $JAVA_HOME

/usr/lib/jvm/jdk1.8.0_161


 

# download jenkins

wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat/jenkins-2.346-1.1.noarch.rpm

# install jenkins

rpm -ivh jenkins-2.346-1.1.noarch.rpm

# Modify the java configuration of jenkins, if the jdk installed by yum does not need to modify this configuration

vim /etc/init.d/jenkis

# usr/bin/java # yum installation method, java environment variable path

usr/local/jdk1.8.0_161/bin/java # Other ways to install jdk, jdk path

# Modify the jenkins port

vim /etc/sysconfig/jenkins

JENKINS_PORT=7777 # Change the port to 7777

# Create a soft link

ln -s /usr/local/jdk1.8.0_161/bin/java /usr/bin/java

# Start the jenkins service

systemctl start jenkins

# View password

cat  /var/lib/jenkins/secrets/initialAdminPassword

# access jenkins

http://172.16.137.187:7777



 

# Notice!

# jenkins启动报错Job for jenkins.service failed because the control process exited with error code. See "systemctl st

# jenkins needs jdk, indicating that the java configuration of jenkins is wrong

echo $JAVA_HOME # nothing is displayed

source /etc/profile

echo $JAVA_HOME

#Display /usr/lib/jvm/jdk1.8.0_161

vim /etc/init.d/jenkins

# vim/etc/init.d/jenkins file, find the specified location and add /bin/java to the suffix of /usr/lib/jvm/jdk1.8.0_161

systemctl start jenkins

# Continue to report errors, enter the following command

systemctl daemon-reload

systemctl restart jenkins

Problem: can't change the jenkins port to solve

# Enter the directory
cd /usr/lib/systemd/system
vim jenkins.service
# or
vim /usr/lib/systemd/system/jenkins.service

# Modify to the desired port
Environment="JENKINS_PORT=8889"

# Reload the configuration file
systemctl daemon-reload

Guess you like

Origin blog.csdn.net/love_THL/article/details/127431104