Gitlab简单部署
1,环境和准备工作
- 操作系统:CentOS6 或者7、8测试都是没有问题的
- IP地址:192.168.106.129
配置
2,建立git用户
useradd git
passwd git
passwd -l git #锁定git远程登陆
3,关闭防火墙
systemctl stop firewalld
systemctl disabled firewalld
4,安装依赖库
# yum install curl openssh-server postfix cronie -y
# service postfix start
# chkconfig postfix on 或者 #systemctl enable postfix.service 开机自启
5,安装Gitlab
历史版本下载:点我跳转到gitlab历史版本页面。
#curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
#yum install gitlab-ce -y
# chkconfig gitlab-ce on 或者 #systemctl enable gitlab-ce.service 开机自启 #开机自启
整个包有300多MB,如果使用yum无法下载,可以直接下载RPM包。
wget -c https://packages.gitlab.com/gitlab/gitlab-ce/el/6/x86_64/gitlab-ce-7.13.3-ce.1.el6.x86_64.rpm
Gitlab安装包/密码:1hg4
https://pan.baidu.com/share/init?surl=fRPfoGXHByzRacqH8ZFD2g
6,配置GitLab
直接启动GitLab并不能正常工作,需要进行配置,其所有的配置都在配置文件/etc/gitlab/gitlab.rb中。此文件太长,太多的注释,后期研究可以查看此文档,在此从简配置。
备份
# mv /etc/gitlab/gitlab.rb{,.bck}
配置
cat > /etc/gitlab/gitlab.rb << EOF
external_url 'http://192.168.106.129'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = 'Linuxlql@163.com'
gitlab_rails['smtp_password'] = "yourpasswd"
gitlab_rails['smtp_domain'] = "smtp.163.com"
gitlab_rails['smtp_authentication'] = :plain
#gitlab_rails['smtp_authentication'] = "login"
#gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['gitlab_email_from'] = "Linuxlql@163.com"
user["git_user_email"] = "Linuxlql@163.com"
git_data_dir "/home/git"
EOF
配置之后,使用如下命令加载配置。
# gitlab-ctl reconfigure #执行估计20分钟
There was an error running gitlab-ctl reconfigure:
ruby_block[authorize Grafana with GitLab] (monitoring::grafana line 101) had an error: Mixlib::ShellOut::CommandTimeout: Command timed out after 600s:
Command exceeded allowed execution time, process terminated
---- Begin output of /opt/gitlab/bin/gitlab-rails runner -e production 'app = Doorkeeper::Application.where(redirect_uri: "http://192.168.106.129/-/grafana/login/gitlab", name: "GitLab Grafana"