1. 添加apt源
bash
curl https://packages.gitlab.com/gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ $(lsb_release -cs) main"
2. 安装
bash
sudo apt-get update
sudo apt-get install gitlab-ce
3. 修改配置
编辑/etc/gitlab/gitlab.rb文件
- 修改访问路径。
修改external_url为http://<ip>:<port>ip为当前服务器得ip,port任选一个空闲端口 - 修改时区
gitlab_rails'time_zone' = 'Asia/Shanghai' - 为了节约资源,可以做如下修改
puma'worker_processes' = 2
sidekiq'concurrency' = 8
postgresql'shared_buffers' = "128MB"
postgresql'max_worker_processes' = 4
prometheus_monitoring'enable' = false
4. 更新配置并重启
bash
gitlab-ctl reconfigure
gitlab-ctl restart
5. 查看默认密码
bash
cat /etc/gitlab/initial_root_password
6. 登录
访问路径为上次配置的external_url http://<ip>:<port>
默认用户名为 root
密码为 /etc/gitlab/initial_root_password 保存的值
7. 修改系统配置
- 登录后修改默认密码 > 右上角头像 > Perferences > Password
- 关闭头像服务:点击> Admin
Settings > General > Account and limit > 取消 Gravatar enabled > Save changes - 关闭用户注册功能 Admin->Settings > General > New user account restrictions > 取消 Allow new user accounts > Save changes
- 开启 webhook 外部访问 Admin->Settings > Network > Outbound requests > Allow requests to the local network from web hooks and services 勾选 > Save changes
- 设置当前用户语言为中文 右上角用户头像 > Preferences > Localization > Language > 选择简体中文 > Save changes