centos安装gitlab-ce

1、gitlab是什么
gitlab是git仓库的管理工具,提供web页面方便用户使用。
gitlab-ce和gitlab-ee,ce是社区版,ee是企业版,企业版有些功能需要付费使用。

2、从官方仓库上安装gitlab
添加官方仓库:
curl -L https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

3、安装postfix
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

4、安装gitlab
yum install gitlab-ce

5、安装完成后会有提示信息
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

GitLab now ships with a newer version of PostgreSQL (11.7), but it is not yet
enabled by default. To upgrade, please see:
https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server

6、编辑/etc/gitlab/gitlab.rb
将:
# nginx['listen_port'] = nil
修改为:
nginx['listen_port'] = 8888
将:
external_url 'http://gitlab.example.com'
修改为:
external_url 'http://你的IP地址:8888'
注:这里external_url需要加上端口,否则使用http克隆和查看文件,链接里会没有端口

7、保存配置
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo gitlab-ctl status

从显示信息可以看到,运行了许多程序
ok: run: alertmanager: (pid 8410) 0s
ok: run: gitaly: (pid 8429) 1s
ok: run: gitlab-exporter: (pid 8438) 0s
ok: run: gitlab-workhorse: (pid 8447) 0s
ok: run: grafana: (pid 8459) 0s
ok: run: logrotate: (pid 8476) 0s
ok: run: nginx: (pid 8487) 1s
ok: run: node-exporter: (pid 8506) 0s
ok: run: postgres-exporter: (pid 8513) 1s
ok: run: postgresql: (pid 8523) 0s
ok: run: prometheus: (pid 8525) 0s
ok: run: redis: (pid 8546) 0s
ok: run: redis-exporter: (pid 8553) 0s
ok: run: sidekiq: (pid 8562) 0s
ok: run: unicorn: (pid 8612) 0s

8、修改管理员root密码
官方文档:https://docs.gitlab.com/ce/security/reset_root_password.html
gitlab-rails console -e production
------------------------------------------
GitLab: 12.8.6 (5fc76a64537) FOSS
GitLab Shell: 11.0.0
PostgreSQL: 10.12
------------------------------------------
Loading production environment (Rails 6.0.2)
irb(main):001:0> user = User.where(id: 1).first
=> # <User id:1 @root=>
irb(main):002:0> user.password = '12345678'
=> "12345678"
irb(main):003:0> user.password_confirmation = '12345678'
=> "12345678"
irb(main):004:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: f1b67889-3321-464f-9c52-35e5dfdfe3ab) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #> <URI::GID gid://gitlab/User/1>>
=> true
irb(main):005:0> exit

9、访问http://IP:8888或http://IP:8888/users/sign_in
使用root / 12345678 登录

10、设置语言
选择Preferences -> Language选择简体中文

参考资料:
https://docs.gitlab.com/ce/install/README.html
https://about.gitlab.com/install/#centos-7
https://blog.csdn.net/weixin_43767602/article/details/84568858