Detailed steps for installing Jenkins under centos 7 system
- 2020-06-12 11:40:24
- OfStack
This article mainly introduces the installation of Jenkins in centos 7 and related content, sharing for your reference and study, without saying much, let's start with a detailed introduction:
The installation
Add yum repos and 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
Install java if you do not have java
sudo yum install java
Start and stop
sudo service jenkins start/stop/restart
sudo chkconfig jenkins on
Default Settings for jenkins
The & # 8226; Jenkins starts when the system starts. Details refer to/etc/init d/jenkins
The & # 8226; Jenkins creates a user called jenkins. If you modify user, you modify the user: /var/log/jenkins, /var/lib/jenkins, /var/cache/jenkins
The & # 8226; If you encounter problems, see the log/var log/jenkins/jenkins log
The & # 8226; Configuration file /etc/sysconfig/jenkins
The & # 8226; 8080 is enabled by default
Turn on and off the firewall
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-all
About java on centos
Jenkins does not support working on centos's default jdk. remove is required if shown below:
java -version
java version "1.5.0"
gij (GNU libgcj) version 4.4.6 20110731 (Red Hat 4.4.6-3)
To use Jenkins correctly:
yum remove java
You can then install openjdk
yum install java-1.7.0-openjdk
Correct 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)
Configure port
Modify/etc/sysconfig/jenkins:
JENKINS_PORT="8080"
Configure the java path
Direct startup:
sudo yum install java
0
However, we found that the startup failed, so we need to configure the java location:
sudo yum install java
1
At startup join the machine java:
sudo yum install java
2
I added the last line above.
Restart and it will run normally.
--------------------------------------------------------------------------------
Start the
When the browser enters ip and port access, the first page is being started. After the startup, a series of passwords will be entered, and then the plug-in installation interface will be entered and the default will be selected. At this time, an error will be reported:
An error occurred during installation: Forbidden
Solutions:
I "fixed it" by restarting Jenkins http: / / localhost: 8080 / restart. Restart and you can continue.
conclusion
reference
•https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions
•http://www.cnblogs.com/tjpanda88/p/4306147.html
•http://stackoverflow.com/questions/37358775/jenkins-2-5-installation-error-an-error-occurred-during-installation-forbidden