下面给你一份**在 CentOS 上部署 GitLab(社区版 CE)**的常用、稳妥方案,适合大多数内网/公司环境。
systemctl stop firewalld
systemctl disable firewalld
或放行 80 / 443 / 22:
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
yum install -y curl policycoreutils openssh-server openssh-clients
systemctl enable sshd
systemctl start sshd
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
yum install -y gitlab-ce
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-16.0.0-ce.0.el7.x86_64.rpm
rpm -ivh gitlab-ce-*.rpm
vi /etc/gitlab/gitlab.rb
常见配置:
external_url 'http://gitlab.example.com'
# 或
external_url 'http://192.168.1.100'
如需改端口:
external_url 'http://192.168.1.100:8080'
gitlab-ctl reconfigure
gitlab-ctl start
查看状态:
gitlab-ctl status
浏览器访问:
http://服务器IP
第一次登录:
rootcat /etc/gitlab/initial_root_password
gitlab-ctl restart
gitlab-ctl stop
gitlab-ctl tail
日志查看:
gitlab-ctl tail nginx
修改:
unicorn['worker_processes'] = 2
postgresql['shared_buffers'] = "256MB"
然后:
gitlab-ctl reconfigure
改 external_url 端口即可。
gitlab-rails console
user = User.where(id:1).first
user.password = '新密码'
user.save!
gitlab-rake gitlab:backup:create
如果你愿意,可以告诉我:
我可以给你定制版部署方案。