使用RPM包部署
这里使用的系统是CentOS8, 清华源:mirrors.tuna.tsinghua.edu.cn/gitlab-ce/
- ## 下载软件包
- wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-13.7.0-ce.0.el8.x86_64.rpm
- ## 安装
- rpm -ivh gitlab-ce-13.7.0-ce.0.el8.x86_64.rpm
- ## 日志输出
- warning: gitlab-ce-13.7.0-ce.0.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID f27eab47: NOKEY
- Verifying... ################################# [100%]
- Preparing... ################################# [100%]
- Updating / installing...
- 1:gitlab-ce-13.7.0-ce.0.el8 ################################# [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=13-7
配置
安装完成后可以发现以下信息,需要修改gitlab.rb配置文件。
编辑 /etc/gitlab/gitlab.rb 可以看到默认的域名配置。如果是学习使用则可以继续使用该域名,不用再做其他配置。
- 32 external_url 'http://gitlab.example.com'
如果是需要修改该域名,则需要这样做:
- ## 修改gitlab.rb
- external_url 'http://gitlab.devops.com'
- ## 重新配置
- gitlab-ctl reconfigure
服务运行控制
- ## 启动服务
- gitlab-ctl start
- ## 重启服务
- gitlab-ctl restart
- ## 查看状态
- gitlab-ctl status
- ## 停止
- gitlab-ctl stop
访问测试
由于使用的是gitlab.devops.com 这个域名,需要在dns或者本地hosts中添加该解析记录。
- vi /etc/hosts
- 192.168.1.200 gitlab.devops.com
浏览器访问http://gitlab.devops.com/, 设置用户密码。默认用户root。这里设置的密码是devops1234。
能够正常进入首页即可,安装完成。
扩展:使用外部PG数据库
使用docker快速启动PG
- mkdir /root/gitlab/pgdata
- docker run --name dockerPG11 \
- -e POSTGRES_PASSWORD=postgres \
- -v /root/gitlab/pgdata:/var/lib/postgresql/data \
- -p 54322:5432 \
- -d postgres:11.5
- ## 创建数据库
- psql -U postgres -h localhost -p 54322
- psql (11.5 (Debian 11.5-3.pgdg90+1))
- Type "help" for help.
- postgres=# create role gitlab login encrypted password 'gitlab';
- CREATE ROLE
- postgres=# create database gitlabhq_production owner=gitlab ENCODING = 'UTF8';
- CREATE DATABASE
- postgres=# \c gitlabhq_production
- You are now connected to database "gitlabhq_production" as user "postgres".
- gitlabhq_production=# CREATE EXTENSION IF NOT EXISTS btree_gist;
- CREATE EXTENSION
- gitlabhq_production=# CREATE EXTENSION IF NOT EXISTS pg_trgm;
- CREATE EXTENSION
- postgres=# \q
使用postgres用户创建 EXTENSION, btree_gist, pg_trgm。否则会遇到如下错误:
修改gitlab.rb配置文件
编辑/etc/gitlab/gitlab.rb
- 654 gitlab_rails['db_adapter'] = "postgresql"
- 655 gitlab_rails['db_encoding'] = "utf8"
- 656 # gitlab_rails['db_collation'] = nil
- 657 gitlab_rails['db_database'] = "gitlabhq_production"
- 658 gitlab_rails['db_username'] = "gitlab"
- 659 gitlab_rails['db_password'] = "gitlab"
- 660 gitlab_rails['db_host'] = "192.168.1.200"
- 661 gitlab_rails['db_port'] = 54322
- 1025 postgresql['enable'] = false
- ## 配置更新
- gitlab-ctl reconfigure
验证配置生效
- cat /opt/gitlab/embedded/service/gitlab-rails/config/database.yml
- # This file is managed by gitlab-ctl. Manual changes will be
- # erased! To change the contents below, edit /etc/gitlab/gitlab.rb
- # and run `sudo gitlab-ctl reconfigure`.
- production:
- adapter: postgresql
- encoding: utf8
- collation:
- database: gitlabhq_production
- username: "gitlab"
- password: "gitlab"
- host: "192.168.1.200"
- port: 54322
本文转载自微信公众号「程序员历小冰」,转载本文请联系程序员历小冰公众号。 疫...
struts json 类型异常返回到js弹框问题解决办法 当struts 框架配置了异常时 例如...
背景 该问题来自某客户,据描述,他们在部署 MySQL 主从复制时,有时候仅在主库...
文章目录 关系数据库 关系数据库简介 关系数据结构及形式化定义 关系 关系模式 ...
六、XML展望 任何一项新技术的产生都是有其需求背景的,XML的诞生是在HTML遇到不...
在 2021 年,人们喜欢 Linux 的理由比以往任何时候都多。在这个系列中,我将分享...
下面是ajax代码和Controller层代码,期初以为是后台程序写错了。 $("#sourcefile...
微软官方博客于 2 月初再次发布提示,将会在 3 月 9 日停止对经典版 Edge 浏览器...
php实现微信支付 微信支付文档地址: https://pay.weixin.qq.com/wiki/doc/api/i...
前言 我们在使用ajax异步的提交多选框得到需要操作的对象的id,这时我们可以把每...