如何在centos安装 gitlab 10.x
sudo yum -y install policycoreutils openssh-server openssh-clients postfix policycoreutils-python
在找到最新版本https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm
如下图
初次启动 gitlab-ctl reconfigure 配置
gitlab-ctl reconfigure
There was an error running gitlab-ctl reconfigure:
execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] (postgresql::enable line 80) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
STDOUT: The files belonging to this database system will be owned by user "gitlab-psql".
This user must also own the server process.
STDERR: initdb: invalid locale settings; check LANG and LC_* environment variables
---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1
解决:在 ~/.bash_profile, 然后source ~/.bash_profile
export LC_ALL="zh_CN.UTF-8"
export LC_CTYPE="zh_CN.UTF-8"
如果自己有自域名的话那么可以直接域名:端口。 端口不谢的话,默认80
vi /etc/gitlab/gitlab.rb
external_url 'http://gitlab.xxx.com'
它的原理是这样的, 其实gitlab安装结束以后会自动在后台安装PG数据库,和一个ngnix程序,这里配置的external_url会在ngnix那边生成一个反向代理的配置。
gitlab-ctl reconfigure
gitlab-ctl restart
把阿里云DNS 把gitlab.xxx.com 的域名指向当前ECS/EC2公网IP
访问 gitlab.xxx.com设置root密码
参照 官网教程设置邮箱。https://docs.gitlab.com/omnibus/settings/smtp.html
ls -al 找到/opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml对应的软连文件。
ls -al /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
/opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml -> /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
然后修改 /var/opt/gitlab/gitlab-rails/etc/gitlab.yml 的project url
vi /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: gitlab.xxxx.com
port: 80
https: false
运行
gitlab-ctl restart