安装GitLab
-
下载GitLab的rpm文件
版本信息:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
#下载对应的rpm文件 wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.2-ce.0.el7.x86_64.rpm
-
rpm方式安装
#rpm方式安装gitlab rpm -hvi gitlab-ce-9.5.2-ce.0.el7.x86_64.rpm
-
修改GitLab端口,配置文件在/etc/gitlab/目录下的gitlab.rb文件
#修改配置文件,将external_url 'http://iZm5ef38095rhuzz3nhcfnZ',改成本机的ip和访问gitlab的端口 #时区改成中国 gitlab_rails['time_zone'] = 'Asia/Shanghai' vi /etc/gitlab/gitlab.rb
-
生成配置
#加载配置文件,时间有点久需要等一会,如果一直卡住不动退出Ctrl+C,先执行:systemctl restart gitlab-runsvdir gitlab-ctl reconfigure
-
重启GitLab,确保配置的端口已开放
#重启 gitlab-ctl restart
-
访问配置的端口,默认用户root,第一次强制设置密码
GitLab命令
-
查看服务状态
gitlab-ctl status
-
启动GitLab
gitlab-ctl start
-
停止
gitlab-ctl stop
-
重启
gitlab-ctl restart
-
生成配置并启动服务
gitlab-ctl reconfigure
-
查看版本
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
-
实时查看日志
gitlab-ctl tail
卸载GitLab
-
停止GitLab
#停止GitLab gitlab stop
-
卸载GitLab
#卸载GitLab rpm -e gitlab-ce
-
查看GitLab相关进程
[root@iZm5ef38095rhuzz3nhcfnZ ~]# ps -ef|grep gitlab root 16681 1 0 3月29 ? 00:00:00 runsvdir -P /opt/gitlab/service log: ........................................................................................................................................................................................................................................................................................................................................................................................................... root 16683 16682 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/redis root 17613 17612 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/postgresql root 18528 18527 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/unicorn root 18667 18664 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/sidekiq root 18776 18775 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/gitaly root 18884 16681 0 3月29 ? 00:00:00 runsv gitlab-workhorse root 18885 18884 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/gitlab-workhorse root 19027 19026 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/nginx root 19138 19137 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/logrotate root 19255 19254 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/node-exporter root 19379 16681 0 3月29 ? 00:00:00 runsv gitlab-monitor root 19380 19379 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/gitlab-monitor root 19480 19479 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/redis-exporter root 19594 19590 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/prometheus root 19767 19766 0 3月29 ? 00:00:00 svlogd -tt /var/log/gitlab/postgres-exporter root 31698 12459 0 10:59 pts/0 00:00:00 grep --color=auto gitlab
-
杀掉一堆点(…)的进程
[root@iZm5ef38095rhuzz3nhcfnZ ~]# kill -9 16681 [root@iZm5ef38095rhuzz3nhcfnZ ~]# ps -ef|grep gitlab root 31890 12459 0 11:02 pts/0 00:00:00 grep --color=auto gitlab
-
查找GitLab相关的目录删掉(删想删的)
#查找 find / -name gitlab #查找到直接强制删除 find / -name gitlab | xargs rm -rf
上传代码测试
-
添加本地git的公钥
-
创建空项目
-
本地git上传
$ git init $ git add . $ git commit -m '提交' $ git remote add origin http://118.190.201.101:81/root/project_test.git $ git push origin master Username for 'http://118.190.201.101:81': root Enumerating objects: 11, done. Counting objects: 100% (11/11), done. Delta compression using up to 4 threads Compressing objects: 100% (10/10), done. Writing objects: 100% (11/11), 3.55 KiB | 1.77 MiB/s, done. Total 11 (delta 0), reused 0 (delta 0) To http://118.190.201.101:81/root/project_test.git * [new branch] master -> master