Linux 部署 GitLab
介绍可以进去 官网 ,滑到最下面 找到 install 点击,看到安装对应的系统,选择则即可。环境
·
环境
192.168.200.167 centos
部署方式
- Omnibus package 安装
- 手动安装
Omnibus package
1. ssh
- 安装 ssh
yum install -y curl policycoreutils-python openssh-server
- 开机启动
systemctl enable sshd
- 启动
systemctl start sshd
2. 防火墙
- 打开HTTP
firewall-cmd --permanent --add-service=http
- 重启,使防火墙修改生效
systemctl reload firewalld
3. Postfix
Postfix 用于发送通知电子邮件
- 安装
yum install postfix
- 开机自启
systemctl enable postfix
- 启动
systemctl start postfix
4. GitLab包存储库
- 添加
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
5. 安装GitLab包
- 安装
EXTERNAL_URL="http://192.168.200.167:8091" yum install -y gitlab-ee
http://192.168.200.167:8091更改为要访问 GitLab 实例的URL。安装将自动配置并启动该 URL 的GitLab,设置访问端口不能是8080端口,8080 GitLab 有其他用处,否则发我 GitLab 会出现 502 的错误。
- 修改访问地址
vi /etc/gitlab/gitlab.rb
- 重载配置
gitlab-ctl reconfigure
6. 访问 GitLab
- 开放访问端口
firewall-cmd --zone= public --query-port=8091/tcp #查看
firewall-cmd --zone=public --add-port=8091/tcp --permanent #--permanent永久生效,没有此参数重启后失效
firewall-cmd --reload #配置生效
- 首次访问,会到密码重置界面,用默认帐户的用户名root登录。
7. 注意
- 如果启动 GitLab 时,8080 端口别占用,将会出现502错误。此时可以修改端口进行解决这个问题。
首先打开,配置文件,这里修改为 8079。
vi /etc/gitlab/gitlab.rb
修改完成执行下面命令,使配置生效,之后再次访问 GitLab即可。
gitlab-ctl reconfigure
Firewall 相关命令
- 基本命令
systemctl start firewalld #启动
systemctl stop firewalld #关闭
systemctl status firewalld #查看状态
systemctl disable firewalld #开机禁用
systemctl enable firewalld #开机启用
- firewalld-cmd
firewall-cmd --version #查看版本
firewall-cmd --help #查看帮助
firewall-cmd --state #显示状态
firewall-cmd --zone=public --list-ports #查看所有打开的端口
firewall-cmd --reload #更新防火墙规则
firewall-cmd --get-active-zones #查看区域信息
firewall-cmd --get-zone-of-interface=eth0 #查看指定接口所属区域
firewall-cmd --panic-on #拒绝所有包
firewall-cmd --panic-off #取消拒绝状态
firewall-cmd --query-panic #查看是否拒绝
- systemctl 相关
systemctl start firewalld.service #启动一个服务
systemctl stop firewalld.service #关闭一个服务
systemctl restart firewalld.service #重启一个服务
systemctl status firewalld.service #显示一个服务的状态
systemctl enable firewalld.service #在开机时启用一个服务
systemctl disable firewalld.service #在开机时禁用一个服务
systemctl is-enabled firewalld.service #查看服务是否开机启动
systemctl list-unit-files|grep enabled #查看已启动的服务列表:
systemctl --failed #查看启动失败的服务列表
- 端口操作
firewall-cmd --zone= public --query-port=8091/tcp #查看
firewall-cmd --zone=public --add-port=8091/tcp --permanent #--permanent永久生效,没有此参数重启后失效
firewall-cmd --reload #修改生效
firewall-cmd --zone= public --remove-port=80/tcp --permanent #删除
GitLab 相关命令
gitlab-ctl status #查看状态
gitlab-ctl start # 启动Gitlab所有组件
gitlab-ctl stop # 停止Gitlab所有组件
gitlab-ctl restart # 重启Gitlab所有组件
更多推荐
已为社区贡献1条内容
所有评论(0)