linux安装gitlab

linux安装gitlab

下载gitlab

https://packages.gitlab.com/gitlab/gitlab-ce

我下载的是 gitlab-ce-15.4.5-ce.0.el7.x86_64.rpm el/7版本

下载好的文件上传到 /opt文件夹 (文件大小1.05G)

安装

默认会安装到 /opt文件中 会出现 gitlab文件夹

rpm -ivh /opt/gitlab-ce-15.4.5-ce.0.el7.x86_64.rpm
[root@bogon opt]# rpm -ivh /opt/gitlab-ce-15.4.5-ce.0.el7.x86_64.rpm
警告:/opt/gitlab-ce-15.4.5-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 I                                                                                                                              D f27eab47: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:gitlab-ce-15.4.5-ce.0.el7        ################################# [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.



     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=15-4

修改配置

修改 /etc/gitlab/gitlab.rb 配置文件

# 修改 external_url 'http://gitlab.example.com'   改为你的IP:端口号
external_url 'http://192.168.230.129:8989'

# 修改 gitlab_rails['time_zone'] = 'UTC'
gitlab_rails['time_zone'] = 'Asia/Shanghai'

# 添加
git_data_dirs({
    "default" => {
       "path" => "/usr/local/gitlab/data"
    },
    "alternative" => {
       "path" => "/usr/local/gitlab/data/backup"
    }
})

# 添加  最大并发量
sidekiq['max_concurrency'] = 20
postgresql['shared_buffers'] = "256MB"
# 添加  最大工作进程
postgresql['max_worker_processes'] = 8
# 添加  端口号,与上面设置的 external_url 的端口保持一致
nginx['listen_port'] = 8989
# 添加  关闭监控(提高性能)
prometheus_monitoring['enable'] = false

default: 数据主存储路径;

alternative: 数据存储备份路径,为避免因磁盘损坏丢失源码,故添加数据备份路径;

重新加载配置

# 估计5分钟左右
gitlab-ctl reconfigure

重启

gitlab-ctl restart
 
# 查看状态 
gitlab-ctl status

# 查看日志
gitlab-ctl tail

开机自启

systemctl enable gitlab-runsvdir.service

开放端口

# 开放8080端口
firewall-cmd --zone=public --add-port=8989/tcp --permanent 
# 重启防火墙
firewall-cmd --reload
# 查看端口号是否开启
firewall-cmd --query-port=8989/tcp

访问界面

http://192.168.230.129:8989

用户名: root

密码: /etc/gitlab/文件夹下 有 initial_root_password 文件,里面有密码 登陆后记得修改密码

Settings -> Preferences -> Localization -> Language -> 简体中文

Settings -> Preferences -> Localization -> password

你可能感兴趣的:(Linux,linux,gitlab,运维)