Redhat 安装gitlab

以下为8月23日左右记录的,没有发布.今日整理大概记录下.

安装依赖包
yum install -y curl policycoreutils-python openssh-server openssh-clients postfix 

# 开启sshd服务
systemctl enable sshd
systemctl start sshd
# 开启postfix邮件server
systemctl start postfix

启动过程中如报错:Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.

解决办法: vim /etc/postfix/main.cf,修改如下两项.

# 修改 /etc/postfix/main.cf的设置  

inet_protocols = ipv4  

inet_interfaces = all  

设置 postfix开机气动阀

systemctl enable postfix

查看postfix启动状态

systemctl status postfix

下载rpm包并安装

需要找到符合自己系统版本的rpm安装包, 地址如下.

https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

找到后复制下载链接.

wget  https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.1.6-ce.0.el7.x86_64.rpm

mkdir /usr/local/gitlab
mv gitlab-ce-12.1.6-ce.0.el7.x86_64.rpm /usr/local/gitlab/
cd /usr/local/gitlab/
rpm -ivh
gitlab-ce-12.1.6-ce.0.el7.x86_64.rpm
配置 gitlab-ce
# ip 端口自定义 也可是域名.   vim
/etc/gitlab/gitlab.rb
    1. external_url
'http://git.example.com'       修改为       external_url 'http://192.168.2.200:8068'
      192.168.2.200 替换为自己的ip或者域名,8068端口自定义,避免冲突.
    2. 添加: unicorn['port'] = 8069

# 执行以下命令.使配置生效.
  gitlab
-ctl reconfigure

#重启服务
  gitlab-ctl restart
安装完成后 访问 http://192.168.2.200:8060   如果遇到502错误

使用 netstat -ntpl 查看端口占用情况, 如果占用, 修改端口即可.

kill -9 占用端口的进程pid

参考配置gitlab-ce 修改端口号 vim /etc/gitlab/gitlab.rb

修改后, 重新执行以下命令.使配置生效. 
gitlab-ctl reconfigure

常用的命令:

启动服务:gitlab-ctl start
查看状态:gitlab-ctl status
停掉服务:gitlab-ctl stop
重启服务:gitlab-ctl restart
让配置生效:gitlab-ctl reconfigure

原文地址:https://www.cnblogs.com/levia/p/11926425.html