安装基础RPM包
[root@hy-205 yum.repos.d]# yum install curl policycoreutils openssh-server openssh-clients postfix -y
curl下载 gitlab脚本
[root@hy-205 ~]# curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
修改 yum源
vim/etc/yum.repos.d/gitlab_gitlab-ce.repo
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
install gitlab-ce
[root@hy-205 yum.repos.d]# yum install gitlab-ce -y
修改gitlab配置 端口号
vim /etc/gitlab/gitlab.rb
[root@hy-205 gitlab]# egrep -v '#|^$' /etc/gitlab/gitlab.rb
external_url 'http://10.100.214.205:8159'
nginx['listen_port'] = 8159
初始化
[root@hy-205 gitlab]# gitlab-ctl reconfigure
[root@hy-205 ~]# gitlab-ctl start
[root@hy-205 ~]# netstat -tunlp |grep 8159
tcp 0 0 0.0.0.0:8159 0.0.0.0:* LISTEN 17432/nginx: master
nginx.conf 配置反向代理
##nginx.conf 中设置
upstream default_backend_gitlab {
server 10.100.214.205:8159 max_fails=3 fail_timeout=10s;
}
server {
server_name gitlab.hy.com;
location / {
proxy_pass http://default_backend_gitlab;
proxy_set_header Host $http_host;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
}
}
测试是否可以登录
修改原始密码
[root@hy-205 gitlab]# cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
2. Password hasn't been changed manually, either via UI or via command line.
If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
Password: eydA9C956JBk6Ioai3ISCw/mrfqiBYfG7rKI19PBW5o=
# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.