码迷,mamicode.com
首页 > 其他好文 > 详细

jenkins

时间:2018-06-25 20:30:00      阅读:723      评论:0      收藏:0      [点我收藏+]

标签:class   asc   ant   SM   list   fhe   选择   ODB   安装jenkins   

jenkins介绍

技术分享图片

 技术分享图片

 jenkins安装

技术分享图片

1.安装openjdk

[root@centos-03 ~]# yum install -y java-1.8.0-openjdk

2.安装Jenkins yum源

[root@centos-03 ~]# wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo

3.安装Jenkins  key

[root@centos-03 ~]# rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
[root@centos-03 ~]# 

4.yum安装

[root@centos-03 ~]# yum install -y jenkins

5.启动Jenkins

[root@centos-03 ~]# systemctl start jenkins
[root@centos-03 ~]# ps aux|grep jenkins
jenkins    3492 64.2  6.2 2252192 62356 ?       Ssl  15:38   0:21 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/libjenkins -jar
/usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon --httpPort=8080 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20 root 3513 1.0 0.0 112664 936 pts/0 R+ 15:39 0:00 grep --color=auto jenkins [root@centos-03 ~]#

6.我们可以在Jenkins日志中查看jenkins密码,或是在initialAdminPassword文件中查看

[root@centos-03 yum.repos.d]# less /var/log/jenkins/jenkins.log 
[root@centos-03 yum.repos.d]# 
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

8a72142953e9417f81970ffcb9366194

This may also be found at: /var/lib/jenkins/secrets/initialAdminPassword
[root@centos-03 yum.repos.d]# cat /var/lib/jenkins/secrets/initialAdminPassword 
8a72142953e9417f81970ffcb9366194
[root@centos-03 yum.repos.d]# 

了解jenkins

1.浏览器访问192.168.133.66:8080进入jenkins页面,选择安装推介插件。

2.创建第一个管理员用户,下一步安装成功

技术分享图片

3.jenkins配置文件目录

[root@centos-03 yum.repos.d]# vim /etc/sysconfig/jenkins 
[root@centos-03 yum.repos.d]# 

4.程序主目录(如果想备份,直接拷贝这个目录就可以了)

[root@centos-03 yum.repos.d]# cd /var/lib/jenkins/
[root@centos-03 jenkins]# ls
config.xml                                      nodeMonitors.xml
hudson.model.UpdateCenter.xml                   nodes  (多节点的时候用到的目录)
hudson.plugins.git.GitTool.xml                  plugins (插件目录)
identity.key.enc                                secret.key
jenkins.CLI.xml                                 secret.key.not-so-secret
jenkins.install.InstallUtil.installingPlugins   secrets
jenkins.install.InstallUtil.lastExecVersion     updates
jenkins.install.UpgradeWizard.state             userContent
jenkins.model.JenkinsLocationConfiguration.xml  users
jobs     (我们创建的任务所在的目录)                                       workflow-libs
logs     (日志相关目录)
[root@centos-03 jenkins]#

发布php代码(上)  

技术分享图片

1.在创建任务之前我们需要安装必须的两个插件系统管理-》管理插件-》已安装插件列表中看是否安装了Git plugin和publish over ssh,发现没有publish over ssh我们从可选插件中安装,选中直接安装,安装完成之后,linux服务器直接重启Jenkins。

[root@centos-03 jenkins]# systemctl restart jenkins
[root@centos-03 jenkins]# 

2.在配置publish over ssh之前需要生成一对秘钥,如果服务器上有默认的秘钥对可以不生成直接用

[root@centos-03 jenkins]# 
[root@centos-03 jenkins]# cd /root/.ssh/
[root@centos-03 .ssh]# ls
authorized_keys  id_rsa  id_rsa.pub  known_hosts
[root@centos-03 .ssh]# 

3.将私用填到key中  

[root@centos-03 .ssh]# cat id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA2M8M7nJ9SZEklwQzQGfSjQG0RS1Bp9u8Xif9x+25FwvBaXTX
3rErqBwx4N/kcS5zmu4eTNny2/04bz86ZfAQOT2Hc2Pmnao2M5Ggrm1P2I7eRr2V
dJUyTfl7MX/F+MF0LWSkHYCin/no6Oju3yJcD5sqZPZ3ekY4CqA3uObOI1h7dB7b
WAhvtiBy0/oDCnDT75BD70apzpWTBVuHun7Mmgc3z/r3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IAqvZm5DaIDuEg3YfdJxDCIFW2yrTPNAScPY/pxNcLpnm
asxvVFoU0Kdbkl0zJyfowpcAH7tzy6i8C0HprkzQUnwhjfbVZA5bCZLFZXAXfHUJ
3d4BAoGABifvGGtRUiOhdOeWXbb5kdwD0dbn+33b5XDMwaHrvU8CAxV3qcC2f4yp
yGOH84LinfasLO0I6aNQ/XCCZcQ3yy1I/iiwVFmBvJEtVYO5Jfsb5TGm7coMwJe6
9YKUJ/NOBqEkaXzssVoUZhc+Kf37GQvH5VwlfHEaN5xZZ2TpOko=
-----END RSA PRIVATE KEY-----
[root@centos-03 .ssh]# 

技术分享图片

4.将公钥配置到远程机器上(centos-01)

[root@centos-03 .ssh]# cat id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYzwzucn1JkSSXBDNAZ9KNAbRFLUGn27xeJ/3H7bkXC8FpdNfesSuoHDHg3+RxLnOa7h5M2fLb/ThvPzpl8BA5PYdzY+adqjYzkaCubU/Yjt5GvZV0lTJN+Xsxf8X4wXQtZKQdgKKf+ejo6O7
fIlwPmypk9nd6RjgKoDe45s4jWHt0HttYCG+2IHLT+gMKcNPvkEPvRqnOlZMFW4e6fsyaBzfP+venLMU+ykuvmH9g3Sjh2dUF1wd3czxYcnxCFWbxxqkuH8VAUZFJ8DpBh3G6Cy/A4/5MzprKY/x3jpMfKbkrXkngcnfuCg9oEhTX9cNdbb3UUS
rc+lQNbj3aOMmL root@sunyujun02 [root@centos-03 .ssh]#
[root@centos-02 ~]# vim .ssh/authorized_keys 
[root@centos-02 ~]# cat .ssh/authorized_keys 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD810lCxBhCtMzrmSx302M6PUMKRxNK0TBrFQzwbsL8KAcgJXvH0ysc5OIw8lEFpIQirmZODVHg85I/2u3Xgz9yEf5ucF33R0xjJpcD0sq9LvMj0A2lO2RppsjgNyA4wcYcxfOg9HcYI97622l
ssO5012qWbr6k9Bv3QOD0r+F6mdoFXvXFIF2YL//60kPcPXzyPgW6ErDkA1Pum9DQOiys6iN/tH4iCa7ynRzCkLlVxt21V8mrewAldn/JOMuJVEcUtKrmtH+6wny6sJHqEStlF46xZyIH1/SeDyd8oCDwC+PU2HLTc3hishe/ny8ofm9QcC+zgb
BSPnm+I1+/vwfZ root@centos-02 ##centos02 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYzwzucn1JkSSXBDNAZ9KNAbRFLUGn27xeJ/3H7bkXC8FpdNfesSuoHDHg3+RxLnOa7h5M2fLb/ThvPzpl8BA5PYdzY+adqjYzkaCubU/Yjt5GvZV0lTJN+Xsxf8X4wXQtZKQdgKKf+ejo6O7
fIlwPmypk9nd6RjgKoDe45s4jWHt0HttYCG+2IHLT+gMKcNPvkEPvRqnOlZMFW4e6fsyaBzfP+venLMU+ykuvmH9g3Sjh2dUF1wd3czxYcnxCFWbxxqkuH8VAUZFJ8DpBh3G6Cy/A4/5MzprKY/x3jpMfKbkrXkngcnfuCg9oEhTX9cNdbb3UUS
rc+lQNbj3aOMmL root@sunyujun02 [root@centos-02 ~]#

5.测试ssh是否能登录

[root@centos-03 .ssh]# ssh centos-02
The authenticity of host ‘centos-02 (192.168.133.88)‘ can‘t be established.
ECDSA key fingerprint is bf:dc:4b:e3:1c:99:f4:12:6f:d0:a8:e0:13:8a:d0:dd.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘centos-02‘ (ECDSA) to the list of known hosts.
Last login: Mon Jun 25 18:53:00 2018 from 192.168.133.1
[root@centos-02 ~]# 

5.配置ssh server

技术分享图片

6.点击test测试成功

技术分享图片

7.保存即可

发布php代码(下)

  

 

 

  

  

 

jenkins

标签:class   asc   ant   SM   list   fhe   选择   ODB   安装jenkins   

原文地址:https://www.cnblogs.com/sunyujun/p/9225814.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!