gitlab搭建安装
Gitlab安装
系统默认debian12
系统纯干净
官网下载地址
下载deb包
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_16.6.0-ce.0_amd64.deb/download.deb
安装gitlab包
dpkg -i gitlab-ce_16.6.0-ce.0_amd64.deb
配置文件
gitlab配置文件
vim /etc/gitlab/gitlab.rb
主要修改
邮件通知
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "2911074976@qq.com"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_domain'] = "smtp.qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = '2911074976@qq.com'
gitlab_rails['smtp_pool'] = false
配置时区
gitlab_rails['time_zone'] = 'Asia/Shanghai'
设置ssl
nginx['enable']=true
nginx['redirect_http_to_https']=true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.pem"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.key"
gitlab 命令
gitlab-rails console
测试邮箱设置
Notify.test_email('2911074976@qq.com','Message subject','Message body').deliver_now
sudo gitlab-ctl reconfigure
重新加载配置,每次修改/etc/gitlab/gitlab.rb文件之后执行
sudo gitlab-ctl status
查看 GitLab 状态
sudo gitlab-ctl start
启动 GitLab
sudo gitlab-ctl stop
停止 GitLab
sudo gitlab-ctl restart
重启 GitLab
sudo gitlab-ctl tail
查看所有日志
sudo gitlab-ctl tail nginx/gitlab_acces.log
查看 nginx 访问日志
sudo gitlab-ctl tail postgresql
查看 postgresql 日志
密码设置
默认密码在/etc/gitlab/initial_root_password
1)切换到相应路径下
cd /opt/gitlab/bin/
2)打开控制台
sudo gitlab-rails console -e production
3)查询用户账号信息并赋值给u
u=User.where(id:1).first
4)设置该用户名的密码(密码最少8位)
u.password=12345678
5)确认密码
u.password_confirmation=12345678
6)保存信息(最后有个叹号)
u.save!
开机自启
启用 Gitlab开机自启动 :systemctl enable gitlab-runsvdir.service
禁止 Gitlab 开机自启动:systemctl disable gitlab-runsvdir.service
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果