使用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内置的nginx服务器配置文件路径
[root@localhost yum.repos.d]# ls /var/opt/gitlab/nginx/conf/
gitlab-http.conf nginx.conf nginx-status.conf
创建组apenglinux
在apenglinux组中新建项目
设置SSH Keys
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