postfix邮箱
- 安装依赖、软件
yum upgrade
yum install -y redhat-lsb telnet mailx
yum -y install policycoreutils openssh-server openssh-clients - 查看是否已经安装Postfix
rpm -qa | grep postfix - 安装postfix
yum -y install postfix - 查看当前MTA
alternatives --display mta
如显示当前MTA为sendmail,则输入
/usr/sbin/alternatives --set mta /usr/sbin/sendmail.postfix - 修改 /etc/postfix/main.cf
vi /etc/postfix/main.cf
inet_protocols = all
inet_interfaces = all
- 设置postfix开机自启,并启动,postfix支持gitlab发信功能
systemctl enable postfix && systemctl start postfix
chown -R postfix /var/lib/postfix/
3.下载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
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.7.3-ce.0.el7.x86_64.rpm
rpm -ihv gitlab-ce-10.7.3-ce.0.el7.x86_64.rpm
- 安装报错
warning: soft/gitlab-ce-10.7.3-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
error: Failed dependencies:
policycoreutils-python is needed by gitlab-ce-10.7.3-ce.0.el7.x86_64
安装依赖
yum install policycoreutils-python
- 修改gitlab配置文件指定服务器ip和自定义端口
vim /etc/gitlab/gitlab.rb
如:
external_url 'http://129.211.24.177:8081'
注意加单引号
image.png
- 重置配置
gitlab-ctl reconfigure
提示表示成功:
Running handlers:
Running handlers complete
Chef Client finished, 391/556 resources updated in 02 minutes 13 seconds
gitlab Reconfigured!
- 启动GitLab
gitlab-ctl restart
提示“ok: run:”表示启动成功
-
访问 GitLab页面 上面配置的IP 如:http://129.211.24.177:8081
9999.png
初始账户:
root 密码: handhand123 第一次登录修改密码
![](https://img.haomeiwen.com/i7850343/8be1c862cdc3d338.png)
7.设置gitlab发信功能,需要注意一点:
发信系统用的默认的postfix,smtp是默认开启的,两个都启用了,两个都不会工作。
我这里设置关闭smtp,开启postfix
关闭smtp方法:
vim /etc/gitlab/gitlab.rb
找到
gitlab_rails['smtp_enable'] = true
改为 gitlab_rails['smtp_enable'] = false
修改后执行
gitlab-ctl reconfigure
另一种是关闭postfix,设置开启smtp,相关教程请参考官网https://doc.gitlab.cc/omnibus/settings/smtp.html
更改git仓库存储位置
-
默认时GitLab的仓库存储位置在
ls -ld /var/opt/gitlab/git-data/repositories -
在实际生产环境中显然我们不会存储在这个位置
mkdir -pv /usr/local/git-data
修改创建目录的属主和属组为git用户默认git用户安装
chown -R git:git /usr/local/git-data -
修改gitlab配置
vim /etc/gitlab/gitlab.rb
启用git_data_dirs参数,并修改如下:
搜索/git_data_dirs
git仓库存储地方
-
重新编译gitlab.rb文件,使用做的修改生效
gitlab-ctl reconfigure
重新编辑后,GitLab在仓库目录会自动创建一个repositories文件,如下:
ls -ld /usr/local/git-data/repositories/ -
数据迁移
cd /var/opt/gitlab/git-data/repositories
cp -r * /usr/local/git-data/repositories/
重启git
gitlab-ctl restart
网友评论