安裝依賴軟件
10.x以後開始依賴policycoreutils-python,我之前在使用9.x時還沒有依賴該項 升級時會提示 rpm -Uvh gitlab-ce-10.1.0-ce.0.el7.x86_64.rpm...
[root@linux-node1 ~]# yum -y install policycoreutils openssh-server openssh-clients postfix policycoreutils-python
設置postfix開機自啓,並啓動,postfix支持gitlab發信功能
[root@linux-node1 ~]# systemctl enable postfix && systemctl start postfix
下載gitlab安裝包,然後安裝
centos 6系統的下載地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6 centos 7系統的下載地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
下載rpm包並安裝:
[root@linux-node1 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm [root@linux-node1 ~]# rpm -ivf gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm
修改gitlab配置文件指定服務器ip和自定義端口
[root@linux-node1 ~]# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.1.80' unicorn['port'] = 8890
重置並啓動GitLab
[root@linux-node1 ~]# gitlab-ctl reconfigure #重新配置
關閉gitlab:
[root@linux-node1 ~]# gitlab-ctl stop
啓動gitlab:
[root@linux-node1 ~]# gitlab-ctl start
重啓gitlab:
[root@linux-node1 ~]# gitlab-ctl restart
訪問 GitLab頁面
獲取/修改超級管理員root的密碼
a、 切換目錄:cd /opt/gitlab/bin
b、執行 :sudo gitlab-rails console production 命令 開始初始化密碼
c、在irb(main):001:0> 後面通過 u=User.where(id:1).first 來查找與切換賬號(User.all 可以查看所有用戶)
d、通過u.password='12345678'設置密碼爲12345678(這裏的密碼看自己喜歡):
e、通過u.password_confirmation='12345678' 再次確認密碼
f、通過 u.save!進行保存(切記切記 後面的 !)
g、如果看到上面截圖中的true ,恭喜你已經成功了,執行 exit 退出當前設置流程即可。
h、回到gitlab ,可以通過 root/12345678 這一超級管理員賬號登錄了
修改GitLab頁面鏈接
vim /var/opt/gitlab/gitlab-rails/etc/gitlab.yml