1.检查java环境是否安装
> java -version
-bash: java: command not found

2. 安装java,推荐1.8版本,详情>>> Yum安装Java
 > yum install java-1.8.0-openjdk
3.检查安装是否成功

 > java -version
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)

4. 下载Jenkins >>>官网https://jenkins.io/doc/pipeline/tour/getting-started/
> wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
5. 运行
> java -jar jenkins.war --httpPort=8080
#首次运行会生成部署密码:
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
                                                                                                       xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

6. 浏览器访问,开始安装Jenkins
 127.0.0.1:8080
7.安装GitLab插件
配置git自动部署,链接推荐:
http://blog.csdn.net/ruangong1203/article/details/73065410

Gitlab自动触发Jenkins构建打包:
https://www.cnblogs.com/bugsbunny/p/7919993.html

Jenkins强制转换中文:
http://www.cnblogs.com/EasonJim/p/6373769.html

多服务器自动部署,发布到多台服务器:
http://blog.csdn.net/fenglailea/article/details/42708879

 
问题解决方案:
Jenkins节点配置 : http://blog.csdn.net/ouyanggengcheng/article/details/76093861
Jenkins关闭重启: https://www.cnblogs.com/jmcui/p/6933084.html
Jenkins内存占用率高的问题:
http://stackoverflow.link/question/37335306/jenkins-running-at-very-high-cpu-usage
https://www.javafm.com/issue/158

两台服务器之前的ssh授权:参考>>>https://www.phpsong.com/2169.html(无效)
#在当前服务器执行:
ssh www@192.168.195.195
#试图建立一次与目标服务器192.168.195.195的控制,目的:将目标服务器添加至当前服务器已知服务器内,
#查看文件确认是否操作成功
vim /root/.ssh/known_hosts

Jenkins.sh Jenkins控制脚本[启动|停止]
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  
#!/bin/bash
 
#停止标志
STOP="[\033[5;31m停止\033[0m]"
#警告标志
WARM="[\033[5;31m警告\033[0m]"
#启动标志
START="[\033[5;32m启动\033[0m]"
 
pid=`ps -ef | grep jenkins.war | grep -v 'grep'| awk '{print $2}'| wc -l`
if "$1" "start" ];then
        if [ $pid -gt 0 ];then
    echo -e "jenkins is running... $WARM"
    else
    nohup java -jar /Jenkins/jenkins.war --httpPort=8080 >/dev/null 2>&1 &
    echo -e 'jekins' $START
 
        fi
elif [ "$1" "stop" ];then
        echo -e "jenkins $STOP"
        exec ps -ef | grep jenkins | grep -v grep | awk '{print $2}'| xargs kill -9
else
        echo -e "Please input like this:"./jenkins.sh start" or "./jenkins stop" " $WARM
fi
 
  
---------------------------------------------------------------------------------------------
不忘初心 方得始终!

唯有志存高远,方能风行天下。

道之所存,虽千万人吾往矣! 情之所钟,虽千万里吾念矣~

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。