一、准备工作
在CentOS系统上安装所需的依赖:ssh、firewalld 、postfix 、wget,以下这些命令也会打开系统防火墙中的HTTP和SSH端口访问。
1、安装SSH服务
安装
yum install -y curl policycoreutils-python openssh-server
开启自启以及启动
systemctl enable sshd
systemctl start sshd
2、安装firewalld
安装
yum install -y firewalld systemd
开启自启以及启动
systemctl enable firewalld
systemctl start firewalld
添加http服务到firewalld
firewall-cmd --permanent --add-service=http
重启防火墙
systemctl restart firewalld
3、安装postfix
安装
yum -y install postfix
开机自启以及启动
systemctl enable postfix
systemctl start postfix
在安装Postfix期间,可能会出现配置屏幕。选择“Internet Site”并按enter键。使用您的服务器的外部DNS以“mail name”并按enter。如果出现额外的屏幕,继续按enter键接受默认值。
4、wget
# 检查wget是否存在
wget -v
# 安装
yum -y install wget
二、安装
1、添加gitlab镜像
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.11.0-ce.0.el7.x86_64.rpm
2、安装gitlab
rpm -i gitlab-ce-11.11.0-ce.0.el7.x86_64.rpm
3、配置
修改gitlab配置文件指定服务器ip和自定义端口
vim /etc/gitlab/gitlab.rb
external_url 'http://128.192.3.87:8090'
4、重置并重启
gitlab-ctl reconfigure
gitlab-ctl restart
三、定时本地备份与清理
1、本地备份
定时备份的思路建立在手动的基础上,通过crontab添加定时计划就可以解决这个问题。
crontab -e
0 1 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
systemctl enable crond
systemctl restart crond
2、自动清理
gitlab支持自动清理
vim /etc/gitlab/gitlab.rb
将其中backup_keep_time的配置取消注释,根据需要设置自动清理多少天前的备份,我这里是设置备份保留7天(7360024=604800),保存**