搭建自己的GitLab服务器 Centos7.4


一、环境要求:
1、  CentOS 6或者7 
2、  4G以上内存 
3、  安装版本:gitlab‐ce 社区版本

 二、环境准备

#安装基础工具类

yum install -y vim wget ntpdate git

#配置时间同步
/usr/sbin/ntpdate ntp6.aliyun.com echo "*/3 * * * * /usr/sbin/ntpdate ntp6.aliyun.com &> /dev/null" > /tmp/crontab crontab /tmp/crontab

#安装依赖
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 firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

#邮件服务(可选)
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

  三、GitLab 下载安装

#使用清华大学资源镜像库下载(国内的比较快)
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.5.3-ce.0.el7.x86_64.rpm
#解压安装
rpm -ivh gitlab-ce-11.5.3-ce.0.el7.x86_64.rpm
#安装完成后,一定要重启
reboot

  四、GitLab 配置

#备份一下文件
cp /etc/gitlab/gitlab.rb{,.bak}

#编辑文件 改成自己的ip地址
vim /etc/gitlab/gitlab.rb

external_url 'http://192.168.0.100'

五、GitLab 汉化

#查看自己的安装版本,下载对应的汉化包
head -1 /opt/gitlab/version-manifest.txt

 

 

 

##下载汉化包
git clone https://gitlab.com/xhang/gitlab.git -b v11.3.5-zh

#汉化前,先停止服务
gitlab-ctl stop

#备份一下原始文件
tar -zcvf
/opt/gitlab/embedded/service/gitlab-rails.tar.gz /opt/gitlab/embedded/service/gitlab-rails

#执行汉化覆盖(
./gitlab/* 刚才下载的汉化包目录
\cp -r -f  ./gitlab/*  /opt/gitlab/embedded/service/gitlab-rails/ 

#重新加载配置(第一次时间长,需要等待几分钟)
gitlab-ctl reconfigure

#启动服务
gitlab-ctl start


###gitlab常用命令

  加载配置文件命令:gitlab-ctl reconfigure
  启动GitLab命令:gitlab-ctl start
  重启GitLab命令:gitlab-ctl restart
  停止GitLab命令:gitlab-ctl stop
  查看GitLab服务状态:gitlab-ctl status
  查看GitLab版本号:head -1 /opt/gitlab/version-manifest.txt
  查看日志命令:gitlab-ctl tail

六、浏览器访问

浏览器输入刚才配置的ip地址   http://192.168.0.100

用户默认为root,第一次使用,需要设置root用户的密码


 

posted @ 2020-05-14 11:35  小⑦  阅读(387)  评论(0)    收藏  举报