CentOS 7 离线安装gitlab

一、gitlab介绍

gitLab一个开源的git仓库管理平台,方便团队协作开发、管理。在GitLab上可以实现完整的CI(持续集成)、CD(持续发布)流程。而且还提供了免费使用的Plan,以及免费的可以独立部署的社区版本,社区版为:gitlab-ce,商业版为:gitlab-ee

二、gitlab安装

2.1 依赖包安装

yum install -y pygpgme yum-utils
yum install -y curl policycoreutils-python openssh-server
yum install -y git

2.2 防火墙永久开启http

firewall-cmd --add-service=ssh --permanent
firewall-cmd --add-service=http --permanent
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-all

2.3 安装postfix邮件服务

yum install postfix
systemctl enable postfix
systemctl start postfix

2.4 rpm方式安装gitlab

这里我安装的是gitlab-ce-13.0.0-ce.0.el7.x86_64.rpm这个版本
gitlab下载地址:gitlab官网

rpm -ivh gitlab-ce-13.0.0-ce.0.el7.x86_64.rpm 

2.5 gitlab预配置

vim /etc/gitlab/gitlab.rb

配置gitlab的external_url以及邮件

external_url 'http://192.168.77.134' 
gitlab_rails['time_zone'] = 'Asia/Shanghai' 
gitlab_rails['gitlab_email_enabled'] = true 
gitlab_rails['gitlab_email_from'] = '[email protected]' 
gitlab_rails['gitlab_email_display_name'] = 'Gitlab CE' 
gitlab_rails['smtp_enable'] = true 
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 25 
gitlab_rails['smtp_user_name'] = "[email protected]" 
gitlab_rails['smtp_password'] = "xxxxxx" 
gitlab_rails['smtp_domain'] = "163.com" 
gitlab_rails['smtp_authentication'] = "login" 
gitlab_rails['smtp_enable_starttls_auto'] = false 
gitlab_rails['smtp_tls'] = false

2.6 自动配置gitlab

gitlab-ctl reconfigure

看到下想图代表配置成功
CentOS 7 离线安装gitlab_第1张图片

2.7 启动所有服务

gitlab-ctl start

看到下图代表安装成功
CentOS 7 离线安装gitlab_第2张图片

三、gitlab访问测试

3.1 浏览器访问:

http://192.168.77.134/

初次访问会提示设置root账户密码

3.2 root账户gitlab配置

依次访问Configure GitLab->Settings->CI/CD->取消勾选Default to Auto DevOps pipeline for all projects,取消勾选Enable shared runners for new projects

四、修改gitlab端口

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

将80修改为8888

server {
  listen *:8888;


  server_name 192.168.77.134;
  server_tokens off; ## Don't show the nginx version number, a security best practice

修改成功后重启gitlab

gitlab-ctl restart

重启后访问地址改为

http://192.168.77.134:8888

你可能感兴趣的:(Linux,Nginx)