gitlab-腾讯云安装

gitlab-腾讯云安装

1.环境搭建

Linux:CentOS7.6
CPU: 2核 内存: 4GB

1.1开启HTTP和SSH访问

yum install -y curl policycoreutils-python openssh-server
systemctl enable sshd
systemctl start sshd
firewall-cmd --permanent --add-service=http
systemctl reload firewalld

1.2安装并启用邮件服务

yum install postfix
systemctl enable postfix
systemctl start postfix

1.3下载并安装gitlab

一开始使用清华大学的镜像
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
在腾讯云下载过于缓慢
后来检索到https://mirrors.cloud.tencent.com/ 腾讯软件源
在Linux 新建 /etc/yum.repos.d/gitlab-ce.repo

[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.cloud.tencent.com/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1

腾讯云替换为mirrors.tencentyun
公网访问地址:
http://mirrors.cloud.tencent.com/
http://mirrors.tencent.com/
内网访问地址:
http://mirrors.tencentyun.com/

1.4新建完成后执行

sudo yum makecache
sudo yum install gitlab-ce

安装好之后,会显示gitlab的图案,并提示设置外网访问地址

1.5配置gitlab

#打开配置文件 gitlab.rb
[root@VM_177_101_centos gitlab]# vim /etc/gitlab/gitlab.rb
#修改外网访问地址 13行
#ip为主机的ip地址,端口默认是8080,这里为了避免出现占用,也进行修改一下,我的配置为9999
external_url = ‘http://ip:prot’
#修改nginx监听
#gitlab默认使用了nginx进行反向代理,这里我重新配置了一下 579行~580行
unicorn[‘listen’] = ‘127.0.0.1’
unicorn[‘port’] = 8082
#重新配置nginx 800行
nginx[‘enable’] = true
nginx[‘listen_addresses’] = [’*’]
nginx[‘listen_port’] = 82
#退出并保存

1.6 重新加载配置并重启gitlab

gitlab-ctl reconfigure
gitlab-ctl restart
#出现如下提示说明重启成功
ok: run: gitaly: (pid 18536) 0s
ok: run: gitlab-monitor: (pid 18556) 1s
ok: run: gitlab-workhorse: (pid 18561) 0s
ok: run: logrotate: (pid 18610) 1s
ok: run: nginx: (pid 18616) 0s
ok: run: node-exporter: (pid 18623) 0s
ok: run: postgres-exporter: (pid 18634) 1s
ok: run: postgresql: (pid 18660) 0s
ok: run: prometheus: (pid 18722) 0s
ok: run: redis: (pid 18732) 0s
ok: run: redis-exporter: (pid 18737) 0s
ok: run: sidekiq: (pid 18758) 0s
ok: run: unicorn: (pid 18767) 1s

1.7 访问gitlab

先进入gitlab
1、gitlab-rails console -e production
2、执行命令: user = User.where(id: 1).first,此 user 则表示 root 用户
3、修改密码
执行命令:user.password = 'secret_pass’修改密码, user.password_confirmation = ‘secret_pass’ 确认密码
4、保存密码
执行命令: user.save!
5、退出控制台
执行命令: exit
在这里插入图片描述

2.Gitlab服务命令

启动所有 gitlab 组件;sudo gitlab-ctl start
停止所有 gitlab 组件;sudo gitlab-ctl stop
重启所有 gitlab 组件;sudo gitlab-ctl restart
查看服务状态;sudo gitlab-ctl status
启动服务(再次加载配置);sudo gitlab-ctl reconfigure
修改默认的配置文件;sudo vim /etc/gitlab/gitlab.rb
检查gitlab;gitlab-rake gitlab:check SANITIZE=true --trace
查看日志;sudo gitlab-ctl tail

下面是引用内容
[1]: https://www.cnblogs.com/xieshuang/p/8488230.html
[2]: https://blog.csdn.net/A___LEi/article/details/110476531
[3]: https://help.aliyun.com/document_detail/52857.html
[4]: https://mirrors.cloud.tencent.com/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值