温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

gitlab搭建

发布时间:2020-05-22 13:44:56 来源:网络 阅读:219 作者:草根追逐 栏目:系统运维

gitlab官网 https://about.gitlab.com/gitlab-com/
官方安装文档 https://about.gitlab.com/installation/?version=ce#centos-7 (ce/ee)
要求服务器内存不少于2g
国外比较慢,所以我们用国内源

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

yum install -y gitlab-ce
gitlab-ctl reconfigure

netstat -lnpt //查看监听端口
gitlab-ctl stop/restart/start/status
浏览器访问gitlab,输入ip即可
注意如果访问502,注意是否有端口冲突,最好启动gitlab前关闭所有之前搭建的服务
默认管理员root,无密码,它会让我们去定义一个密码
gitlab常用命令 https://www.cnyunwei.cc/archives/1204
gitlab备份 gitlab-rake gitlab:backup:create
备份目录在/var/opt/gitlab/backups
gitlab 恢复 先停服务 gitlab-ctl stop unicorn ; gitlab-ctl stop sidekiq
gitlab-rake gitlab:backup:restore BACKUP=xxxxx (这里是一个编号,即备份文件的前缀)
例如:
gitlab-rake gitlab:backup:restore BACKUP=1511704184_2017_11_26_10.2.1

再启动服务 gitlab-ctl start

rpm安装:(centos6.5)
安装依赖:
yum install curl openssh-server openssh-clients postfix cronie
rpm地址:
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-8.0.5-ce.0.el6.x86_64.rpm
下载:
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-8.0.5-ce.0.el6.x86_64.rpm
安装:
rpm -ivh gitlab-ce-8.0.5-ce.0.el6.x86_64.rpm
gitlab-ctl reconfigure
启动:
gitlab-ctl start

汉化:
其他版本可参考:http://blog.csdn.net/wh311212/article/details/72627803
#8版本下载汉化包并汉化
[root@git hanhua]# git clonehttps://gitlab.com/larryli/gitlab.git Gitlab-cn && cd Gitlab-cn
#备份/opt/gitlab/embedded/service目录下的gitlab-rails目录,该目录下的内容主要是web应用部分
#备份
[root@git Gitlab-cn]#\cp -rf /opt/gitlab/embedded/service/gitlab-rails{,.ori}
#关闭gitlab这个服务
[root@git Gitlab-cn]#gitlab-ctl stop
#开始汉化
[root@git gitlab_pack]# \cp -rf ../Gitlab-cn/* /opt/gitlab/embedded/service/gitlab-rails/
测试是否汉化成功
[root@git ~]# gitlab-ctl start
ok: run: gitlab-workhorse: (pid 1407) 263s
ok: run: logrotate: (pid 1403) 263s
ok: run: nginx: (pid 1404) 263s
ok: run: postgresql: (pid 1405) 263s
ok: run: redis: (pid 1402) 263s
ok: run: sidekiq: (pid 1400) 263s
ok: run: unicorn: (pid 1401) 263s
登录
http://192.168.201.131/users/sign_in

GitLab 项目创建后地址由Localhost改为实际IP的方法
进入终端修改以下文件即可。
vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml

GitLab settings

gitlab:

Web server settings (note: host is the FQDN, do not include http://)

host: localhost         >> 这里改为主机的IP即可
port: 80
https: false

# Uncommment this line below if your ssh host is different from HTTP/HTTPS one
# (you'd obviously need to replace ssh.host_example.com with your own host).
# Otherwise, ssh host will be set to the `host:` value above

重启GitLab
gitlab-ctl restart

git clean 参数
-n 显示 将要 删除的 文件 和 目录
-f 删除 文件,-df 删除 文件 和 目录

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI