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??梢詤⒖?a >GitLab官方文檔進行配置。