Ubuntu 20.04 安装配置 GitLab
Ubuntu 20.04 安装配置 GitLab
GitLab
GitLab 官网:https://about.gitlab.com/
GitLab CE 或 Community Edition 是一个开源应用程序,主要用于托管Git存储库,以及其他与开发相关的功能,如问题跟踪。它旨在使用您自己的基础架构进行托管,并为您的开发团队提供部署内部存储库的灵活性,与用户交互的公共方式,或者为贡献者提供托管自己项目的方法。
GitLab 项目使用简单的安装机制在您自己的硬件上设置 GitLab 实例变得相对简单。
GitLab 是一个基于 Git 实现的在线代码仓库托管软件,我们可以用 gitlab 搭建一个类似于 Github 的系统,一般用于在企业、学校等内部网络搭建 git 私服。
功能:Gitlab 是一个提供代码托管、提交审核和问题跟踪的代码管理平台。
版本:GitLab 分为社区版(CE) 和企业版(EE)。
配置:建议CPU2核,内存2G以上。
Gitlab 的服务构成:
Nginx:静态 web 服务器。
gitlab-shell:用于处理 Git 命令和修改 authorized keys 列表。(Ruby)
gitlab-workhorse:轻量级的反向代理服务器。(go)
GitLab Workhorse 是一个敏捷的反向代理。它会处理一些大的 HTTP 请求,比如文件上传、文件下载、Git push/pull 和 Git 包下载。其它请求会反向代理到 GitLab Rails 应用,即反向代理给后端的 unicorn。
logrotate:日志文件管理工具。
postgresql:数据库。
redis:缓存数据库。
sidekiq:用于在后台执行队列任务(异步执行)。(Ruby)
unicorn:An HTTP server for Rack applications,GitLab Rails 应用是托管在这个服务器上面的。
配置服务器环境
安装 ssh 服务端
sudo apt-get openssh-server
配置防火墙
sudo ufw allow ssh
更换国内源
sudo cp /etc/apt/sources.list /etc/apt/sources.list-baksudo vi /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
sudo apt-get update -y
sudo apt-get upgrade -y
GitLab 官方安装文档
https://about.gitlab.com/install/#ubuntu
1. 安装 GitLab 依赖软件
sudo apt-get update -y
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
Next, install Postfix to send notification emails.
If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.
## 此处可根据需要,选择安装
sudo apt-get install -y postfix
安装 postfix(邮件服务器)时可能出现激活 gitlab 邮箱配置,选择 Internet 站点那个选项,输入发送邮件的目的邮箱。
During Postfix installation a configuration screen may appear.
Select 'Internet Site' and press enter.
Use your server's external DNS for 'mail name' and press enter.
If additional screens appear, continue to press enter to accept the defaults.
2. 安装 GitLab
添加 GitLab 源
cd ~
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed
100 5933 100 5933 0 0 4027 0 0:00:01 0:00:01 --:--:-- 4030
Detected operating system as Ubuntu/focal.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/gitlab_gitlab-ce.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.The repository is setup! You can now install packages.
安装 GitLab
sudo apt-get install gitlab-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:gitlab-ce
0 upgraded, 1 newly installed, 0 to remove and 13 not upgraded.
Need to get 942 MB of archives.
After this operation, 2,546 MB of additional disk space will be used.
Get:1 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal/main amd64 gitlab-ce amd64 14.2.3-ce.0 [942 MB]
Fetched 942 MB in 8min 58s (1,750 kB/s)
Selecting previously unselected package gitlab-ce.
(Reading database ... 186560 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_14.2.3-ce.0_amd64.deb ...
Unpacking gitlab-ce (14.2.3-ce.0) ...
Setting up gitlab-ce (14.2.3-ce.0) ...
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 reconfigureFor a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.mdHelp 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=14-2
3、更新 GitLab 配置文件
sudo vi /etc/gitlab/gitlab.rb
进入 vi 之后,在 vi 中输入下列命令,查找修改的位置。
/"你要搜索的字符串"
按下回车后锁定到第一个查询结果,使用 n 查找下一个,N 查找上一个。
找到修改位置后输入 i 进入修改状态(后为编辑状态,不详述)。
# 设置访问链接
external_url 'http://{你的IP}'
执行配置文件
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
常用命令
命令 | 作用 |
---|---|
gitlab-ctl reconfigure | 修改 gitlab.rb 文件之后重新加载配置 |
gitlab-ctl status | 查看 GitLab 状态 |
gitlab-ctl start | 启动 GitLab |
gitlab-ctl stop | 停止 GitLab |
gitlab-ctl restart | 重启 GitLab |
gitlab-ctl tail | 查看所有日志 |
gitlab-ctl tail nginx/gitlab_acces.log | 查看 nginx 访问日志 |
gitlab-ctl tail postgresql | 查看 postgresql 日志 |
4、初始化 GitLab
访问配置链接登录,需要先对账号进行初始化。
## 进入 GitLab 控制台sudo gitlab-rails console
输入以下命令,修改 root 用户密码。
--------------------------------------------------------------------------------Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]GitLab: 14.2.3 (2324101daeb) FOSSGitLab Shell: 13.19.1PostgreSQL: 12.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.3.2)
## 查找与切换账号(User.all 可以查看所有用户)
irb(main):001:0> user = User.where(id:1).first
=> #<User id:1 @root>
## 设置密码为12345678
irb(main):002:0> user.password ='12345678'
=> "12345678"
## 再次设置密码为12345678
irb(main):003:0> user.password_confirmation ='12345678'
=> "12345678"
## 保存
irb(main):004:0> user.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: 56d12fe2-f90f-484e-bfe4-6327d5642934) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f3a17818a50 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
## 退出
irb(main):005:0> exit
5、通过浏览器访问 GitLab
Ubuntu 20.04 安装配置 GitLab相关推荐
- Ubuntu 20.04 安装配置nginx + PHP
步骤 ## 先清除干净相关的软件,例如apache.php.nginx本身 sudo apt update sudo apt-get autoremove --purge php-fpm sudo ...
- ubuntu 20.04安装本地代码管理gitlab
这几天要搭一个gitlab的服务器,用于管理本组代码,然后网上搜到有很多错的地方,所以更新一篇我找到的准确的内容,帮助大家跳过坑 1.U盘启动盘安装ubuntu 20.04,安装好之后切换到aliyu ...
- Ubuntu 20.04安装、显卡驱动配置及搜狗输入法配置(U盘离线安装、vi编辑器,esc ZZ,tty3模式)(一)
小白装Ubuntu20.04-系列记录(一) 目录 小白装Ubuntu20.04-系列记录(一) Ubuntu 20.04安装 显卡驱动配置(U盘离线安装.vi编辑器,esc ZZ,tty3模式) 搜 ...
- Ubuntu 20.04安装Ros Noetic及Ubuntu 18.04安装ROS Melodic(两版本详细填坑)
Ubuntu 20.04安装Ros Noetic及18.04安装ROS Melodic 表1-1 ROS的历史版本 1. 设置安装源 2. 添加秘钥 3. 更新列表 4. 开始安装 5. 配置ROS环 ...
- ubuntu 20.04安装各类软件
ubuntu 20.04安装各类软件 一.前言 ubuntu 20.04安装后,我输入gcc -v,出现了下面的情况,差点裂开了,20.04居然没有自带gcc编译器,以前安装的版本12.04 16.0 ...
- ubuntu 20.04 安装ibus-rime输入法
ubuntu 20.04 安装ibus-rime输入法 为什么安装这个输入法 ibus-rime 安装 使用命令安装 基本设置 为什么安装这个输入法 没有安装搜狗输入法是因为安装完搜狗输入法之后再安装 ...
- ubuntu 20.04 安装obs 录屏软件
obs是一个非常好用的录屏软件,我们在windows安装和使用是非常的简单,但是在ubuntu安装还是比较麻烦的,需要使用命令行,还需要很多的依赖. 修改源 deb http://archive.ub ...
- Ubuntu 20.04 安装Metasploit msfconsole
Ubuntu 20.04 安装Metasploit msfconsole Ubuntu安装Metasploit msfconsole sudo wget https://raw.githubuserc ...
- ubuntu 20.04 安装synergy 记录
ubuntu 20.04 安装synergy 记录 安装linux版时的问题 qt4 libcurl3 安装完启动时出现警告 synergy下载要收费,不过可以在csdn下载到资源! 安装linux版 ...
最新文章
- 全国大学生智能汽车竞赛介绍-2020
- 《软件工程概论》第二章核心内容
- Anaconda配置的环境里面增加第三方库的方法
- 【BZOJ2229】【ZJOI2011】最小割
- php 密码过滤,PHP实践教程之过滤、验证、转义与密码详解
- 模拟扑克牌随机选择(Java)
- mysql不带加密模式jar包_Spring boot jar包加密(防止放在客户端反编译)
- Win10 IoT Core 更改密码(PowerShell)
- varchar与varchar2区别
- 【BIM入门实战】Navisworks2018简体中文安装教程(附安装包下载)
- 健康体检管理系统源码(PEIS) 医院系统源码
- 大一作业HTML网页作业:中华传统文化题材网页设计5页(纯html+css实现)
- 【HTML】讲讲对HTML5的语义化的理解
- 在 Windows 中保存和恢复桌面图标布局
- gin binding方法汇总
- java基础/接口与继承1(0.96万字)
- MacBook上有哪些值得下载的软件?
- 什么牌子的蓝牙耳机音质好?2022好音质蓝牙耳机推荐
- Java筑基18-布置作业啦(考查抽象类、内部类、工厂模式等)
- QT基于mysql数据库的链接-全网最强万能通用法