Get the App
SLTechnology News&Howtos  ›  Servers  › 

Detailed explanation of the steps of installing Jenkins under centos 7 system

Shulou Source: shulou.com Published: 2022-06-02 01:06:49 10月04日 Update

This article mainly introduces you about the installation of Jenkins in centos 7, and shares it for your reference and study. Without saying much, let's take a look at the detailed introduction:

Installation

Add yum repos, and then install

Sudo wget-O / etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.reposudo rpm-- import https://jenkins-ci.org/redhat/jenkins-ci.org.keysudo yum install jenkins

Install java if you don't have java

Sudo yum install java

Start and stop

Sudo service jenkins start/stop/restartsudo chkconfig jenkins on

Default settings for jenkins

Jenkins starts when the system starts. For more information, please see / etc/init.d/jenkins

Jenkins will create a user called jenkins. If you modify the user, you need to modify the owner: / var/log/jenkins, / var/lib/jenkins, / var/cache/jenkins

If you encounter a problem, check the log / var/log/jenkins/jenkins.log

Configuration file / etc/sysconfig/jenkins

8080 is enabled by default

Turn the firewall on and off

Firewall-cmd-zone=public-add-port=8080/tcp-permanentfirewall-cmd-zone=public-add-service=http-permanentfirewall-cmd-reloadfirewall-cmd-list-all

About java on centos

Jenkins does not support working on the default jdk of centos. Remove is required if the following is shown:

Java-versionjava version "1.5.0" gij (GNU libgcj) version 4.4.6 20110731 (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 information is as follows:

Java-versionjava 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 java path

Start directly:

Sudo service jenkins start

However, it is found that startup failed, so you need to configure the java location:

Vi / etc/init.d/jenkins

When you start the java that joins the machine:

[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.htmlcandidates="/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 "

The last line above is what I added.

Restart, you can run normally.

Start

When the browser enters ip and port access, the first page is being started. After startup, you will be asked to enter a series of passwords, then enter the plug-in installation interface and select default. At this time, an error will be reported:

An error occurred during installation: Forbidden

Solution:

I "fixed it" by restarting Jenkins http://localhost:8080/restart. That is, restart and you can continue.

Summary

The above is the whole content of this article, I hope that the content of this article can bring some help to your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.

Referenc

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

Tags: Configuration content port reference study work support input system one line creation location method password that is ownership plug-ins files logs Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux macOS Shulou Tech Info Apple Docker