Deployed on Docker Centos Jenkins (Jenkins finished included)

 

surroundings:

The machine - macOS 10.12.6

Docker - Docker Community Editoin_ Version 17.06.0-ce-mac19 (see separate installation procedure)

Used Docker mirror: centos (latest)

 

installation steps:

1, and starts a new container centos docker

tester_mac:~ $  docker run -itd --privileged --name=jenkins -p 4000:4000 centos /usr/sbin/init

--privileged parameters in order to obtain systemctl usage rights for the service to start Jenkins

 

2, installation openjdk

[root@7bf0a5e7e7c6 /]# yum install -y java

 

3, install Jenkins, describes two methods here, because the first method, download Jenkins rpm package is too slow, the second method I used last

method one,

# Yum added Jenkins warehouse to warehouse

[root@7bf0a5e7e7c6 /]# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo 

# Rpm with an authentication key import Jenkins, they did not know its purpose, I In the second method, do not import the authentication key Jenkins, currently used without any problem
[root @ 7bf0a5e7e7c6 /] # rpm --import https: / /jenkins-ci.org/redhat/jenkins-ci.org.key  

# Installation Jenkins

[root@7bf0a5e7e7c6 /]# yum install -y jenkins

 

The second method (recommended by tomcat is also OK, here I direct rpm to install)

Download Jinkens rpm package locally, and then the rpm package lrzsz uploaded from the local to the docker (CentOS docker lrzsz not installed by default, so it is necessary to install).

a, Jinkens rpm package Download: https://jenkins.io/zh/download/ , I downloaded version is jenkins-2.190.1-1.1.noarch.rpm

b, installation lrzsz: 

[root@7bf0a5e7e7c6 /]# yum install -y lrzsz

of c, and the rpm lrzsz uploaded from a local packet to the docker

[root@7bf0a5e7e7c6 /]# rz

Run the command "rz", will pop up a file selection window, select the rpm package

d, Jenkins rpm installation package

[root@7bf0a5e7e7c6 /]# rpm -ih jenkins-2.190.1-1.1.noarch.rpm

e, because when I got up docker, map port 4000, so it is necessary to change the default configuration port Jenkins

[root@7bf0a5e7e7c6 /]# vi /etc/sysconfig/jenkins

The JENKINS_PORT = "8080" into JENKINS_PORT = "4000", but also to JENKINS_USER = "jenkins" into JENKINS_USER = "root", because Jenkins need to call system commands, using the root user would be more convenient, user production environment is recommended jenkins multi-step authorization process.

 

4, install initscripts, because docker centos mirror is a streamlined version of centos, it will be missing some dependencies may be needed when you start Jenkins in docker, if no initscripts installed, it will be reported "/etc/rc.d/init. d / functions: No such file or directory ", resulting in failure to start jenkins

[root@7bf0a5e7e7c6 /]# yum install -y initscripts

 

Of course be mounted disposable

[root@7bf0a5e7e7c6 /]# yum install -y java jenkins initscripts

5, start the service Jenkins

[root@7bf0a5e7e7c6 /]# systemctl start jenkins

Can systemctl? Status jenkins View service startup state

 

 

 

6, access jenkins console: http://127.0.0.1:4000

The default account is admin console login jenkins

The default password to view this command: cat / var / lib / jenkins / secrets / initialAdminPassword

 

 

 Jenkins finished 

1, the installation Localization: Chinese plug-in

First enter the plug-in management, the path below, and then enter a keyword: Localization, search, select the Install

 

 

 

 

 

2, will not automatically restart installing Jenkins, also you need to check the settings below (if not successful restart, which went docker manual restart: systemctl restart jenkins)

 

 

 3, the finished effect

 

 

 

 

 

This completes deployed on Docker Centos Jenkins

 

 

Note: please indicate the source, thank you! ^^

 

 

 

Guess you like

Origin www.cnblogs.com/testeyes/p/11701652.html