centos7 build jenkins

background

Cheap hand turn on Baidu search  centos7 installation Jenkins , varied okay. Looking at the official documentation to open out of it, some of the pits recorded encounter

Java installation environment

1. Check the server version

centos7, continue.

cat /etc/redhat-release

CentOS Linux release 7.2.1511 (Core)

2. Install java

yum install java

But for centos there is a problem, not mounted gcj(GNU Compiler for the Java Programing Language ), leading to jenkins does not work , see if the java version looks like this, you need to uninstall, install other versions

java -version
java version "1.5.0" gij (GNU libgcj) version 4.4.6 20110731 (Red Hat 4.4.6-3)

3. Uninstall abnormal version:

yum remove java

4. Search openJDK version

yum search openjdk

#java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle #java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment #java-1.8.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector ...

5. Installation openJDK

#安装`1.8.0`的
yum install java-1.8.0-openjdk

6. Review the java version

java -version

openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)

Installation jenkins

You can choose to install LTS Release version, like once every six months iteration. Or Weekly Release , updated once every week or two.
The latest version 2.24every two weeks,No estimate will be released October 9The latest 2.25, each version will have some enhancement & bug fix.

1. pull library configuration file corresponding to the local

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

jenkins.repo content like this:

[jenkins]
name=Jenkins-stable
baseurl=http://pkg.jenkins.io/redhat-stable
gpgcheck=1 

2. Import public key

sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key

3. Install jenkins

`-y`参数:回答全部问题为是
sudo yum -y install jenkins

The basic installation is complete.
Incidentally posted about LTS installation instructions, only slightly different:

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key sudo yum install jenkins

4. Update jenkins

yum update jenkins

Configuration familiar jenkins

1. System configuration files

cat /etc/sysconfig/jenkins | more

You can gain several important configuration information project

  • JENKINS_HOME="/var/lib/jenkins", Storage configuration and working papers jenkins
  • JENKINS_PORT="8080", Jenkins default port 8080

2. Configure Folder

This very important position

ls /var/lib/jenkins

There are jobs, logs, pluginsand so on a number of files and folders. Do not mess delete
this mainly looked at the pluginsfolder, all plug-ins are on the inside, such as plug-in ssh-slaves, there will be a ssh-slavesfolder and ssh-slaves.jpi.
When a plug-in is not installed successfully, there will be a to .tmpthe end of the file

3. Log

logs related to two locations:

  • /var/lib/jenkins/logsThere are logs, temporarily did not record what seems, after catching.
  • /var/log/jenkins/jenkins.logRecorded plug-in installation logs, and other causes of failure information is very clear, important

Start & Configuration

1. Start Service

service jenkins start

2. The browser access

IP地址:8080

3. Get the administrator password

Follow the prompts, go /var/lib/jenkins/secrets/initialAdminPassword, copy paste into it, continue

4. Select the installation

The default recommend it, left. The second custom plug-in, if you know what plug-ins required plug-in is doing it, then select custom bar

5. Wait for plug-in installation

If normal, nothing to say. If you like this, some plug-ins have failed, refresh the page, the next step. Failure of the plug-in and later re-loaded.

plugin-failed

6. plug-in installation failure analysis

Here posted a similar ISSUE , Unsolved , my personal experience may have reasons for the network
to view jenkins.log, search failedkeywords, some plug-ins rely on credentials, because the network did not install successfully reasons credentials, it did not lead to several successful installation.
Jenkins management interface to manually install it

Caused by: java.io.IOException: Plain Credentials Plugin v1.3 failed to load. - credentials v2.1.5 is missing. To fix, install v2.1.5 or later.

7. manually install plug abnormality

System Management  ->  Manage Plugins  ->  Optional plug-in , table top right asynchronous filter, plug-in check, direct installation. Install the plug-in installation here.

plugin table

Note
abnormal plug-in processing time, here to note the dependencies between plug-ins, A Plug-dependent B plug is not installed successfully, install before installing B A, management plug-ins in the list of exceptions written very clearly.

Uninstall jenkins

An exception if a particular plug-in is automatically installed a large, refreshing did not appear the next step, wait for a long time to no avail, reinstall deleted

1. rpm -e jenkins
2. there will be some residual files scattered around

find / -iname jenkins | xargs -n 1000 rm -rf

Finish.

Original link: https: //segmentfault.com/a/1190000007086764

Guess you like

Origin www.cnblogs.com/soymilk2019/p/11209550.html