linux安装gitlab

文章详细描述了如何在Linux系统上下载并安装GitLabCE15.4.5的RPM包,包括将文件上传到/opt目录,使用rpm命令进行安装,以及安装过程中可能出现的NOKEY警告。安装完成后,文章指导读者修改GitLab配置文件,如external_url、time_zone、数据目录和并发设置,并通过gitlab-ctlreconfigure命令应用更改。此外,还涉及了防火墙端口的开放、服务的重启与自启,以及访问GitLab界面的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值