阿里云centOS6.8下安装gitlab CE
刚刚在阿里云上搭建了gitlab,这里和大家分享一下安装过程:
我的实例是centOS6.8,具体如下
系统上之前安装过LAMP环境(即apache、mysql、php,这是为了部署wordpress),还安装了tomcat8,其中apache使用80端口、tomcat使用8080端口。
好,现在开始安装过程:
为方便直接切换到root用户,然后开始安装相关依赖
[[email protected] ~]# yum install curl policycoreutils openssh-server openssh-clients
[[email protected] ~]# service sshd restart
[[email protected] ~]# yum install postfix
[[email protected] ~]# 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
上面的操作是使用镜像提高下载安装的速度,继续回到命令行:
[[email protected] ~]# yum makecache
[[email protected] ~]# yum install gitlab-ce
至此,gitlab 安装完毕!但不要急着去启动,我们现更改一些配置
修改配置文件 /etc/gitlab/gitlab.rb
中的下面两项
external_url 'http://你的外网IP:82'
80端口已被Apache占用
unicorn['port'] =
1986 8080端口已被Tomcat占用
[[email protected] ~]# gitlab-ctl reconfigure
更改配置文件后,重新加载使改动配置生效,并启动gitlab
检查是否安装成功并且启动正常:
出现上图所示结果就表明服务安装成功了,可以通过浏览器进行访问了,具体不在赘述,网上有很多使用教程。
如果上述安装方法未能成功,可以直接去官网下载rpm安装包,下载地址:点击打开链接
选择一个rpm版本,下载后传到服务器上,然后执行如下命令进行安装
[[email protected] home]# rpm -i gitlab-ce-7.10.4-omnibus-1.x86_64.rpm
一些常用命令:
[[email protected] ~]# gitlab-ctl status
[[email protected] ~]# gitlab-ctl tail
--查看所有日志
[[email protected] ~]# gitlab-ctl tail nginx/gitlab_access.log
--查看nginx访问日志
[[email protected] ~]# 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 ……