阿里云centOS6.8下安装gitlab CE

来源:互联网 发布:汽车传动比知乎 编辑:程序博客网 时间:2024/06/07 11:15

       刚刚在阿里云上搭建了gitlab,这里和大家分享一下安装过程:

我的实例是centOS6.8,具体如下


系统上之前安装过LAMP环境(即apache、mysql、php,这是为了部署wordpress),还安装了tomcat8,其中apache使用80端口、tomcat使用8080端口。

好,现在开始安装过程:

为方便直接切换到root用户,然后开始安装相关依赖

[root@iZbp14cvwowqu27clxb6pxZ ~]# yum install curl policycoreutils openssh-server openssh-clients

[root@iZbp14cvwowqu27clxb6pxZ ~]# service sshd restart

[root@iZbp14cvwowqu27clxb6pxZ ~]# yum install postfix

[root@iZbp14cvwowqu27clxb6pxZ ~]# service postfix restart

现在开始正式安装gitlab,新建 /etc/yum.repos.d/gitlab-ce.repo,内容为:
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1

上面的操作是使用镜像提高下载安装的速度,继续回到命令行:

[root@iZbp14cvwowqu27clxb6pxZ ~]# yum makecache

[root@iZbp14cvwowqu27clxb6pxZ ~]# yum install gitlab-ce

至此,gitlab 安装完毕!但不要急着去启动,我们现更改一些配置
修改配置文件 /etc/gitlab/gitlab.rb中的下面两项
external_url 'http://你的外网IP:82'80端口已被Apache占用
unicorn['port'] =1986 8080端口已被Tomcat占用

[root@iZbp14cvwowqu27clxb6pxZ ~]# gitlab-ctl reconfigure更改配置文件后,重新加载使改动配置生效,并启动gitlab

检查是否安装成功并且启动正常:


出现上图所示结果就表明服务安装成功了,可以通过浏览器进行访问了,具体不在赘述,网上有很多使用教程。

如果上述安装方法未能成功,可以直接去官网下载rpm安装包,下载地址:点击打开链接

选择一个rpm版本,下载后传到服务器上,然后执行如下命令进行安装

[root@iZbp14cvwowqu27clxb6pxZ home]# rpm -i gitlab-ce-7.10.4-omnibus-1.x86_64.rpm


一些常用命令:

[root@iZbp14cvwowqu27clxb6pxZ ~]# gitlab-ctl status
[root@iZbp14cvwowqu27clxb6pxZ ~]# gitlab-ctl tail --查看所有日志
[root@iZbp14cvwowqu27clxb6pxZ ~]# gitlab-ctl tail nginx/gitlab_access.log--查看nginx访问日志
[root@iZbp14cvwowqu27clxb6pxZ ~]# gitlab-ctl tail unicorn --跟踪unicorn的状态

一些目录结构:

主配置文件:/etc/gitlab/gitlab.rb // 可以自定义一些邮件服务等 
日志地址:/var/log/gitlab/ // 对应各服务的打印日志 
服务地址:/var/opt/gitlab/ // 对应各服务的主目录 
仓库地址:/var/opt/gitlab/git-data // 记录项目仓库等提交信息 
重置配置:gitlab-ctl reconfigure // 不要乱用,会重置为最原始的配置的 
重启服务:gitlab-ctl stop/start/restart/uninstall // 停止、启动、重启、卸载 
默认安装:postgres、nginx、redis、unicorn …… 

原创粉丝点击