安装环境
ubantu16.04 1核2G 阿里云
gitlab 安装
# 官方安装参考 https://about.gitlab.com/install/#ubuntu
sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates
sudo apt-get install -y postfix
# 官方默认连接是gitlab-ee的,这里改成gitlab-ce
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
# 域名我改成了自己的ip
sudo EXTERNAL_URL="http://47.97.0.0" apt-get install gitlab-ce
默认是80端口,配置成自己想要的端口(不想改可以跳过)
# 配置文件在 /opt/gitlab/etc/gitlab.rb
unicorn端口配置
unicorn['port'] = 8082
nginx端口配置
nginx['listen_port'] = 8000
# 若重启gitlab端口没有生效的话,注意查看下/var/opt/gitlab/nginx/conf/gitlab-http.conf 中nginx的配置
# gitlab中的nginx配置 /var/opt/gitlab/nginx/conf/gitlab-http.conf
listen *:80 # 这是默认端口,自行修改
内存配置
由于2G内存,喂不饱gitlab,直接运行卡的不行,这里可以通过添加虚拟内存来抢救一下
#####################################################
## 参考这篇文章(非常感谢两位作者)
## https://blog.csdn.net/qq_30745307/article/details/82829064
## https://yq.aliyun.com/articles/52098
#####################################################
# 查看swap分区
cat /proc/swaps
# 创建 swap 分区,会卡一会儿
dd if=/dev/zero of=/mnt/swap bs=512 count=8388616
# /mnt/swap目录若无则找 /data/swap
mkswap /data/swap
cat /proc/sys/vm/swappiness
# 看下结果,调整为60
sysctl -w vm.swappiness=60
# 启用swap
swapon /data/swap
echo “/data/swap swap swap defaults 0 0” >> /etc/fstab
# 再次使用cat /proc/swaps 查看swap分区是否启动










网友评论