搭建Gitlab环境

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

http://10.1.100.140:8888/

结果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

 

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值