测试拉取代码: [[emailprotected] ~]# cd web-demo/[[emailprotected]
一、案例环境
二、部署Gitlab
1)部署Gitlab
2) 配置免密登录
3)测试免密登录
三、部署Jenkins
四、Jenkins集成Gitlab
五、部署Nginx
六、Jenkins实现代码自动上线
七、Jenkins实现代码自动部署与回退及反复构建
Centos 7 192.168.1.6 gitlab gitlab
Centos 7 192.168.1.7 Jenkins jenkins
Centos 7 192.168.1.8 Nginx nginx
二、部署Gitlab 1)部署Gitlab [[email protected] ~]# yum -y install epel-release curl openssh-server openssh-clients postfix cronie policycoreutils-python patch #安置所需依赖 [[email protected] ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm #对gitlab的版本并没有什么特殊的限制 [[email protected] ~]# yum -y localinstall gitlab-ce-12.3.5-ce.0.el7.x86_64.rpm [[email protected] ~]# vim /etc/gitlab/gitlab.rb #便于使用URL路径访谒 external_url ‘‘ #下载 中文补丁包 [[email protected] ~]# head -1 /opt/gitlab/version-manifest.txt #检察gitlab的版本 gitlab-ce 12.3.5 [[email protected] ~]# git clone https://gitlab.com/xhang/gitlab.git -b v12.3.5-zh [[email protected] ~]# cd gitlab/ [[email protected] gitlab]# git diff v12.3.5 v12.3.5-zh > /root/v12.3.5-zh.dif [[email protected] gitlab]# patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < ../v12.3.5-zh.diff #将适才的diff文件做为补丁导入到gitlab中 #该命令执行过程中,一路回车跳过即可 [[email protected] ~]# gitlab-ctl start # 启动gitlab [[email protected] ~]# gitlab-ctl reconfigure #从头配置gitlab
web页面访谒测试
可以看出gitlab的网站页面已经汉化! 2) 配置免密登录 [[email protected] ~]# ssh-keygen [[email protected] ~]# cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuWnEReFVhIiODuTO/NzdjuvPMY0tQ89NuYGtMxDJJAXnbChK8dbe0Iu4GNHY9zeSP0OaYJvVV9Nu/qtcZqgg+zKgLohdoI5QKXWcZ1JT/kNpIbnVnUYE0/AYZ8nMbjNiUsSD5BaDy+t9uuRxh+QCOrZDkYZw1EZioDpDoSR1XzrOac69QIag2XUU04rmWkR9/fbfwGzusTzfO2thk3vcZn+DzLqJqYy9ufkZeTGlqJnVC6//caakMtY475NSUKnGT+YoRsStXXI/9CVrpY8cPZ5eiFs34xGZWU1uhsx9UQ50pNeA7iqM6CIKpb4MPtqKDLIb83Bztz1VsfBJRMxer [email protected] #本地生成密钥对,便于ssh登录
web页面访谒
由于适才跳过了插件安置,,所以需要本身手动安置,下载本人供给的插件软件包,下载链接:https://pan.baidu.com/s/16fxH1J0WO6tW1bhPwmd60w
提取码:432n [[email protected] ~]# rm -rf /var/lib/jenkins/plugins/ #将安置孕育产生的插件目录进行删除 [[email protected] ~]# tar zxf jenkins-plugins.tar.gz -C /var/lib/jenkins/ #将插件软件包解压到指定的位置 [[email protected] ~]# sed -i ‘s/http:\/\/updates.jenkinsci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g‘ /var/lib/jenkins/updates/default.json && sed -i ‘s/http:\/\/www.google.com/https:\/\/www.baidu.com/g‘ /var/lib/jenkins/updates/default.json #将jenkins下载插件的路径,变动为国内源 [[email protected] ~]# systemctl restart jenkins #从头启动Jenkins
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/29349.html