使用gitlab

使用gitlab

gitlab 官网 https://about.gitlab.com/gitlab-com

官方安装文档 https://about.gitlab.com/installation/?version=ce#centos-7

vim /etc/yum.repos.d/gitlab.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1

安装 gitlab

yum install gitlab-ce.x86_64 -y

配置

[root@localhost yum.repos.d]# gitlab-ctl reconfigure

检查端口

[root@localhost yum.repos.d]# netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:9100          0.0.0.0:*               LISTEN      6030/node_exporter  
tcp        0      0 127.0.0.1:9229          0.0.0.0:*               LISTEN      6632/gitlab-workhor 
tcp        0      0 127.0.0.1:9168          0.0.0.0:*               LISTEN      6663/ruby           
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      5548/unicorn master 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      5711/nginx: master  
tcp        0      0 127.0.0.1:8082          0.0.0.0:*               LISTEN      5586/sidekiq 5.0.5  
tcp        0      0 127.0.0.1:9236          0.0.0.0:*               LISTEN      6646/gitaly         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      931/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1146/master         
tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      5711/nginx: master  
tcp        0      0 127.0.0.1:9121          0.0.0.0:*               LISTEN      6141/redis_exporter 
tcp        0      0 127.0.0.1:9090          0.0.0.0:*               LISTEN      6673/prometheus     
tcp        0      0 127.0.0.1:9187          0.0.0.0:*               LISTEN      6689/postgres_expor 
tcp6       0      0 ::1:9168                :::*                    LISTEN      6663/ruby           
tcp6       0      0 :::22                   :::*                    LISTEN      931/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1146/master

gitlab-ctl命令

gitlab-ctl stop|start|status|restart

浏览器访问 ip,修改root的密码
使用gitlab

查看gitlab内置的nginx服务器配置文件路径

[root@localhost yum.repos.d]# ls /var/opt/gitlab/nginx/conf/
gitlab-http.conf  nginx.conf  nginx-status.conf

创建组apenglinux

使用gitlab

在apenglinux组中新建项目

使用gitlab

设置SSH Keys
使用gitlab

root用户可以创建普通用户,为用户设置密码。
普通用户第一次登陆后,要修改密码
普通用户也可以创建项目

gitlab备份与恢复

gitlab备份

[root@localhost ~]# gitlab-rake gitlab:backup:create
Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
 * newgroup/test ... [SKIPPED]
 * newgroup/test.wiki ...  [SKIPPED]
 * zhangsan/zsproject ... [SKIPPED]
 * zhangsan/zsproject.wiki ...  [SKIPPED]
done
Dumping uploads ... 
done
Dumping builds ... 
done
Dumping artifacts ... 
done
Dumping pages ... 
done
Dumping lfs objects ... 
done
Dumping container registry images ... 
[DISABLED]
Creating backup archive: 1521890768_2018_03_24_10.6.0_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
done
done
done
done
done
done
Deleting old backups ... skipping

备份文件所在目录

[root@localhost ~]# ls /var/opt/gitlab/backups
1521890768_2018_03_24_10.6.0_gitlab_backup.tar

gitlab 恢复

需要停掉以下2个服务(停止数据的变更)

[root@localhost ~]# gitlab-ctl stop unicorn
ok: down: unicorn: 0s, normally up
[root@localhost ~]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 0s, normally up
[root@localhost ~]# gitlab-rake backup:restore BACKUP=1521890768_2018_03_24_10.6.0
rake aborted!
Don't know how to build task 'backup:restore' (see --tasks)
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)

启动服务

[root@localhost ~]# gitlab-ctl start

转载于:https://blog.51cto.com/13480443/2090673

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值