GitLab安装-Linux

4/26/2022 运维版本控制GitGitLab

# GitLab使用教程

GitLab使用教程 (opens new window)

# GitLab安装

安装GitLab【Linux系统】参考1 (opens new window)

安装GitLab【Linux系统】参考2 (opens new window)

Gitlab初始密码存放在

/etc/gitlab/initial_root_password`
1

该密码在首次执行reconfigure后24小时候自动删除。

Gitlab启用开机自启动:

systemctl enable gitlab-runsvdir.service
1

Gitlab禁止开机自启动:

systemctl disable gitlab-runsvdir.service
1

GitLab重新配置

gitlab-ctl reconfigure
1

GitLab重启服务

gitlab-ctl restart
1

# GitLab中启用相对URL

修改 external_url

vim /etc/gitlab/gitlab.rb
1
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
##!
##! Note: During installation/upgrades, the value of the environment variable
##! EXTERNAL_URL will be used to populate/replace this value.
##! On AWS EC2 instances, we also attempt to fetch the public hostname/IP
##! address from AWS. For more details, see:
##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
external_url 'http://server.accother.com:8008/gitlab'
1
2
3
4
5
6
7
8
9

重新配置GitLab,使更改生效

gitlab-ctl reconfigure
1

重启GitLab服务

gitlab-ctl restart
1

查看url配置是否生效:

cat /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
1
  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: server.accother.com
    port: 80
    https: false
    
    ......

    # WARNING: See config/application.rb under "Relative url support" for the list of
    # other files that need to be changed for relative url support
    relative_url_root: /gitlab
1
2
3
4
5
6
7
8
9
10
11
12

# GitLab修改Puma端口 解决8080端口冲突 (opens new window)

# GitLab修改clone地址

因为配置了域名访问GitLab,但是在项目clone这里,显示的还是ip地址,并且还带端口。 在这里插入图片描述 修改方法:

vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
1

在这里插入图片描述

重启GitLab服务(不执行reconfigure否则会被覆盖)

gitlab-ctl restart
1

# GitLab服务器邮箱配置,实现自动发送邮件

配置Gitlab服务器邮箱 (opens new window)

# GitLab迁移/修改代码仓存放位置

迁移/修改gitlab代码仓存放位置 (opens new window)

# GitLab完全卸载删除

停止Gitlab

 gitlab-ctl stop
1

卸载Gitlab

 rpm -e gitlab-ce` or `yum remove gitlab-ce
1

查看Gitlab进程

 ps aux | grep gitlab
1

杀掉第一个进程,根据上一步结果进行操作

 kill -9 进程号
1

删除所有包含gitlab的文件

find / -n gitlab | xargs rm -rf
1
上次更新时间: 6/16/2023, 10:07:02 AM