更多了解查看公众号原文:https://mp.weixin.qq.com/s/TiAxfC9EM3WNVXa6Mhwkjw
Git, Gitlab,Jenkins我没有用docker的方式安装。
1. Git安装
apt install git
2. GitLab安装
2.1 先决安装
sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates
sudo apt-get install -y postfix //邮件服务,安装的时候先选择不需要配置,此步可以先跳过
2.2 信任GitLab的GPS公钥
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
2.3 配置国内镜像
vim /etc/apt/sources.list.d/gitlab-ce.list输入以下内容:
deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu bionic main
(对于的内容写入参考https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/)
2.4 安装gitlab-ce
sudo apt-get update
sudo apt-get install gitlab-ce
2.5 配置与启动
vi /etc/gitlab/gitlab.rb -->
grafana[‘enable‘] = false --禁用grafana,解决启动报错
unicorn[‘worker_processes‘] = 2 --放开(至少为2),节省内存
postgresql[‘shared_buffers‘] = "128MB" --放开并修改,节省内存
postgresql[‘max_worker_processes‘] = 2 --放开并修改,节省内存
sidekiq[‘max_concurrency‘] = 10 --放开并修改,节省内存
sudo gitlab-ctl reconfigure -修改了配置需要使配置生效
sudo gitlab-ctl start -启动 or 重启restart
首次登陆修改密码,我的修改为rootroot,用户名是root
虚拟机的内存最好设置为4G~~~出现502可能启动比较慢或者内存不足导致。我用的电脑配置有点低,设置为3G勉强可以跑,哈哈~~
3. gitlab配置
3.1 配置SSH
ssh-keygen -t rsa -b 2048 -C "email@example.com" 然后一路回车(-C 参数是你的邮箱地址)
cat出来的内容就是key.
3.2 IP配置
vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml:
vim /etc/gitlab/gitlab.rb:
3.3 HTTP配置
vim /etc/gitlab/gitlab.rb:
vim /var/opt/gitlab/nginx/conf/gitlab-http.conf:
3.4 SSH端口配置(因为没有影响到我的SSH远程登录,暂时忽略)
重新配置后重启服务:
gitlab-ctl reconfigure
gitlab-ctl restart
重启后端口需要改成6109:
原文:https://www.cnblogs.com/jovic/p/13649597.html