CentOS7上安装配置GitLab(一)

    虽然GitHub已经很好了,可是咱们必须联上公网才可使用而且若是不付费的话,你的代码在网上就是公开的!可是在企业环境中,咱们公司的代码不但愿被公开而且也不想付费给GitHub,这时怎么办呢?咱们能够用GitLab搭建企业本身的Git服务器,并且因为是在局域网内传输速度也是能够保证的,让咱们开始吧!
node

1、安装依赖包python

虚拟机配置:2vCPU+2Gb(MEM)+2Gb(SWAP)nginx

操做系统版本:CentOS7.2git

# 安装依赖
yum install curl policycoreutils openssh-server openssh-clients policycoreutils-python
systemctl enable sshd 
systemctl start sshd
# 使用postfix发送邮件通知
yum install postfix 
systemctl enable postfix 
systemctl start postfix 
# 打开防火墙端口,若是须要
firewall-cmd --permanent --add-service=http 
systemctl reload firewalld


2、下载GitLab包vim

centos 6系统的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6centos

centos 7系统的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7浏览器

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.8.1-ce.0.el7.x86_64.rpm
rpm -ivh gitlab-ce-10.8.1-ce.0.el7.x86_64.rpm

Note:你也能够将上面URL配置成yum repo,直接经过yum安装更新GitLab服务器


3、配置GitLabssh

GitLab的相关参数配置都存在/etc/gitlab/gitlab.rb文件中,每次配置完成以后须要执行“gitlab-ctl reconfigure”,进行从新配置才能生效。curl

# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.88.128' 

# gitlab-ctl reconfigure


4、经过HTTP访问GitLab


浏览器中打开URL: http://192.168.88.128第一次登录会跳转到修改root用户密码页面,打开WEB页面以后的操做就跟GitHub没有什么区别了!


5、禁止GitLab服务开机自启动

[root@node1 root]# systemctl list-unit-files|grep -i gitlab
gitlab-runsvdir.service                       enabled
[root@node1 root]# systemctl disable gitlab-runsvdir
Removed symlink /etc/systemd/system/basic.target.wants/gitlab-runsvdir.service.
[root@node1 root]# systemctl list-unit-files|grep -i gitlab
gitlab-runsvdir.service                       disabled


6、GitLab的经常使用命令

语法:

gitlab-ctl command (subcommand)

start	启动全部服务

stop	关闭全部服务

restart	重启全部服务

status	查看全部服务状态

tail	查看日志信息

service-list	列举全部启动服务

graceful-kill	平稳中止一个服务

help	    帮助

reconfigure	修改配置文件以后,须要从新加载下

show-config	查看全部服务配置文件信息

uninstall	卸载这个软件

cleanse	    删除gitlab数据

示例:

gitlab-ctl start	    #启动全部服务

gitlab-ctl start nginx    #启动单独一个服务

gitlab-ctl tail	  #查看日志,相似tail -f

gitlab-ctl tail nginx	    #查看一个应用的日志

gitlab-ctl show-config	    #显示全部服务配置文件

gitlab-ctl uninstall	    #卸载gitlab
相关文章
相关标签/搜索