1 安装依赖
yum -y install policycoreutils openssh-server openssh-clients postfix
2 支持gitlab邮件发送
systemctl enable postfix && systemctl start postfix
3下载安装Gitlab社区版RPM包
rpm -ivh gitlab-ce-10.5.2-ce.0.el7.x86_64.rpm
4 默认安装目录
/opt/gitlab/ ## 主目录
/etc/gitlab/ ## 放置配置文件
/var/opt/gitlab/ ## 各个组件
/var/log/gitlab/ ## 放置日志文件
5 配置Gitlab访问地址
[root@localhost etc]# cd gitlab
[root@localhost gitlab]# ls
gitlab.rb
[root@localhost gitlab]# vi gitlab.rb
修改 external_url (使用域名也可以)
6 重置启动Gitlab
[root@localhost gitlab]# gitlab-ctl reconfigure
我在虚拟机配置的时间比较长,出现下图说明重置启动成功。
7 配置目录权限
[root@localhost gitlab]# chmod -R 755 /var/log/gitlab
8 重新启动gitlab服务
[root@localhost log]# gitlab-ctl restart
启动成功后显示
9 查看状态
[root@localhost ~]# gitlab-ctl status
10 关闭防火墙或者开放端口
# 关闭防火墙
systemctl stop firewalld
# 开放端口
[root@localhost ~]# firewall-cmd --zone=public --add-port=8888/tcp --permanent
success
[root@localhost ~]# firewall-cmd --reload
success
11 浏览器访问gitlab
结果502,原来gitlab要用到8080端口,自己服务上有tomcat已经占用8080
修改 unicorn[‘port’] = 其他端口 或者 停止tomcat服务,我把tomcat服务停止,重新访问成功
12 修改管理员密码
13 登录
默认用户名:root 密码:上面修改的密码
14 配置开放电脑key
确保开发电脑安装git环境,然后打开Git GUI--->help--->show ssh key 拷贝
16 创建gitlab工程
git地址:git@10.1.100.140:chy2z/firstProject.git
17 克隆仓库
使用 Git Bash
admin@admin-PC MINGW32 /e
$ git clone git@10.1.100.140:chy2z/firstProject.git
Cloning into 'firstProject'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
Checking connectivity... done.
admin@admin-PC MINGW32 /e
$ cd firstProject
admin@admin-PC MINGW32 /e/firstProject (master)
$ git add .
admin@admin-PC MINGW32 /e/firstProject (master)
$ git commit -m 提交
[master 7315b16] 提交
1 file changed, 2 insertions(+), 1 deletion(-)
admin@admin-PC MINGW32 /e/firstProject (master)
$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 255 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@10.1.100.140:chy2z/firstProject.git
76f0a04..7315b16 master -> master