環境:
系統 | centos7 |
內核 | 3.10.0-693.el7.x86_64 |
配置 | 4G/8G |
軟件包
https://packages.gitlab.com/gitlab/gitlab-ce
選擇自己需要的包
下載安裝
1、rpm安裝
[root@localhost ~]# wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-10.2.3-ce.0.el7.x86_64.rpm [root@localhost ~]# rpm -ivh gitlab-ce-10.2.3-ce.0.el7.x86_64.rpm
2、yum安裝
配置yum環境
[root@localhost ~]# cat /etc/yum.repos.d/gitlab.repo
[gitlab-ce] name=gitlab-ce baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7 repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey= [root@localhost ~]# yum clean all [root@localhost ~]# yum -y install gitlab-ce
3、自動安裝
[root@localhost ~]# curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
依賴關係安裝
安裝curl、policycoreutils、openssh-server、openssh-clients,安裝postfix以便發送郵件
[root@localhost ~]# yum install curl policycoreutils openssh-server openssh-clients postfix -y
關閉防火牆firewalld
修改gitlab配置文件
[root@localhost ~]# egrep -v "^$|^#" /etc/gitlab/gitlab.rb external_url 'http://192.168.192.148'
重新配置應用程序,每次修改配置文件都要執行此命令,重新加載配置文件
[root@localhost ~]# gitlab-ctl reconfigure
gitlab管理
啓動
[root@localhost ~]# gitlab-ctl start
關閉
[root@localhost ~]# gitlab-ctl stop
狀態
[root@localhost ~]# gitlab-ctl status
重啓
[root@localhost ~]# gitlab-ctl restart
列出所有服務
[root@localhost ~]# gitlab-ctl service-list
顯示配置
[root@localhost ~]# gitlab-ctl show-config
默認配置文件位置說明
主配置文件:/etc/gitlab/gitlab.rb
日誌地址:/var/log/gitlab
服務地址:/var/opt/gitlab
倉庫地址:/var/opt/gitlab/git-data
gitlab頁面操作
訪問
192.168.192.48默認端口80,首次登陸需要爲root用戶創建一個不少於8位的密碼
關閉註冊,避免一些不必要的麻煩
項目和羣組有一定的關聯性,一般以羣組區分不同的項目
創建羣組
羣組創建名稱最好是一個可識別的名稱,根據重要等級不同,可以選擇不同的可見性
創建項目
選擇關聯的組,後邊指定項目名稱,可見等級根據不同的項目可以做調整
創建用戶
郵箱中會收到一個郵件,用戶通過此郵件進行密碼設置
關聯用戶、組,給與用戶不同的權限
添加測試文件
在下方寫入相關代碼
下載代碼
安裝git
[root@localhost ~]# yum -y install git
可以git表示部署成功