Ubuntu安装GitLab

在 Ubuntu 上安装 GitLab 的步骤如下。这里以 GitLab Community Edition(CE)为例:

前提条件

  1. 确保你的 Ubuntu 系统是 20.04 或更高版本。
  2. 确保你的系统满足 GitLab 的硬件要求。

步骤

  1. 更新系统包

    bash 复制代码
    sudo apt update
    sudo apt upgrade -y
  2. 安装依赖项

    bash 复制代码
    sudo apt install -y curl openssh-server ca-certificates tzdata perl
  3. 添加 GitLab 包仓库

    首先,安装 GitLab 的官方 GPG 密钥:

    bash 复制代码
    curl https://packages.gitlab.com/gpg.key | sudo apt-key add -

    然后,添加 GitLab 的源:

    bash 复制代码
    sudo tee /etc/apt/sources.list.d/gitlab_gitlab-ce.list <<EOF
    deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ $(lsb_release -cs) main
    EOF
  4. 更新包索引

    bash 复制代码
    sudo apt update
  5. 安装 GitLab

    使用以下命令安装 GitLab:

    bash 复制代码
    sudo apt install gitlab-ce
  6. 配置 GitLab

    安装完成后,运行以下命令来配置 GitLab:

    bash 复制代码
    sudo gitlab-ctl reconfigure
  7. 访问 GitLab

    安装和配置完成后,打开浏览器,访问你的服务器 IP 地址或域名。默认情况下,GitLab 会在 80 端口上运行。你可以通过以下 URL 访问:

    复制代码
    http://your_server_ip
  8. 设置管理员密码

    在你安装 GitLab 后,系统会生成一个默认的管理员账户,其用户名为 root,但初始密码不会直接显示在终端中,而是存储在 /etc/gitlab/initial_root_password 文件中。以下是你可以采取的步骤来获取和使用这个初始密码:

    你可以使用以下命令查看存储在文件中的初始密码:

    bash 复制代码
    sudo cat /etc/gitlab/initial_root_password //查看初始密码

    记下这个密码,因为你需要它来登录 GitLab。

其他配置

  • 如果你希望使用 HTTPS,建议安装和配置 SSL 证书。可以使用 Let's Encrypt 来获取免费的 SSL 证书。
  • 你可以根据需要调整 GitLab 的配置文件,通常位于 /etc/gitlab/gitlab.rb

维护和管理

  • 启动 GitLab:

    bash 复制代码
    sudo gitlab-ctl start
  • 停止 GitLab:

    bash 复制代码
    sudo gitlab-ctl stop
  • 检查 GitLab 状态:

    bash 复制代码
    sudo gitlab-ctl status

注意事项

  • GitLab 对系统资源的要求较高,确保你的服务器有足够的 CPU、内存和存储空间。
  • 定期备份 GitLab 数据。
相关推荐
运维全栈笔记1 分钟前
Linux安装配置Tomcat保姆级教程:从部署到性能调优
linux·服务器·中间件·tomcat·apache·web
dllmayday1 小时前
Linux 上用终端连接 WiFi
linux·服务器·windows
峥无2 小时前
Linux系统编程基石:静态库·动态库·ELF文件·进程地址空间全景图
linux·运维·服务器
用户2367829801683 小时前
从 chmod 755 说起:Unix 文件权限到底是怎么算的?
linux
Strugglingler3 小时前
【systemctl 学习总结】
linux·systemd·systemctl·journalctl·unit file
全球通史3 小时前
RDKS100 GPU量化环境配置
ubuntu
嵌入式×边缘AI:打怪升级日志4 小时前
100ASK-T113 Pro 开发板 Bootloader 完全开发指南
linux·ubuntu·bootloader
charlie1145141915 小时前
Linux 字符设备驱动:cdev、设备号与设备模型
linux·开发语言·驱动开发·c
handler015 小时前
Linux 内核剖析:进程优先级、上下文切换与 O(1) 调度算法
linux·运维·c语言·开发语言·c++·笔记·算法
zhouwy1135 小时前
Linux进程与线程编程详解
linux·c++