gitlab的介绍与安装配置
#gitlab的介绍与安装配置
目录
一:Gitlab概述
二:GitLab和GitHub的区别
三:搭建GitLab平台与使用
一:Gitlab概述
GitLab概述:
是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。
Ruby on Rails 是一个可以使你开发、部署、维护 web 应用程序变得简单的框架。
GitLab拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。
GitLab官网:https://about.gitlab.com/
二:GitLab和GitHub的区别
相同点: 二者都是基于web的Git仓库,在很大程度上GitLab是仿照GitHub来做的,它们都提供了分享开源项目的平台,为开发团队提供了存储、分享、发布和合作开发项目的中心化云存储的场所。
不同点:
1、GitHub如果要使用私有仓库,是需要付费的。GitLab可以在上面创建私人的免费仓库。
2、GitLab让开发团队对他们的代码仓库拥有更多的控制,相比于GitHub,它有不少的特色:允许免费设置仓库权限;允许用户选择分享一个project的部分代码;允许用户设置project的获取权限,进一步的提升安全性;可以设置获取到团队整体的改进进度;通过innersourcing让不在权限范围内的人访问不到该资源。
从代码私有性方面来看,有时公司并不希望员工获取到全部的代码,这个时候GitLab无疑是更好的选择。但对于开源项目而言,GitHub依然是代码托管的首选。
git相关概念:
git 是一种版本控制系统,是一个命令,是一种工具
gitlib 是用于实现git功能的开发库
github 是一个基于git实现的在线代码托管仓库,包含一个网站界面,向互联网开放
gitlab 是一个基于git实现的在线代码仓库托管软件,一般用于在企业内网搭建git私服
注:gitlab-ce 社区版 ;gitlab-ee是企业版,收费
三、搭建GitLab平台
3.1、环境介绍
系统:CentOS7.5X64
#配置yum源
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
# 永久关闭selinux(重启也生效)
sed -i s#SELINUX=enforcing#SELINUX=disabled#g /etc/selinux/config
cat /etc/selinux/config |grep SELINUX=disabled
setenforce 0
getenforce
#下载gitlab 最新版
https://packages.gitlab.com/gitlab/gitlab-ce/
#安装常用软件
yum install wget net-tools lrzsz git -y
#下载gitlab包
https://packages-gitlab-com.s3-accelerate.amazonaws.com/7/8/el/7/package_files/41580.rpm?AWSAccessKeyId=AKIAJ74R7IHMTQVGFCEA&Signature=wfwx1j3wmQVT7jZPl7rhx7U1zyc%3D&Expires=1559747825
3.2、安装环境初始化
yum install curl policycoreutils openssh-server openssh-clients postfix -y
3.3、默认,使用 Postfix 发送邮件
[root@gitlab tools]# systemctl start post
[root@gitlab tools]# systemctl enable postfix.service
3.4、关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
#安装依赖包和gitlab
[root@gitlab tools]# yum install policycoreutils-python
[root@gitlab tools]# rpm -ivh gitlab-ce-11.11.2-ce.0.el7.x86_64.rpm
warning: gitlab-ce-11.11.2-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:gitlab-ce-11.11.2-ce.0.el7 ################################# [100%]
*. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/
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
3.5、配置并启动GitLab
vim /etc/gitlab/gitlab.rb
改:13 external_url 'http://gitlab.example.com'
为:13 external_url 'http://gitlab.com'
#重新配置应用程序。相当于初始化一下
gitlab-ctl reconfigure
gitlab-ctl status
#gitlab的管理
关闭gitlab: # gitlab-ctl stop
启动gitlab: # gitlab-ctl start
重启gitlab: # gitlab-ctl restart
备注:默认第一次启动需要设置密码的: 这里配置密码为xxxxxx。
3.6、访问网站
#配置域名解析(windows)
c:\windows\system32\drivers\etc
192.168.56.120 gitlab.com
#访问网站
http://gitlab.com
username: root
password: xxxxxx
3.7 设置gitlab的群组
Group name: test
Group URL:test
Group description (optional):test object
Visibility level:Internal(私有的)
Create group
参考:https://blog.51cto.com/flyfish225/2145495

浙公网安备 33010602011771号