Install GitLab on CentOS

 

Environment CentOS 7.6 2 cores 4GB memory

环境 CentOS 7.6 2核 4GB内存

安装脚本

# 国内镜像
#https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm --no-check-certifica
# 安装依赖软件openssh(ssh协议的服务端和客户端)
yum install -y curl policycoreutils-python openssh-server cronie
# 安装lokkit
yum -y install lokkit

# 启动ssh
lokkit -s http -s ssh 
# 设置ssh开机自启动
systemctl enable sshd

# 安装依赖软件postfix(邮件传输代理软件)
yum -y install postfix
# 设置postfix自启动
systemctl enable postfix
# 启动postfix
systemctl start postfix
# 安装rpm包
rpm -ivh gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm


# 
sudo gitlab-ctl reconfigure
# 启动gitlab
gitlab-ctl start
# 设置gitlib开机自启动
systemctl enable gitlab-runsvdir.service

# 开放端口
firewall-cmd --zone=public --permanent --add-port=80/tcp

安装完显示

Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

默认用户 root

external_url 'http://IP:PROT'

or

external_url 'http://www.test.com‘

不配置external_url 项目会显示机器名

 /var/opt/gitlab/nginx/conf nginx配置路径

gitlib基本维护命令:

sudo gitlab-ctl start    # 启动所有 gitlab 组件;

sudo gitlab-ctl stop        # 停止所有 gitlab 组件;

sudo gitlab-ctl restart        # 重启所有 gitlab 组件;

sudo gitlab-ctl status        # 查看服务状态;

sudo gitlab-ctl reconfigure        # 启动服务;

sudo vim /etc/gitlab/gitlab.rb        # 修改默认的配置文件;

gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;

sudo gitlab-ctl tail        # 查看日志; 

修改端口号(不好使)云服务器的问题

vim /etc/gitlab/gitlab.rb

# 修改 nginx['listen_port'] = 81

gitlab-ctl reconfigure


vim /var/opt/gitlab/nginx/conf/gitlab-http.conf 

# 修改为 listen *:81;



#重启gitlab服务
gitlab-ctl restart

#查看nginx日志
gitlab-ctl tail nginx

修改头像不显示问题

 vi /etc/gitlab/gitlab.rb

gitlab_rails['gravatar_plain_url'] = 'http://sdn.geekzu.org/avatar/%{hash}?s=%
gitlab_rails['gravatar_ssl_url'] = 'https://sdn.geekzu.org/avatar/%{hash}?s=%{size}&d=identicon'

#重新加载配置
gitlab-ctl reconfigure

卸载

gitlab-ctl stop
rpm -e gitlab-ce
ps -ef|grep gitlab
#杀掉第一个守护进程(runsvdir -P /.../gitlab/service log)
kill -9 609
find / -name *gitlab*|xargs rm -rf
find / -name gitlab |xargs rm -rf 

更多配置:

Gitlab安装配置及简单问题处理-阿里云开发者社区

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值