Gitlab安装使用
Gitlab安装使用
1. 为什么要使用gitlab
Git的优点多多这里就不详细介绍了;
Git是版本控制系统,Github是在线的基于Git的代码托管服务;
Github有个小缺陷 (也不能算是缺陷吧), 就是你的repo(repository的缩写,表示“仓库”)都需要public(公开), 如果你想要创建private(私人)的repo, 那得付钱。
Gitlab正好解决这个缺陷,它可以部署到自己的服务器上,在上面创建免费的私人repo。
2. gitlab构成
- Nginx:静态web服务器。
- gitlab-shell:用于处理Git命令和修改authorized keys列表。(Ruby)
- gitlab-workhorse: 轻量级的反向代理服务器。(go)
- logrotate:日志文件管理工具。
- postgresql:数据库。
- redis:缓存数据库。
- sidekiq:用于在后台执行队列任务(异步执行)。(Ruby)
- unicorn:An HTTP server for Rack applications,GitLab Rails应用是托管在这个服务器上面的。(Ruby Web Server,主要使用Ruby编写)
3.安装
3.1 安装环境说明:
CentOS Linux release 7.6.1810 (Core)
IP:192.168.137.121
关闭selinux、firewalld
gitlab-ce-12.1.4
rpm包:下载地址
3.2 源码安装
3.2 rpm安装
下载&安装
# wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-12.1.4-ce.0.el7.x86_64.rpm/download.rpm # rpm -ivh gitlab-ce-12.1.4-ce.0.el7.x86_64.rpm #直接安装就好了,rpm包里会包含有gitlab所有依赖的服务
#安装完成后会有gitlab的logo显示
安装完成,如下所示:
rpm -ivh gitlab-ce-12.1.-ce..el7.x86_64.rpm
warning: gitlab-ce-12.1.-ce..el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Preparing... ################################# [%]
Updating / installing...
:gitlab-ce-12.1.-ce..el7 ################################# [%]
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
修改gitlab的url并执行reconfigure
#将url地址通过sed替换为本地ip
# egrep '^(external_url).*' /etc/gitlab/gitlab.rb # 查看配置
external_url 'http://gitlab.example.com' # sed -ri 's#^(external_url).*#\1 "http://192.168.137.121"#' /etc/gitlab/gitlab.rb # sed命令修改 # egrep '^(external_url).*' /etc/gitlab/gitlab.rb # 查看已经修改
external_url "http://192.168.137.121"
修改了gitlab.rb配置文件之后一定要执行reconfigure
gitlab-ctl reconfigure
执行reconfigure会经历一段漫长的等待,执行完成如下图:

3.4 docker方式安装
官方文档:https://docs.gitlab.com/omnibus/docker/#install-gitlab-using-docker-compose
说明:
- 使用汉化版镜像, 如果不适应可以换成官方原版镜像
gitlab/gitlab-ce:11.0.2-ce.0 - 项目初始配置+启动很慢, 需要一段时间, 日志中出现
Reconfigured表示启动成功 - 192.168.xxx.xxx 替换为宿主机的IP地址
- 初始管理员帐号密码:
root/lb80h&85 - 该配置为乞丐版, 内存占用2G+ (
worker_processes越多内存占用越大, 默认为 8G ) postgresql为容器中内置的数据库 ( 帐号:gitlab/gitlab), 如果没必要就不用暴露端口了- 邮箱填写用于发送找回密码和通知的发件人帐号 ( 收不到邮件? ), 不想配置就删掉相关配置好了, 不影响正常使用
4. gitlab-web配置
4.1 访问页面开始配置
http://192.168.137.111(默认端口为80)


使用谷歌自带的翻译显示中文

4.2 创建仓库
点击上图的“创建一个项目”

点击创建后将会提示你添加ssh公钥

# 先生成公钥
# ssh-keygen -t rsa
一路回车即可 #cat .ssh/id_rsa.pub,将公钥内容按下图添加

点击添加文件,文件名“README”, 内容:#test-jenkins


4.3 测试
项目地址获取

主机端操作:
[root@master git]# git clone git@192.168.137.121:root/test.git
Cloning into 'test'...
remote: Enumerating objects: , done.
remote: Counting objects: % (/), done.
remote: Total (delta ), reused (delta )
Receiving objects: % (/), done.
[root@master git]# ll
total
drwxr-xr-x root root Aug : test
[root@master git]# ll test/
total
-rw-r--r-- root root Aug : README
[root@master git]# echo > test/.txt
[root@master git]# git add test/.txt
[root@master git]# git commit -m "and 1.txt" [root@master test]# git push
Counting objects: , done.
Delta compression using up to threads.
Compressing objects: % (/), done.
Writing objects: % (/), bytes | bytes/s, done.
Total (delta ), reused (delta )
To git@192.168.137.121:root/test.git
3b2a082..ca9283d master -> master
完成

5. 错误解决
- 访问web页面时出现502错误
gitlab-ctl start
gitlab-ctl reconfigure 在启动gitlab的时候执行reconfigure之后就可以了。
参考文献
https://www.jianshu.com/p/b04356e014fa
https://www.jianshu.com/p/7e8037c63d63
Gitlab安装使用的更多相关文章
- GitLab安装说明
GitLab,是一个使用 Ruby on Rails 开发的开源应用程序,与Github类似,能够浏览源代码,管理缺陷和注释,非常适合在团队内部使用. gitlab是基于Ruby on Rails的, ...
- Gitlab安装、汉化及使用
环境:centos 关闭防火墙和selinux [root@Gitlab ~]# setenforce [root@Gitlab ~]# service iptables stop && ...
- git\CentOS6.5中gitlab安装教程
一.Git 起源: Git是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目. Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本 ...
- Ubuntu gitlab安装文档及邮件通知提醒配置
1.安装依赖包,运行命令 sudo apt-get install curl openssh-server ca-certificates postfix 2.由于gitlab官方源可能被“墙”,首先 ...
- gitlab安装随记
gitlab安装 配置yum源 sudo vim /etc/yum.repos.d/gitlab-ce.repo 按照网上别人的例子,修改为清华的源 [gitlab-ce] name=Gitlab C ...
- CentOS 7 环境下GitLab安装及基本配置
新实验室要求重新建设GitLab,对于我来讲,是第一次有机会当元老参与实验室的建设.下面分享我自己的实测经验: 1. 安装依赖软件并设置开机启动 yum install curlpolicycoreu ...
- GitLab安装及使用
GitLab是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目. GitLab拥有与Github类似的功能,能够浏览 ...
- gitlab之一: gitlab安装配置使用
参考: gitlab 安装和配置 gitlab下载地址: https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/ 官方教程: https://about.gitl ...
- Gitlab安装以及汉化
Gitlab安装以及汉化 系统环境: CentOS 7.5 IP:192.168.1.2 关闭selinux.firewalld gitlab-ce-10.8.4 rpm包:下载地址 一.下载并安装g ...
- GITLAB安装笔记
CentOS 7 最小安装后操作 设置时区timedatectl set-timezone Asia/Shanghai 添加 Gitlab 清华源 vi /etc/yum.repos.d/gitlab ...
随机推荐
- 蒲公英 · JELLY技术周刊 Vol.16 谷歌首个线上 Web 开发者大会
蒲公英 · JELLY技术周刊 Vol.16 近期,谷歌有史以来的第一次线上谷歌 Web 开发者大会,Web Vitals.PWA.DevTools 和 Lighthouse 6.0 等一系列特性或产 ...
- HTML <html> manifest 属性
实例 带有缓存 manifest 的 HTML 文档(用于离线浏览): <!DOCTYPE HTML><html manifest="demo.appcache" ...
- 4.28 省选模拟赛模拟赛 最佳农场 二维卷积 NTT
第一次遇到二维卷积 不太清楚是怎么做的. 40分暴力比对即可. 对于行为或者列为1时 容易想到NTT做快速匹配.然后找答案即可. 考虑这是一个二维的比对过程. 设\(f_{i,j}\)表示以i,j为右 ...
- CF R 209 div 2 CF359B Permutation 构造
LINK:Permutation 休闲一下 开了一道构造题. 看起来毫无头绪 其实仔细观察第二个条件 0<=2k<=n. 容易想到当n是奇数的时候 k的范围更小 再手玩一下第一个条件 容易 ...
- CF R 633 div 1 1338 C. Perfect Triples 打表找规律
LINK:Perfect Triples 初看这道题 一脸懵逼.. 完全没有思路 最多就只是发现一点小规律 即. a<b<c. 且b的最大的二进制位一定严格大于a b的最大二进制位一定等于 ...
- springMVC 获取request参数
持续补充............ GET 常用的:@PathVariable @RequestParam request.getParameter POST 常用的:@ResponseBody ...
- asp.net 远程模型验证
有这样一些场景,我们需要模型验证,某些字段不允许重复,但是又不希望在数据访问层增加一堆额外逻辑判断.我们需要数据访问层简洁,这种模型验证在进去Action之前,验证不通过直接告诉前端. 一个特性,继承 ...
- elasticsearch技术解析与实战ES
elasticsearch技术解析与实战ES 下载地址: https://pan.baidu.com/s/1NpPX05C0xKx_w9gBYaMJ5w 扫码下面二维码关注公众号回复100008 获取 ...
- C++基础面试题及答案
C++ C++ 和C的主要区别 C语言是面向过程编程,C++是面向对象编程,C++ 完全兼容C C++有哪些特性,简述对他们的理解 封装.继承.多态 封装 将的事物抽象成一个个集合(也就是所说的类), ...
- 4、Java基本数据类型
一.基本数据类型 1.基本数据类型 JAVA中一共有八种基本数据类型,他们分别是 byte.short.int.long.float.double.char.boolean 类型 型别 字节 取值范围 ...