在CentOS系统上配置GitLab涉及多个步骤,包括安装必要的依赖项、配置网络设置、设置防火墙等。以下是一个详细的网络配置指南:
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
sudo systemctl enable postfix
sudo systemctl start postfix
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
EXTERNAL_URL="https://gitlab.example.com"
sudo yum install -y gitlab-ee
修改网卡配置文件,例如 /etc/sysconfig/network-scripts/ifcfg-ens33
:
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=f5e37a10-3da9-47af-ddb7-370b7bf24509
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.0.100
GATEWAY=192.168.0.1
NETMASK=255.255.255.0
DNS1=8.8.8.8
DNS2=8.8.4.4
重启网络服务:
sudo systemctl restart network
验证配置:
ip addr show ens33
ping www.baidu.com
gitlab-ctl reconfigure
gitlab-ctl start
gitlab-ctl stop
gitlab-ctl restart
为了确保代码传输的安全性,需要添加SSL Key:
ssh-keygen -t rsa -C "your_email@example.com"
cat ~/.ssh/id_rsa.pub
将生成的公钥内容添加到GitLab的SSH Keys设置中。
在浏览器中访问服务器的IP地址,例如 http://192.168.0.100
,设置密码后即可登录GitLab。
以上步骤涵盖了在CentOS系统上配置GitLab所需的基本网络配置。根据具体需求,可能还需要进行进一步的调整和优化。