标签:proxy count git rect .sh span emc 设置 tom
1. 安装并配置依赖,打开防火墙HTTP,SSH链接
yum install -y curl policycoreutils-python openssh-server systemctl enable sshd systemctl start sshd firewall-cmd --permanent --add-service=http systemctl reload firewalld 注:对于防火墙直接关闭内网防火墙即可,服务器内存至少4G
2. 安装Postfix发信服务器
yum install postfix systemctl enable postfix systemctl start postfix
错误: Job for postfix.service failed because the control process exited with error code. See "systemctl st 解决:修改 /etc/postfix/main.cf的设置 inet_protocols = ipv4 inet_interfaces = all
3. 安装gitLab
下载最新rpm安装:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7 rpm -i gitlab-ce-10.6.4-ce.0.el7.x86_64.rpm #安装
或镜像安装: curl -sS http://packages.gitlab.com.cn/install/gitlab-ce/script.rpm.sh | sudo bash yum install gitlab-ce
4. 修改域名:/etc/gitlab/gitlab.rb文件
external_url ‘http://gitlab.mag998.com/‘ #需添加域名解析
5. 启动gitLab
gitlab-ctl reconfigure #重置初始化 gitlab-ctl restart #启动
报错ENOMEM:内存至少4G,500等错误,增加内存
free -m #查看swap分区大小
mkdir /swapfile
cd /swapfile
sudo dd if=/dev/zero of=swap bs=1024 count=5000000 #修改count,5G的大小
mkswap -f swap #转化为swap文件
swapon swap #激活swap文件
free -m #查看大小
swapoff swap #卸载swap分区
/swapfile/swapfile none swap defaults 0 0 #写入/etc/fstab文件
访问报错502:chmod -R 755 /var/log/gitlab
注:关闭原有nginx和tomcat,因为他们会占用80,8080端口,加swap分区后最好重启服务器
6. 正常访问后,修改nginx等的端口配置
1. /etc/gitlab/gitlab.rb文件 unicorn[‘port‘] = 8081 nginx[‘listen_port‘] = 82
gitlab_rails[‘smtp_enable‘] = false #postfix和smtp只能用一个
2. /var/opt/gitlab/gitlab-rails/etc/unicorn.rb文件 listen "127.0.0.1:8081", :tcp_nopush => true 3. /var/opt/gitlab/nginx/conf/gitlab-http.conf文件 listen *:82; 4. /var/opt/gitlab/gitlab-shell/config.yml文件 gitlab_url: "http://127.0.0.1:8081" 5. 重置/重启 gitlab-ctl reconfigure gitlab-ctl restart
7. 原来的nginx配置均衡代理:
#gitlab server=======start upstream gitlab { server 127.0.0.1:8081; } server { listen 80; server_name gitlab.mag998.com; location /{ client_max_body_size 50m; proxy_redirect off; 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://gitlab; index index.html index.htm; } } #gitlab end============
8. 常用命令
gitlab-ctl start|stop|status|restart
标签:proxy count git rect .sh span emc 设置 tom
原文地址:https://www.cnblogs.com/maoriaty/p/8920345.html