五分鍾學會centos配置gitlab


下載gitlab

親測: centos6.5   

安裝依賴包:

1:  yum install curl policycoreutils policycoreutils-python openssh-server openssh-clients

依賴包安裝完成之后:

1: systemctl enable sshd
2: systemctl start sshd
3: yum install postfix
4: systemctl enable postfix
5: systemctl start postfix
6: firewall-cmd --permanent --add-service=http
7: systemctl reload firewalld

以上依賴安裝完之后,下載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包

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-8.0.0-ce.0.el6.x86_64.rpm

安裝rpm包

rpm -i gitlab-ce-8.0.0-ce.0.el6.x86_64.rpm

安裝完成之后

vim /etc/gitlab/gitlab.rb

修改gitlab配置文件,訪問IP:端口,   如果不修改默認80端口,進入文件之后,找到

external_url       #  這個變量

修改external_url變量

external_url 'http://ip:端口'

修改完成之后退出並且保存

esc     +   wq

保存之后需要更新一下修改

gitlab-ctl reconfigure

重啟gitlab

gitlab-ctl restart      # 重啟

gitlab-ctl stop         #  停止

gitlab-ctl start         # 啟動

gitlab-ctl status       # 查看狀態

訪問gitlab

輸入你在   /etc/gitlab/gitlab.rb文件里定義的

external_url后邊跟的ip就可以訪問


配置成功之后就會出現這個頁面, 默認賬號:root, 密碼;password, 如果不對的話,請自行修改。

修改gitlab管理員賬號密碼

gitlab-rails console production

# 按下回車之后會出現
Loading production environment (Rails 4.1.1)

# 依次輸入
irb(main):001:0> user = User.where(id:1).first
irb(main):002:0> user.password='66668888'       # root密碼
irb(main):003:0> user.save!

# 返回
true         # 表示修改成功

Ctrl+C 可以退出了

到了這里之后,gitlab就配置完成了,接下來就可以使用了。以上所有方法,親測,全部有效。

 

 

# 修改gitlab   IP地址

vim /etc/gitlab/gitlab.rb


external_url 'ip地址'


配置完成 
重置命令:     gitlab-ctl reconfigure

重啟命令:     gitlab-ctl restart

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM