【1225】代碼管理平臺gitlab
22.14/22.15 安裝gitlab
22.16 使用gitlab
22.17 gitlab備份和恢復
22.14/22.15 安裝gitlab
gitlab 官網 https://about.gitlab.com/gitlab-com/
官方安裝文檔:https://about.gitlab.com/install/#centos-7
要求服務器內存不少於2g,否則會卡死
1、創建 gitlab 的安裝源
[root@arslinux-01 ~]# vim /etc/yum.repos.d/gitlab.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
2、安裝 gitlab
[root@arslinux-01 ~]# yum install -y gitlab-ce
3、自動配置 gitlab
[root@arslinux-01 ~]# gitlab-ctl reconfigure
[root@arslinux-01 ~]# netstat -lntp
4、關閉 gitlab,可以看到 gitlab 相關服務
[root@arslinux-01 ~]# gitlab-ctl stop
5、停止本地之前安裝的 nginx 服務,redis-server
[root@arslinux-01 ~]# /etc/init.d/nginx stop
Stopping nginx (via systemctl): [ 確定 ]
[root@arslinux-01 ~]# chkconfig nginx off
[root@arslinux-01 ~]# killall redis-server
6、啓動 gitlab(gitlab-ctl stop/restart/start/status)
[root@arslinux-01 ~]# gitlab-ctl start
7、網頁訪問 gitlab,只要輸入 ip 地址即可
如果出現 502 錯誤,那麼請檢查內存是否過小,一般不小於 4G
22.16 使用gitlab
gitlab常用命令:https://www.cnyunwei.cc/archives/1204
進入 gitlab,先創建組,再創建項目
1、創建組:
2、創建項目:
和 github 一樣,需要添加 ssh key,纔可以和 gitlab 通信
3、設置 ssh key
右上角頭像——setting——SSH Keys
4、創建用戶
頂部中間扳手圖標(Admin Area)——New user
5、進入用戶編輯,可以設定用戶密碼
6、退出,用新建的用戶名密碼登錄,首次登錄需要修改密碼,可以設成和原來一樣的密碼,然後就可以創建項目了
22.17 gitlab備份和恢復
gitlab 備份
[root@arslinux-01 ~]# gitlab-rake gitlab:backup:create
1
備份的文件默認會放到 /var/opt/gitlab/backups/ 下
[root@arslinux-01 ~]# ls /var/opt/gitlab/backups/
1564299157_2019_07_28_12.1.1_gitlab_backup.tar
[root@arslinux-01 ~]# du -sh /var/opt/gitlab/backups/1564299157_2019_07_28_12.1.1_gitlab_backup.tar
132K /var/opt/gitlab/backups/1564299157_2019_07_28_12.1.1_gitlab_backup.tar
gitlab 恢復
1)暫停 unicorn、sidekiq 服務
[root@arslinux-01 ~]# gitlab-ctl stop unicorn ; gitlab-ctl stop sidekiq
1
2)恢復 gitlab-rake gitlab:backup:restore BACKUP=xxxxx (這裏是一個編號,即備份文件的前綴)
[root@arslinux-01 ~]# gitlab-rake gitlab:backup:restore BACKUP=1564299157_2019_07_28_12.1.1
1
再啓動服務 gitlab-ctl start
擴展內容:
同學分享的svn文檔 http://note.youdao.com/noteshare?id=1bb87a28a2973ae5722bf765882c2d8f
svn 多倉庫管理 http://elim.iteye.com/blog/1171108
svn+ssh http://www.linuxfly.org/post/450/
svn清除保存的用戶名和密碼 http://holy2010.blog.51cto.com/1086044/645944
svn命令詳解 http://blog.sina.com.cn/s/blog_963453200101eiuq.html
svn的鉤子 http://coolnull.com/1716.html
gitlab修改端口 http://blog.csdn.net/arybd/article/details/54635295
修改主機名 http://www.mamicode.com/info-detail-1316828.html
第三方郵件http://blog.csdn.net/liuruiqun/article/details/50000213
server ssh 端口並不是22 http://www.cnblogs.com/limx/p/5709101.html http://www.linuxidc.com/Linux/2017-02/141043.htm
應該修改 /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
“# If you use non-standard ssh port you need to specify it”
ssh_port: xxxxx
gitlab的鉤子相關配置http://fighter.blog.51cto.com/1318618/1670667