版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
一、gitlab安装指南
1、安装依赖库
sudo yum install -y curl policycoreutils-python openssh-server cronie lokkit postfix
sudo lokkit -s http -s ssh
sudo service postfix start
systemctl enable postfix.service
systemctl start postfix.service
2、离线安装gitlab
由于官方提供的连接无法直接进行访问并下载安装包,故采用离线安装方式,先下载,再安装:
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ol/7/gitlab-ce-10.8.7-ce.0.el7.x86_64.rpm/download.rpm
rpm -i gitlab-7.4.3_omnibus.5.1.0.ci-1.el7.x86_64.rpm
3、修改配置文件
vim /etc/gitlab/gitlab.rb
将external_url = ‘localhost’
改为external_url = ‘10.1.53.*’
注意:需要增加“=”,以及增加允许的ip地址规则。
4、启动gitlab服务
gitlab-ctl reconfigure
安装参考资料:
1、官方安装步骤:https://about.gitlab.com/installation/#centos-7
2、gitlab搭建及使用https://blog.csdn.net/yongyu_it/article/details/41545651
3、启动问题fix:https://stackoverflow.com/questions/26660084/external-url-must-include-a-fqdn
4、gitlab安装包下载地址:https://downloads-packages.s3.amazonaws.com/centos-7.0.1406/gitlab-7.5.1_omnibus.5.2.0.ci-1.el7.x86_64.rpm
二、gitlab简单使用指南
1、初次访问
首次输入gitlab服务器的IP即可访问gitlab,初始账户: root 密码: 5iveL!fe
2、设置公钥
在自己服务器中执行cat ~/.ssh/id_rsa.pub,拷贝完整公钥到浏览器中输入公钥处:
ssh-rsa AAAAxxxx
.....省略.....
xxxxxxxxxxm7vY2J2i0C6/BLjIEtecF7ImdahJB8+IRIOsEZxmgh4Zh8xl0GO1rybbVr4W4B2B8P+ctIvy+dBjF [email protected]
3、创建团队及工程
访问gitlab的web服务之后,需要创建group,之后在该group之下创建project,然后拷贝工程链接并执行步骤4push代码到仓库中。
4、推送项目代码到gitlab仓库
git init
git remote add origin [email protected]:grgblockchain/go-ethereum.git
git add .
git commit -m "Initial commit"
git push -u origin master
5、解决gitlab重启后runsv not running的问题
gitlab-ctl reconfigure #重新配置一下
gitlab-ctl restart #重新启动服务