Ubuntu/CentOS 安装gitlab

  1. 直接用命令 sudo apt install gitlab-ce 安装最新版
    也可以用sudo apt-get install gitlab-ce=15.10.2-ce.0 指定要安装的版本,具体参考https://forum.gitlab.com/t/installing-older-versions-of-gitlab-on-ununtu/29507

彻底删除已经安装的gitlab:

如果已经安装,可以用下面的命令把原来版本卸载掉:

This worked for me in Ubuntu 16 and let me install an older version of gitlab: https://askubuntu.com/questions/824696/is-it-fine-to-remove-the-opt-gitlab-directory-manually-after-removing-the-gitl 735

Remove services
sudo gitlab-ctl uninstall

Clean any data generated by usage of the package
sudo gitlab-ctl cleanse

You may also want to remove any accounts you configured. To do so
sudo gitlab-ctl remove-accounts

Then remove the package using
sudo dpkg -P gitlab-ce

Furthermore, gitlab-ce uses these directories (as described here 1.6k)

/opt/gitlab holds application code for GitLab and its dependencies.

/var/opt/gitlab holds application data and configuration files that gitlab-ctl reconfigure writes to.

/etc/gitlab holds configuration files for omnibus-gitlab. These are the only files that you should ever have to edit manually.

/var/log/gitlab contains all log data generated by components of omnibus-gitlab.

So, First remove the package recommended way (Even if you need to reinstall it). You can then remove those data using rm safely.

Information found from omnibus-gitlab README page 1.6k


  1. 修改gitlab的端口:sudo vi /etc/gitlab/gitlab.rb
    `…

GitLab URL

##! URL on which GitLab will be reachable.
##! 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://192.168.1.157:9091’
…`

3.启动GitLab实例

sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
sudo gitlab-ctl status
  1. 用浏览器登录http://192.168.1.157/的时候出现如下错误,主要原因是puma的默认端口8080 被(Jenkins)占用了。
    可以用下面的命令修改默认端口:
    sudo vi /etc/gitlab/gitlab.rb
GitLab is taking too much time to respond

解决办法:
在这里插入图片描述
5. 查看GitLab默认root初始密码(尽快修改root密码)

sudo cat /etc/gitlab/initial_root_password
  1. GitLab项目域名或IP设置及修改,如果不修改这个地址,那么在自动clone生成的命令里面host的IP是不对的
sudo vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: 10.88.30.102
    port: 9091
    https: false

  1. CentOS 的gitlab安装请参考:https://blog.csdn.net/weixin_56270746/article/details/125427722

  2. 利用root初始密码登录后,可以通过页面修改初始密码
    在这里插入图片描述

  3. root 初始密码的修改,请参考:https://blog.csdn.net/weixin_56270746/article/details/125427722

参考链接:
安装命令:https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-gitlab-on-ubuntu-20-04
https://www.jianshu.com/p/6cd5eecd85db

解决问题:https://blog.csdn.net/qq_41332844/article/details/126837301

猜你喜欢

转载自blog.csdn.net/zhuguiqin1/article/details/130411615