【Git&GitHub GitLab的使用 04】

一、建议安装GitLab时,在centos7以上版本安装

二、安装

1、下载gitlab的 rpm安装包

https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-10.8.2-ce.0.el7.x86_64.rpm

2、下载好以后,上传gitlab-ce-10.8.2-ce.0.el7.x86_64.rpm文件到/opt路径下

3、在opt下新建一个install.sh文件,文件内写入如下内容

sudo rpm -ivh /opt/gitlab-ce-10.8.2-ce.0.el7.x86_64.rpm
sudo yum install -y curl policycoreutils-python openssh-server cronie
sudo lokkit -s http -s ssh
sudo yum install postfix
sudo service postfix start
sudo chkconfig postfix on
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash sudo EXTERNAL_URL="http://gitlab.example.com" yum -y install gitlab-ce

注意:gitlab的rpm安装包路径如果不是上传到/opt上,需要修改成实际的路径

4、执行install文件,进行安装(注意:执行之前,虚拟机最好先保存一个快照,以防安装失败时,可以回退到快照之前的版本

5、安装完成后,重复服务器

三、gitlab服务操作

1、重启以后,初始化配置gitlab

gitlab-ctl reconfigure

2、启动gitlab服务

gitlab-ctl start

 其实gitlab会安装很多东西,比如:nginx,redis等等

 3、关闭gitlab服务

gitlab-ctl stop

四、浏览器访问

访问linux服务器IP地址即可,如果想访问EXTERNAL_URL指定的域名还需要配置域名服务器或本地hosts文件

如果访问是无法打开页面,有可能是服务器没有关闭防火墙

[root@localhost gitLab]# service firewalld stop
Redirecting to /bin/systemctl stop firewalld.service

注意:centos7以上关闭防火墙是firewalld

继续访问,成功后的页面:

初始登录时需要为gitlab的root用户设置密码

登录后,后续的操作基本和 github差不多

原文地址:https://www.cnblogs.com/frankruby/p/14688891.html