可以看到github上只能是开源的,刚才由于发布到public上,所以别人也可以看到
gitlab的安装:私网里用 server1
1、安装gitlab
下载gitlab
[root@server1 ~]# yum install -y policycoreutils-python #解决依赖性,然后再进行安装gitlab
[root@server1 ~]# rpm -ivh gitlab-ce-11.9.9-ce.0.el7.x86_64.rpm
warning: gitlab-ce-11.9.9-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
error: Failed dependencies:
policycoreutils-python is needed by gitlab-ce-11.9.9-ce.0.el7.x86_64
[root@server1 gitlab]# vim /etc/gitlab/gitlab.rb
13 external_url 'http://172.25.58.1' #修改成当前主机的IP
[root@server1 gitlab]# gitlab-ctl reconfigure #修改后直接编译启动
Running handlers:
Running handlers complete
Chef Client finished, 473/1268 resources updated in 04 minutes 12 seconds
gitlab Reconfigured!
加载成功~~~
查看状态
[root@server1 gitlab]# gitlab-ctl status #查看状态
[root@server1 gitlab]# gitlab-ctl status #查看状态
run: alertmanager: (pid 11019) 709s; run: log: (pid 10804) 746s
run: gitaly: (pid 10915) 715s; run: log: (pid 9979) 922s
run: gitlab-monitor: (pid 10962) 714s; run: log: (pid 10635) 772s
run: gitlab-workhorse: (pid 10930) 715s; run: log: (pid 10482) 811s
run: logrotate: (pid 10531) 798s; run: log: (pid 10546) 795s
run: nginx: (pid 10498) 809s; run: log: (pid 10512) 805s
run: node-exporter: (pid 10943) 714s; run: log: (pid 10599) 784s
run: postgres-exporter: (pid 11070) 708s; run: log: (pid 10849) 740s
run: postgresql: (pid 10128) 910s; run: log: (pid 10186) 906s
run: prometheus: (pid 10984) 712s; run: log: (pid 10732) 752s
run: redis: (pid 9911) 932s; run: log: (pid 9932) 928s
run: redis-exporter: (pid 10970) 713s; run: log: (pid 10681) 761s
run: sidekiq: (pid 10424) 822s; run: log: (pid 10441) 821s
run: unicorn: (pid 10367) 828s; run: log: (pid 10403) 825s
然后浏览器输入IP,进行登陆的初时密码设置,然后登陆~~
第一次登录会设置用户名,和密码
创建一个项目
设置项目名称~~
此时会提示 新建公钥密码~~
添加公钥,哪个主机进行上传或者下载项目,就添加哪个主机用ssh-keygen生成的 下的pub密码~~~
添加成功~~~
克隆新建仓库地址~~~
上传项目:
[root@foundation58 demo]# ls
yyz
[root@foundation58 demo]# git add * #提交代码到本地仓库
[root@foundation58 demo]# git commit -m "add yyz" # 代码提交到缓存区 git commit -m "描述"
[root@foundation58 demo]# git remote add origin git@172.25.58.1:root/test.git #提交到远程仓库
fatal: remote origin already exists.
[root@foundation58 demo]# git remote -v
origin git@github.com:yyzstupid/demo.git (fetch)
origin git@github.com:yyzstupid/demo.git (push)
#进行推送
[root@foundation58 demo]# git push -u origin master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 276 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:yyzstupid/demo.git
2c69c6a..7ac94dd master -> master
Branch master set up to track remote branch master from origin.
成功~~~~此时可以看到gitlab代码仓库中刚才推送的信息
本地从gitlab上下载项目:
[root@server1 mnt]# git clone git@172.25.58.1:root/test.git
[root@server1 mnt]# git clone git@172.25.58.1:root/test.git
Cloning into 'test'...
The authenticity of host '172.25.58.1 (172.25.58.1)' can't be established.
ECDSA key fingerprint is de:81:94:1c:6f:b8:17:c5:d0:29:96:8f:b0:2b:2e:d8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.25.58.1' (ECDSA) to the list of known hosts.
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
[root@server1 mnt]# ls
test
[root@server1 mnt]# cd test/
[root@server1 test]# ls
README.md
做到了截图63页了~~~
可以直接看122页之前上课截过的
刚刚配置完毕gitlab
jenkins安装:server2
[root@server2 gitlab]# ls
gitlab-ce-11.0.1-ce.0.el6.x86_64.rpm jenkins-2.121.1-1.1.noarch.rpm
gitlab-ce-11.2.0-ce.0.el7.x86_64.rpm jenkins-2.121.3-1.1.noarch.rpm
gitlab-ce-11.9.9-ce.0.el7.x86_64.rpm jenkins-2.164.3-1.1.noarch.rpm
jdk-8u171-linux-x64.rpm jenkins.war
[root@server2 gitlab]# rpm -ivh jdk-8u171-linux-x64.rpm
[root@server2 gitlab]# rpm -ivh jenkins-2.164.3-1.1.noarch.rpm
[root@server2 gitlab]# systemctl start jenkins
[root@server2 ~]# ls
gitlab jenkins-2.190.3-1.1.noarch.rpm
[root@server2 ~]# rpm -Uvh jenkins-2.190.3-1.1.noarch.rpm
进行更新~~
如果想进行更新的话,可以修改这个文件里的更新网站,改成清华大学开源镜像网站即可
[root@server2 gitlab]# cd /var/lib/jenkins/
[root@server2 jenkins]# ls
config.xml nodeMonitors.xml
hudson.model.UpdateCenter.xml nodes
identity.key.enc plugins
jenkins.CLI.xml secret.key
jenkins.install.UpgradeWizard.state secret.key.not-so-secret
jenkins.telemetry.Correlator.xml secrets
jobs userContent
logs users
[root@server2 jenkins]# cat hudson.model.UpdateCenter.xml
<?xml version='1.1' encoding='UTF-8'?>
<sites>
<site>
<id>default</id>
<url>https://updates.jenkins.io/update-center.json</url>
</site>
[root@server2 updates]# pwd
/var/lib/jenkins/updates
[root@server2 updates]# ls
default.json
1、编辑这个文件,将google替换成baidu 2、文件里的更新网站,改成清华大学开源镜像网站
一旦仓库变更,系统主动更新