GitLab与CentOS的集成可以通过多种方式实现,以下是详细的步骤:
更新系统:
sudo yum update -y
安装必要的依赖包:
sudo yum install -y curl policycoreutils openssh-server openssh-client postfix
设置SSH服务:
sudo systemctl enable sshd
sudo systemctl start sshd
设置Postfix服务(如果需要邮件服务):
sudo systemctl enable postfix
sudo systemctl start postfix
开放必要的端口:
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
下载GitLab安装包:
可以从GitLab官网下载适合CentOS 7的GitLab CE版本。
安装GitLab:
sudo yum install -y gitlab-ce-16.0.5-ce.0.el7.x86_64.rpm
修改配置文件:
使用以下命令打开配置文件:
sudo vi /etc/gitlab/gitlab.rb
设置外部URL:
找到并修改external_url
配置项,设置为你的服务器IP地址或域名:
external_url 'http://192.168.1.55:80'
重新配置并启动GitLab:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
登录GitLab:
在浏览器中输入http://192.168.1.55
,使用默认的root用户名和密码(通常在/etc/gitlab/initial_root_password
文件中)登录。
修改默认用户密码:
登录后,进入用户设置修改密码。
设置中文界面:
在GitLab管理后台的Admin Area
-> Settings
-> Preferences
-> Localization
中设置语言为中文。
配置HTTPS:
为了安全起见,建议配置HTTPS。可以参考GitLab官方文档进行配置。