Centos6.5安装gitlab

1. 安装配置依赖项
sudo yum install curl openssh-server openssh-clients postfix cronie
启动postfix邮件服务
sudo service postfix start
设置开机启动
sudo chkconfig postfix on
打开80和22端口
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
重启防火墙:service iptables restart

2.上传gitlab安装包gitlab-ce-8.17.0-ce.0.el6.x86_64.rpm执行安装
rpm -i gitlab-ce-8.17.0-ce.0.el6.x86_64.rpm

3. 配置GitLab
sudo gitlab-ctl reconfigure

停止启动和重启命令:gitlab-ctl start/stop/restart

4.访问:http://192.168.2.134
账号密码设置为:root/zhongjianyu(开始只需要输入密码,root是默认管理员用户)

5.配置smtp服务:([email protected]是自己注册的腾讯企业邮箱)
vi /etc/gitlab/gitlab.rb

# gitlab_rails['smtp_enable'] = true
# gitlab_rails['smtp_address'] = "smtp.server"
# gitlab_rails['smtp_port'] = 465
# gitlab_rails['smtp_user_name'] = "smtp user"
# gitlab_rails['smtp_password'] = "smtp password"
# gitlab_rails['smtp_domain'] = "example.com"
# gitlab_rails['smtp_authentication'] = "login"
# gitlab_rails['smtp_enable_starttls_auto'] = true
# gitlab_rails['smtp_tls'] = false
修改成:
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "5698qq"
gitlab_rails['smtp_domain'] = "qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from']="[email protected]"
user['git_user_email']="[email protected]"

6.修改git地址:
vi /etc/gitlab/gitlab.rb
external_url 'http://gitlab01'
修改成:
external_url 'http://对应的ID',如:external_url 'http://192.168.2.134'

重新配置
sudo gitlab-ctl reconfigure

6.5 gitlab备份还原:
创建备份:
/usr/bin/gitlab-rake gitlab:backup:create
会在/var/opt/gitlab/backups生成备份文件(默认是在这个目录,后面可以修改):
cd /var/opt/gitlab/backups
ls如下:
1494129143_2017_05_07_gitlab_backup.tar

还原备份:
cd /var/opt/gitlab/backups
gitlab-rake gitlab:backup:restore BACKUP=1520229280_2018_03_05

重启:
gitlab-ctl restart


7.修改gitlab的数据库配置(以下未有测试失败):
(1)增加postgresql访问端口
vi /etc/sysconfit/iptables
增加:-A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
重启防火墙:service iptables restart
(2)修改git数据库配置:
vi /var/opt/gitlab/postgresql/data/pg_hba.conf
增加:host    all         all  192.168.0.0/254  trust
上面其中192.168.0是自己的IP段

vi /var/opt/gitlab/postgresql/data/postgresql.conf
修改:listen_addresses = '*'      修改监听地址为ip(自身IP)

重启数据库:
gitlab-ctl restart postgresql


/opt/gitlab/embedded/bin/psql -U gitlab -d gitlabhq_production -h 192.168.0.104
 

你可能感兴趣的:(服务器,开发工具,CI持续集成,微服务,文件系统)