Gitlab之Centos7下安装

安装依赖软件

yum -y install policycoreutils openssh-server openssh-clients postfix

设置postfix开机自启,并启动,postfix支持gitlab发信功能

systemctl enable postfix && systemctl start postfix

下载gitlab安装包,然后安装

rpm方式安装 

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

cd /usr/local/software

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

rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

修改gitlab配置文件指定服务器ip和自定义端口

vim  /etc/gitlab/gitlab.rb

找到external_url 修改成 当前服务器ip:端口号

注意这里设置的端口不能被占用,并在防火墙设置开放相对应得端口

添加

firewall-cmd --zone=public --add-port=端口号/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)

重新载入

firewall-cmd --reload

重置并启动GitLab

gitlab-ctl reconfigure

gitlab-ctl restart

提示“ok: run:”表示启动成功

gitlab初始默认账号: root 密码: 5iveL!fe

直接输入服务器ip和指定端口进行访问,提示修改密码

配置gitlab smtp发送邮件

vim  /etc/gitlab/gitlab.rb

gitlab_rails['smtp_enable'] = true 

gitlab_rails['smtp_address'] = "smtp.163.com" 

gitlab_rails['smtp_port'] = 25 

gitlab_rails['smtp_user_name'] = "发件人@163.com"

gitlab_rails['smtp_password'] = "123456"

gitlab_rails['smtp_domain'] = "163.com"

gitlab_rails['smtp_authentication'] = :login 

gitlab_rails['smtp_enable_starttls_auto'] = true

gitlab_rails['gitlab_email_from'] = "发件人@163.com"

user["git_user_email"] = "发件人@163.com"

gitlab-ctl reconfigure

输入命令测试

gitlab-rails console

Notify.test_email('收件人@qq.com', 'Message Subject', 'Message Body').deliver_now

登录502报错

一般是权限问题,解决方法:chmod -R 755 /var/log/gitlab

如果还不行,请检查你的内存,安装使用GitLab需要至少4GB可用内存(RAM + Swap)!

由于操作系统和其他正在运行的应用也会使用内存, 所以安装GitLab前一定要注意当前服务器至少有4GB的可用内存. 

少于4GB内存会出现各种诡异的问题, 而且在使用过程中也经常会出现500错误.

猜你喜欢

转载自www.cnblogs.com/zengnansheng/p/10404636.html