赞
踩
jenkins:43.255.31.74
gitlab:120.26.11.190
setenforce 0 systemctl disable firewalld systemctl stop firewalld 确保事先安装java yum -y install java 安装jenkins源 wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key yum -y install jenkins 修改jenkins配置文件 vim /etc/sysconfig/jenkins JENKINS_USER="root" (用户修改为root) JENKINS_PORT="8081" (端口修改为8081) 修改完后保存退出 启动jenkins systemctl start jenkins 查看jenkins web页面登陆密码 cat /var/lib/jenkins/secrets/initialAdminPassword
yum install curl policycoreutils openssh-server openssh-clients postfix -y wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm yum -y install gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm 修改gitlab配置文件 vim /etc/gitlab/gitlab.rb 修改: external_url 'http://120.26.11.190' :修改为本机地址 保存退出 启动服务 gitlab-ctl reconfigure 查看服务状态 gitlab-ctl status 服务的启动、关闭、重启 gitlab-ctl start/stop/restart 登录gitlab http://120.26.11.190 管理员:root 密码:初始配置新密码,最少8位
创建一个测试文件
两台服务器获取公钥
ssh-keygen -t rsa
jenkins服务器公钥
cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDac5/I1YCFd9kQavTw+87IIiRImyaY2vUHqBtb9sOUgCgWmvtF57TroeSo50D19to0pxxyjUz1Y6BwhgIlD1U5kgSGweQucMZ2xvGi+PXIOh9qa28gB0raK2s1k+/gMiRK+GPkV3kkTn7H+9hDe58M6whbHcIhao4ydLBerdXcM+FP8g+St5F3ft82LuGpJAYqscIJqgo65mFvCSugZxCf1CQFYWV7tkCd5F4YgZABuDKYpwWa9vVi4lxgnW3+CKC/ioTUAHFk2foAlYCD7u8rt4JOx4YiIFgvNEhd0bVKV90QCyNu3eoTtIZ4tKLJMu8vk1YX/ovYub9yUU3DA9f7 root@c2020122322280
gitlab服务器公钥
cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsIXDVz+voFC7DwhpmUJe+5Pir6OGRxrn4Co9TxMEn7ZDoWEUaak9vBH5LpzxdUUNZZCf60PVOnzTSbsF13cOaxPUkRxWHRrXCBYHyJxSi4LQnHXbMdUpfE8jPLEPK+dFmD2ERoxtBVtvUmW7nsekrle71OFWEcddNfK2wEjBAyzcEmg9YY1E7RxcDz0nJ0C6L5G2m+RTjzTxu1iF6ltNjCFA2KWrCwXdTJe9d6Twz17NBaD/EYrl32SlJHUJzo4Y0yK96ZzlX8tVaJ0Jiu0nCpF9jyWZsg3HU/e10Zs9gXwlqFTo0PFvkvsDk3mYUfbJr7f4hoaK0Dv/Mqycp46qB root@xiaoxiong
添加两台服务器的公钥
在gitlab服务器上下载刚刚创建的文件
[root@xiaoxiong src]# git clone git@120.26.11.190:root/test.git
[root@xiaoxiong src]# ls
debug gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm kernels test
[root@xiaoxiong src]# cd test/
[root@xiaoxiong test]# ls
a.txt text
可以看到创建的文件下载下来了
两台服务器互相传递私钥
[root@xiaoxiong test]# ssh-copy-id root@43.255.31.74
[root@c2020122322280 ~]# ssh-copy-id root@120.26.11.190
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。