开启配置
- 在CentOS系统上,打开系统防火墙HTTP和SSH的访问
[root@code ~]# yum install -y curl policycoreutils-python openssh-server
[root@code ~]# systemctl enable sshd
[root@code ~]# systemctl start sshd
[root@code ~]# firewall-cmd --permanent --add-service=http
[root@code ~]# systemctl reload firewalld
- 安装Postfix,用来发送邮件,在安装Postfix的过程中选择’Internet Site’
[root@code ~]# yum install postfix
[root@code ~]# systemctl enable postfix
[root@code ~]# systemctl start postfix
添加GitLab镜像仓库并安装
- 使用官方镜像安装
$ curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
$ EXTERNAL_URL="http://code.local.com" yum install -y gitlab-ce
账号初始化
- 初始化管理员账号(root)
[root@web1 ~]# gitlab-rails console -e production
-------------------------------------------------------------------------------------
Gitlab: 13.0.5 (2268d0cdfcds) FOSS
Gitlab Shell: 13.2.0
postgresql: 11.7
-------------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3)
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):002:0> user.password="admin12345678"
=> "admin12345678"
irb(main):003:0> user.password_confirmation=“admin12345678"
=> "admin12345678"
irb(main):004:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 3ef37c47-4b3f-49e5-aa53-904e725bd1a8) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):005:0> quit
注:
gitlab-rails console -e production // 进入postgresql命令行
user = User.where(id: 1).first // 查找第一个默认管理员root
user.password="admin12345678" // 设置密码为admin12345678
user.password="admin12345678" // 设置确认密码为admin12345678
- 登陆