gitlab 在服务器上的搭建
1、首先安装一些相关的依赖
yum -y install policycoreutils openssh-server openssh-clients postfix
policycoreutils : 不知道干嘛用的
openssh-server openssh-clients: 允许远程连接工具来连接服务器的东西
postfix: 发送邮件的东西,需要开启,gitlab才能发送邮件,开启的时候可能会报错
- Job for postfix.service failed because the control process exited with error code. See “systemctl status postfix.service” and “journalctl -xe” for details.
解决:
- vim /etc/hosts //注释掉下面一行
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
启用postfix
systemctl enable postfix && sudo systemctl start postfix
2、安装
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum install -y gitlab-ce
gitlab-ctl reconfigure
gitlab-ctl restart
3、修改端口
vi /etc/gitlab/gitlab.rb
* 修改 nginx['listen_port'] = 8081
gitlab-ctl reconfigure
gitlab-ctl restart
4、搭建nginx服务器
https://blog.csdn.net/u010398650/article/details/79532970
5、nginx代理
upstream git {
server localhost:8099;
}
server{
server_name gitlab.yuanjy.com;
listen 80;
location / {
client_max_body_size 50m;
proxy_redirect off;
#以下确保 gitlab中项目的 url 是域名而不是 http://git,不可缺少
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://git;
}
}