前言: 原本想离线安装的,但是安装时一直报错,无奈选择了另一种方式。
离线安装包地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
linux版本
1.配置依赖包
#更新一下
#yum install -y epel-release
#gitlab-ce 对 curl policycoreutils openssh-server openssh-clients postfix 这些服务有依赖,需要提前安装和开启防火墙要打开 http 的访问,否则无法对外提供服务
yum install curl policycoreutils openssh-server openssh-clients
systemctl enable sshd
systemctl start sshd
yum install postfix
systemctl enable postfix
systemctl start postfix
#关闭防火墙,自己看需要,一般是开放某个端口,自己测着玩就可以关
#firewall-cmd --permanent --add-service=http
#systemctl reload firewalld
2.安装
yum list all | grep gitlab
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum list all | grep gitlab
yum install gitlab-ce
随后一路 y ,出现如下界面就是安装成功了
3.配置gitlab访问路径 及 启动gitlab
#修改配置
vim /etc/gitlab/gitlab.rb
#gitlab-ctl status
#这个执行起来有点久,耐心等一下
gitlab-ctl reconfigure
#启动
gitlab-ctl restart
4.账号密码
#默认账号root 密码在
cat /etc/gitlab/initial_root_password
5.访问前面配置的ip
- 修改密码
rpm方式: (再另一台虚拟机使用了该方式,可以正常部署)
gitlab rpm包安装方法
当前安装方式适合centOs7版本,需要有root权限,如果当前用户不是root用户,需要配置当前用户的sudo
- yum install -y curl policycoreutils-python openssh-server
- systemctl enable sshd && systemctl start sshd
- firewall-cmd --permanent --add-service=http
在执行这条命令后如果报FirewallD is not running这个错误,说明防火墙没有启动,使用systemctl start firewalld启动防火墙 - firewall-cmd --permanent --add-service=https
- 指定一个端口作为后续在web端访问gitlab的端口并且打开这个端口对外访问。
5.1. firewall-cmd --zone=public --list-ports 查询当前都有哪些端口可以通过外部访问
5.2. firewall-cmd --zone=public --add-port=80/tcp --permanent 打开你需要打开的端口 - systemctl reload firewalld 重启防火墙
- yum install postfix 安装邮件服务
- systemctl enable postfix && systemctl start postfix
- 使用rpm包安装命令安装gitlab的rpm包,下载地址为https://packages.gitlab.com/gitlab/gitlab-ce社区版本或者使用清华大学镜像https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
rpm -ivh …rpm - vim /etc/gitlab/gitlab.rb 修改文件中的external_url ‘http://本机ip:端口’,改为可以访问到的地址和端口
- gitlab-ctl reconfigure:初始化gitlab配置信息并启动每一个组件,
接下来就可以在web浏览器端进行访问了。
gitlab的初始化账号为root,密码为:5iveL!fe
gitlab常用命令
- gitlab-ctl start:启动gitlab,
- gitlab-ctl stop:停止gitlab。
- gitlab-ctl status:查看gitlab状态
- gitlab-ctl restart:重启服务