cenos7搭建gitlab

git、github和gitlab的区别

git:是一种版本控制系统,是一个命令,是一种工具

gitlib:是基于实现功能的开发库

github:是一个基于git实现的在线代码仓库软件

 gitlib可以搭建一个类似于github一样的系统,一般用于企业或者学校等内部网络搭建私服。gitlab免费支持私人仓库,而github需要收费。如果公司团队开发的代码不想托管到github收费平台,就可以选择搭建公司gitlab服务。

搭建gitlab

安装ssh

sudo yum install -y curl policycoreutils-pythonopenssh-server

ssh服务设置开机自启动

sudo systemctl enable sshd

启动ssh服务

sudo systemctl start sshd

安装防火墙(如果已经安装了防火墙并且已经在运行状态,则可直接进行第6步)

yum install firewalld systemd -y

开启防火墙

service firewalld  start

添加http服务到firewalld,pemmanent表示永久生效,若不加--permanent系统下次启动后就会失效。

sudo firewall-cmd --permanent --add-service=http

重启防火墙

sudo systemctl reload firewalld

安装Postfix以发送通知邮件

sudo yum install postfix

postfix服务设置开机启动

sudo systemctl enable postfix

启动postfix

sudo systemctl start postfix

如果centos7没有安装wget,则安装wget命令

yum -y install wget

下载gitlab镜像

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

安装gitlab

rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

 如果出现了改图,则安装成功

修改gitlab配置文件指定服务器ip

vim  /etc/gitlab/gitlab.rb

修改external_url 'http://localhost',把localhost改成搭建gitlab的服务器ip地址

重置配置文件

gitlab-ctl reconfigure

重启gitlab

gitlab-ctl restart

gitlab创建项目

访问gitlab页面

直接在浏览器输入ip访问

第一次进入直接点修改密码

创建用户,点击New User

 

点击New group创建组

 创建项目

原文地址:https://www.cnblogs.com/raicho/p/11829451.html