Linux在线或者离线安装gitlab

参考博客:RHEL7/CentOS7 在线和离线安装 GitLab 配置使用实践

在线安装gitlab

  • 依赖安装
yum install curl policycoreutils openssh-server openssh-clients -y
systemctl enable sshd
systemctl start sshd
yum install postfix
systemctl enable postfix

# 检查修改邮件下面 2 项配置,不配置可以跳过
vim /etc/postfix/main.cf 

inet_interfaces = all
inet_protocols = ipv4

systemctl start postfix
  • 在线安装 gitlab-ce
# 安装必要的依赖包,如果不需要可以考虑跳过
yum install pygpgme yum-utils
# On CentOS 7 (and RedHat/Oracle/Scientific Linux 7), the commands below will also open HTTP and SSH access in the system firewall.
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
# Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

# 使用阿里云作加速
cd /etc/yum.repos.d/ && rm -f *.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

# 添加 GitLab 镜像源并安装,建议切换国内资源加速访问
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

# 创建 gitlab-ce 的 repo,使用清华大学加速
vim /etc/yum.repos.d/gitlab_gitlab-ce.repo

[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key

# 配置并启动 GitLab
gitlab-ctl reconfigure

离线安装gitlab

# 使用阿里云作加速
cd /etc/yum.repos.d/ && rm -f *.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

# 添加 GitLab 镜像源并安装,建议切换国内资源加速访问
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

# 创建 gitlab-ce 的 repo,使用清华大学加速
vim /etc/yum.repos.d/gitlab_gitlab-ce.repo

[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key

# 安装 yum-plugin-downloadonly 插件
yum install -y yum-plugin-downloadonly

# 下载 gitlab-ce 相关 rpm 到指定目录
mkdir -p /tmp/repo/gitlab-ce/
yum install --downloadonly --downloaddir=/tmp/repo/gitlab-ce/ gitlab-ce

# 拷贝文件至内网离线安装
rpm -ivh /tmp/repo/gitlab-ce/*

# 配置并启动 GitLab
gitlab-ctl reconfigure

# 第一次访问 GitLab,系统会重定向页面到重定向到重置密码页面,你需要输入初始化管理员账号的密码,管理员的用户名为 root,重置密码后新密码即为刚输入的密码。
0.0.0.0:80
原文地址:https://www.cnblogs.com/mrnx2004/p/11725535.html