镜像源:
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el7/
数据目录文件迁移参考:https://blog.csdn.net/qq_50247813/article/details/126250101
安装epel和git
yum -y install epel-release git
安装依赖
yum -y install curl openssh-server openssh-clients postfix cronie
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/policycoreutils-python-2.5-34.el7.x86_64.rpm
强制安装:
rpm -ivh --nodeps policycoreutils-python-2.5-34.el7.x86_64.rpm
关闭防火墙和selinux
systemctl disable --now firewalld.service
vim /etc/selinux/config
SELINUX=disabled
下载安装包
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el7/gitlab-ee-15.6.3-ee.0.el7.x86_64.rpm
rpm -ivh gitlab-ee-15.6.3-ee.0.el7.x86_64.rpm
修改对外访问地址
vim /etc/gitlab/gitlab.rb
external_url 'https://spduat.cmic.com.cn/gitlab'
配置 ssh 地址
gitlab_rails['gitlab_ssh_host'] = 'spduat.cmic.com.cn'
Nginx 授信地址 10.17.65.48是局域网内提供公网服务到某台器的内网IP地址
gitlab_rails['trusted_proxies'] = ['10.17.65.48']
SSH 端口
gitlab_rails['gitlab_shell_ssh_port'] = 22
服务监听方式
gitlab_workhorse['listen_network'] = "tcp"
服务监听地址
gitlab_workhorse['listen_addr'] = "0.0.0.0:10080"
禁用自带的 nginx
nginx['enable'] = false
修改数据存储目录
vim /etc/gitlab/gitlab.rb
git_data_dirs({
“default” => {
“path” => “/data/git-data”
}
})
配置邮箱:
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "@163.com"
gitlab_rails['smtp_password'] = "xxxxxx"
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
##配置邮箱来源, 与展示的名称
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'xxxxx@163.com'
gitlab_rails['gitlab_email_display_name'] = 'Gitlab'
测试发邮件:
gitlab-rails consoleNotify.test_email('319809430@qq.com', '邮件标题', '邮件正文').deliver_now
重载配置文件并重启gitlab
gitlab-ctl reconfigure
gitlab-ctl restart
查看日志
gitlab-ctl tail
root密码修改
[root@localhost ~]# gitlab-rails console -e production
--------------------------------------------------------------------------------
Ruby: ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
GitLab: 15.2.2 (4ecb014a935) FOSS
GitLab Shell: 14.9.0
PostgreSQL: 13.6
------------------------------------------------------------[ booted in 30.36s ]
Loading production environment (Rails 6.1.4.7)
irb(main):001:0> user = User.where(id: 1).first //id为root账户
=> #<User id:1 @root>
irb(main):002:0> user.password = '12345678' //设置密码
=> "12345678"
irb(main):003:0> user.password_confirmation = '12345678'
=> "12345678"
irb(main):004:0> user.save! //保存修改
=> true
irb(main):005:0> exit
添加域名后需要,使用ip端口不需要以下配置
nginx添加代理配置
location /gitlab/ {
proxy_pass http://10.17.65.104:10080/gitlab/;
client_max_body_size 100m;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto "https";
}
拉取方式:
https://{账号}:{密码}@domain.cn/gitlab/etl/etlserver.git
git clone https://root:12345678@domain.cn/gitlab/etl/etlserver.git
标签:部署,gitlab,smtp,rails,gltlab,小计,https,com,proxy From: https://blog.51cto.com/u_8452404/6457168