Add yum repos, then install
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install jenkins
sudo yum install java
sudo service jenkins start/stop/restart
sudo chkconfig jenkins on
/etc/init.d/jenkins
jenkins
, if you modify the user, you must modify the owner: /var/log/jenkins
, /var/lib/jenkins
, /var/cache/jenkins
/var/log/jenkins/jenkins.log
/etc/sysconfig/jenkins
firewall-cmd --zone=public--add-port=8080/tcp --permanent
firewall-cmd --zone=public--add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-all
Jenkins does not support working on the default jdk of centos. If it looks like this, you need to remove:
java -version
java version "1.5.0"gij(GNU libgcj) version 4.4.620110731(Red Hat 4.4.6-3)
In order to use Jenkins correctly:
yum remove java
Then you can install openjdk
yum install java-1.7.0-openjdk
The correct is as follows:
java -version
java version "1.7.0_79"
OpenJDK Runtime Environment(rhel-2.5.5.1.el6_6-x86_64 u79-b14)
OpenJDK 64-Bit Server VM(build 24.79-b02, mixed mode)
Modify /etc/sysconfig/jenkins
:
JENKINS_PORT="8080"
Start directly:
sudo service jenkins start
But found that the startup failed, so you need to configure the java location:
vi /etc/init.d/jenkins
Join the native java at startup:
[ root@iZ94xvn71eeZ ~]# vim /etc/init.d/jenkins
# Set up environment accordingly to the configuration settings
[- n "$JENKINS_HOME"]||{ echo "JENKINS_HOME not configured in $JENKINS_CONFIG";if["$1"="stop"]; then exit 0;else exit 6; fi;}[-d "$JENKINS_HOME"]||{ echo "JENKINS_HOME directory does not exist: $JENKINS_HOME";if["$1"="stop"]; then exit 0;else exit 1; fi;}
# Search usable Java as/usr/bin/java might not point to minimal version required by Jenkins.
# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html
candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/bin/java
/usr/java/jdk1.7.0_80/bin/java
"
I added the last line above.
Restart, it can run normally.
The browser enters the ip and port access. The first page is starting. After the start, you will be prompted to enter a string of passwords, and then enter the plug-in installation interface, select the default, then an error will be reported:
An error occurred during installation: Forbidden
Solution:
I "fixed it" by restarting Jenkins http://localhost:8080/restart. Just restart to continue.
Recommended Posts