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 ...
随机推荐
- 谁来教我渗透测试——VMware工具安装和使用
今天我们继续渗透测试学习系列了,昨天我们看了基础概念,今天我们来学习一下渗透测试必备的功能VMware安装. 首先我们下载好VMware workstation Pro的安装包.可以在百度上直接百度下 ...
- 命令 chatter Lsaattr dirname Basename
命令 chatter 锁定文件,不能删除 不能更改 +i -i Lsaattr 查看文件加密信息 dirname 显示父目录 Basename 显示最后的 ...
- iframe和DataForm
一.iframe使用 iframe在一个页面中,相当于整个window窗口的子窗口,可通过页面的元素结构查看. <div> <p>学习iframe</p> < ...
- Ribbon 负载规则替换
1 添加规则类: 注意: 官方文档明确给出了警告: 这个自定义配置类不能放在 @ComponentScan 所扫描的当前包下以及子包下,否则自定义的配置类就会被所有的 Ribbon 客户端所共享,达不 ...
- github提交报错
github正确提交步骤 https://www.cnblogs.com/alex-415/p/6912294.html 可能的错误 提交前没有先pull,主要的原因是在创建repository的时候 ...
- Python os.ttyname() 方法
概述 os.ttyname() 方法用于返回一个字符串,它表示与文件描述符fd 关联的终端设备.如果fd 没有与终端设备关联,则引发一个异常.高佣联盟 www.cgewang.com 语法 ttyna ...
- HTML 统一资源定位器(Uniform Resource Locators)
HTML 统一资源定位器(Uniform Resource Locators) URL 是一个网页地址.高佣联盟 www.cgewang.com URL可以由字母组成,如"runoob.co ...
- 关于SqlServer那些事1(回归基础)
即将实习,回归基础总结,希望可以再好好打磨一下基础的一些东西 关于如何在重新修改表结构时该变其权限设置 步骤: 点击工具 进入选项 设计器 取消勾选阻止保存要求重新创建表的更改 关于创建创建数据库以及 ...
- .NET三层架构各项目之间的引用关系及如何添加引用?
1.1三层之间的引用 整个.NET框架的项目创建完成之后,在开发之前,还需要建立各个项目之间的引用关系,以便在编写C#业务逻辑代码时调用相关项目的类库. 1.1.1 引用关系规则 .NET三层架构中的 ...
- Chrome-AdGuard 无与伦比的广告拦截扩展
一款无与伦比的广告拦截扩展,对抗各式广告与弹窗. AdGuard 广告拦截器可有效的拦截所有网页上的所有类型的广告,甚至是在 Facebook.Youtube 以及其他万千网站上的广告! AdGuar ...