CentOS 6安装GitLab服务端

CentOS 6安装GitLab服务端

一、配置基础环境

text
1
2
3
4
yum install openssh-server
yum install postfix
service postfix start
chkconfig postfix on

二、下载安装gitlab

gitlab安装包下载地址:
centos 6系统的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
centos 7系统的下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
安装:

text
1
rpm -i gitlab-ce-9.5.9-ce.0.el6.x86_64.rpm

三、配置gitlab

修改gitlab配置文件指定服务器ip和自定义端口,将external_url后面的值修改为http://ip:port(例如http://192.168.7.89:8010,如果不指定端口则是默认的端口80)

text
1
vim /etc/gitlab/gitlab.rb

如果服务端开启了防火墙,则需要开放相应的端口

text
1
iptables -I INPUT -p tcp --dport 8010 -j ACCEPT

按照新的配置文件重新配置gitlab,并重新启动

text
1
2
gitlab-ctl reconfigure
gitlab-ctl restart

查看gitlab运行状态

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
gitlab-ctl status

# 得到如下输出
run: gitaly: (pid 10798) 24009s; run: log: (pid 4490) 24327s
run: gitlab-monitor: (pid 10820) 24009s; run: log: (pid 5099) 24297s
run: gitlab-workhorse: (pid 10824) 24008s; run: log: (pid 4654) 24321s
run: logrotate: (pid 24622) 2407s; run: log: (pid 4894) 24309s
run: nginx: (pid 10887) 24007s; run: log: (pid 4803) 24315s
run: node-exporter: (pid 10896) 24007s; run: log: (pid 5007) 24303s
run: postgres-exporter: (pid 10908) 24006s; run: log: (pid 5383) 24279s
run: postgresql: (pid 10918) 24006s; run: log: (pid 3780) 24391s
run: prometheus: (pid 10926) 24005s; run: log: (pid 5271) 24285s
run: redis: (pid 10943) 24005s; run: log: (pid 3615) 24398s
run: redis-exporter: (pid 10947) 24005s; run: log: (pid 5181) 24291s
run: sidekiq: (pid 10959) 24004s; run: log: (pid 4393) 24333s
run: unicorn: (pid 10987) 24003s; run: log: (pid 4292) 24339s

bug0:`GLIBC_2.14’ not found

如果出现报错/lib64/libc.so.6: version `GLIBC_2.14’ not found,则需要升级glibc

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 下载安装包
wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz
tar zxvf glibc-2.14.tar.gz
cd glibc-2.14
mkdir build
cd build

# 编译安装
../configure --prefix=/opt/glibc-2.14
make -j4
make install

# 设置链接库目录
export LD_LIBRARY_PATH=/opt/glibc-2.14/lib