linux build jenkins

First, what is continuous integration?

(1)Continuous integration(CI)

Continuous Integration is a software development practice, that members of the development team integrate their work frequently, usually each member at least once integrated, which means integration may occur several times a day. Each integration automated build (including the compilation, publishing, automated testing) to verify that all through, so find integration errors as quickly as possible. Many teams find that this process can significantly reduce integration issues, so that the team can more quickly develop cohesive software.

image.png

(2) there is no continuous integration

Module integration projects to do, I found a lot of excuses not pass ==> waste a lot of time

The need to manually compile the package the latest code ==> opaque build process

Release code, on-line, basically by hand ==> Script flying

 

(3) Continuous Integration Best Practices:

Maintain a single code base

The build automation

Perform the test is part of the build

Integrated Log and History

Use a unified management library dependencies

Integrated at least once a day

 

(4) jenkins Introduction

JenkinsJust a platform, really works are the plug-ins. This is popular because jenkins, jenkins what plug-ins because there 
Hudsonis Jenkins' predecessor, is a continuous integration tool is based on a Java development for monitoring program duplication of work, Hudson was acquired to become the commercial version. Later, a founder wrote jenkins, jenkins on far beyond the capabilities hudson

Jenkins官网:https://jenkins.io/

Jenkins Download: http: //updates.jenkins-ci.org/

 All of mirrored jenkins: http: //mirrors.jenkins-ci.org/status.html

 

(5) Process deployment code on the line:

1. Code Acquisition (directly pulling a)

2.编译      (可选)

3.配置文件放进去

4.打包

5.scp到目标服务器

6.将目标服务器移除集群

7.解压并放置到Webroot

8.Scp 差异文件

9.重启      (可选)

10.测试

11.加入集群

 

Two, jenkins deployment

 1. Install the JDK 

1
[root@7mini-node2 ~] # yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel

2. Install jenkins

[root@7mini-node2 contos]# sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
[root@7mini-node2 contos]# sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
[root@7mini-node2 contos]# yum install jenkins

 

1
[root@7mini-node2 contos] # rpm -ivh jenkins-2.32.3-1.1.noarch.rpm
 

3. Start

1
2
3
4
5
[root@7mini-node2 contos] # service jenkins start
Starting jenkins (via systemctl): [ OK ]
 
[root@7mini-node2 contos] # netstat -tunlp |grep :8080
tcp6 0 0 :::8080 :::* LISTEN 2259 /java

4 Enter the initialization password

1
2
[root@7mini-node2 contos] # cat /var/lib/jenkins/secrets/initialAdminPassword
a93553a4865b45198ae28f77877efe19     #登陆界面有提示输入密码,初始密码文件为/var/lib/jenkins/secrets/initialAdminPassword

 

Plug completed, set the user name: jenkins, Password: jenkins

Three, jenkins plug-ins and Configuration

jenkins systems management is more important 插件管理, because jenkins all the work is done by the plugin.

In the plug-in management, there can be updated, optional plug-in is installed, the plug-in installation routine is done on this screen. For example gitlab and collaboration, we need to install gitlab plug-ins.

 

When the plug-in is not installed, you can go directly online blind ah, installation

1
2
3
4
5
6
7
下载地址
http: //updates .jenkins-ci.org/
 
解压备份plugin. tar .gz
mv  plugins  /var/lib/jenkins/
chown  -R jenkins.jenkins plugins/
service jenkins restart

  

image.png

image.png

In the advanced options, we can download the plug-in jenkins official website, then upload the plugin, as shown:

Because a lot of plug-ins required ××× can continue to download, jenkins also provides proxy settings
or carried out under the server directory to upload the plugin
directory path = / var / lib / jenkins / plugins /
this directory is to install all our plug-ins

jenkins of Contents Introduction:

1
2
3
4
5
6
7
8
9
10
[root@7mini-node2 contos] # rpm -ql jenkins
/etc/init .d /jenkins                 #jenkins的启动文件
/etc/logrotate .d /jenkins
/etc/sysconfig/jenkins              #jenkins的配置文件(可以写改默认端口)
/usr/lib/jenkins                  
/usr/lib/jenkins/jenkins .war        #jenkins的程序war包
/usr/sbin/rcjenkins                 #jenkins的为二进制文件
/var/cache/jenkins                  #jenkins的程序文件,运行程序解压出来的
/var/lib/jenkins                    #jenkins的主目录
/var/log/jenkins                    #jenkins的日志文件
1
jenkins的升级,只需要将war包解压到 /var/lib/jenkins 目录下,重启jenkins即可。 <br>友情提示: 卡启动问题 jenkins在第一次安装启动时会向官网回传信息,如果网络离线可以正常安装。<br>当网络在线,但是 还有可能是内存不足 <br>备份: tar  zcvf jenkins. tar .gz  /var/lib/jenkins ,写一个定时任务的脚本,保留15天的备份,通过增量备份。

Change the root user to configure in a test environment

1
2
3
4
5
6
vim  /etc/sysconfig/jenkins
将用户修改为root,可以调用root工具
  29 JENKINS_USER= "root"
 
修改启动端口85行,$JENKINS_PORT
service jenkins restart

  

System Management -> System Configuration

Number of actors: the number of concurrent configuration, generally set to 5, not more than 10

Usage: If the primary server, you can not vote, if it is to be selected from the level "using this node as much as possible."

Generating a wait time before: configure the time 10s, avoiding an erroneous operation, there is time to return

Guess you like

Origin www.cnblogs.com/dxqNet/p/11279090.html