[原创]在Centos7上搭建私有的Gitlab服务器

简介: 前言Git作为后起之秀,在版本控制领域占据了头把交椅。Github作为托管式的代码仓库,从代码安全性和网络传输等各个方面考虑,对于个人和公司来讲,具有一定的局限性。Gitlab提供的不同版本的安装包,可以实现私有的Git服务器搭建。

前言

Git作为后起之秀,在版本控制领域占据了头把交椅。Github作为托管式的代码仓库,从代码安全性和网络传输等各个方面考虑,对于个人和公司来讲,具有一定的局限性。Gitlab提供的不同版本的安装包,可以实现私有的Git服务器搭建。

版本

Gitlab提供了Community Edition、Enterprise Edition Starter、Enterprise Edition Premium等不同版本的安装包。由于免费的关系,我们使用Community Edition版本进行学习。该版本有bitnami和GitLab CE Omnibus package两种安装包。
Gitlab官网下载地址:
https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-8.15.3-ce.0.el7.x86_64.rpm
bitnami下载地址:
https://bitnami.com/stack/gitlab/installer
由于天朝的原因,从gitlab.com中下载rpm文件比较慢。
附上清华镜像地址:
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/

环境

CentOS7.2(VMware10)(CentOS-7-x86_64-DVD-1611.iso)

Gitlab8.15(gitlab-ce-8.15.3-ce.0.el7.x86_64.rpm)

Git2.11(git-2.11.0.tar.gz)

官方教程

  1. Install and configure the necessary dependencies
    If you install Postfix to send email please select 'Internet Site' during setup. Instead of using Postfix you can also use Sendmail or configure a custom SMTP server and configure it as an SMTP server.
    On Centos 6 and 7, the commands below will also open HTTP and SSH access in the system firewall.
    sudo yum install curl policycoreutils openssh-server openssh-clients
    sudo systemctl enable sshd
    sudo systemctl start sshd
    sudo yum install postfix
    sudo systemctl enable postfix
    sudo systemctl start postfix
    sudo firewall-cmd --permanent --add-service=http
    sudo systemctl reload firewalld
  2. Add the GitLab package server and install the package
    curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
    sudo yum install gitlab-ce

    If you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using
    curl -LJO https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-XXX.rpm/download
    rpm -i gitlab-ce-XXX.rpm
  3. Configure and start GitLab
    sudo gitlab-ctl reconfigure

    如果以上提示缺少semanage模块
    请运行下面的命令安装selinux
    sudo yum install libsemanage-static libsemanage-devel

遗留问题

1. 汉化问题

对于管理员来说,使用英文界面略有困难。

2. 邮件配置问题

注册、找回密码、提交代码等各种需要发邮件的情况下,不能发送邮件。

3.使用SSH公私钥进行认证时,config文件配置问题

使用ssh-keygen -t rsa -C "name@domain.com"生成公私钥,并将私钥保存在~/.ssh目录,同时在gitlab管理页面将自己的公钥添加进去。
SSH keys允许自己的机器和gitlab服务器之间建立安全连接。
配置config文件,内容如下:
host gitlab_name
user git
hostname gitlab_server_host
port 22
identityfile ~/.ssh/name
在Eclipse中使用git进行clone项目时,可以使用以下地址:
// 协议默认为http,需要使用用户名、密码进行身份认证
http://192.168.111.129/root/demo.git

// 协议默认为空,使用公私钥进行身份认证。可修改协议为SSH,修改协议后,连接地址自动变为:ssh://git@192.168.111.129/root/demo.git
git@192.168.111.129:root/demo.git

可通过config文件指定多个gitlab服务器地址及其对应的公私钥,进行身份认证。
// 协议默认为空,使用公私钥进行身份认证。可修改协议为SSH,修改协议后,连接地址自动变为:ssh://gitlab_vm/root/demo.git
gitlab_vm:root/demo.git

作者: Candyメ奶糖

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
博文来源广泛,如原作者认为我侵犯知识产权,请尽快给我发邮件 359031282@qq.com联系,我将以第一时间删除相关内容。

目录
相关文章
|
2月前
|
数据可视化 Shell Linux
shell+crontab+gitlab实现ecs服务器文件的web展示
本文通过把ecs服务器上的文件定时上传至gitlab,实现文件的页面可视化和修改历史。技术点:shell、crontab、gitlab。
50 3
|
2月前
|
缓存 关系型数据库 MySQL
百度搜索:蓝易云【CentOS8服务器安装MySQL报错:no match mysql-community-server】
现在,你已经成功安装了MySQL服务器并解决了"no match mysql-community-server"的报错问题。祝你使用愉快!
43 1
|
3月前
|
Linux
CentOS7.9服务器一键脚本部署FRP内网穿透服务端与客户端
CentOS7.9服务器一键脚本部署FRP内网穿透服务端与客户端
217 0
|
3月前
|
Linux 网络安全
CentOS7服务器SSH登陆时自动显示服务器基础信息
CentOS7服务器SSH登陆时自动显示服务器基础信息
42 0
|
14天前
|
Linux
centos 查看服务器信息 版本cpu
centos 查看服务器信息 版本cpu
11 0
|
1月前
|
Oracle 关系型数据库 Linux
服务器Centos7 静默安装Oracle Database 12.2
服务器Centos7 静默安装Oracle Database 12.2
79 0
|
1月前
|
存储 弹性计算 Linux
阿里云ECS(CentOS镜像)安装docker
阿里云ECS(CentOS镜像)安装docker
380 0
|
3月前
|
Linux 网络安全 数据安全/隐私保护
centos宝塔远程服务器怎么链接?
【1月更文挑战第6天】centos宝塔远程服务器怎么链接?
191 2
|
3月前
|
存储 数据挖掘 Linux
服务器数据恢复—CentOS7操作系统服务器数据恢复案例
服务器数据恢复环境: 某品牌PowerEdge R730服务器+PowerVault MD3200存储,划分若干lun,操作系统版本是centos7,EXT4文件系统。 服务器故障&分析: 服务器在运行过程中自动关机且无法启动,服务器管理员对服务器进行修复后成功启动服务器,但服务器上原来的某个分区无法挂载。管理员将无法挂载的分区进行fsck修复&挂载,查看这个分区的数据发现部分文件丢失。
|
29天前
|
Ubuntu JavaScript 关系型数据库
在阿里云Ubuntu 20.04服务器中搭建一个 Ghost 博客
在阿里云Ubuntu 20.04服务器上部署Ghost博客的步骤包括创建新用户、安装Nginx、MySQL和Node.js 18.x。首先,通过`adduser`命令创建非root用户,然后安装Nginx和MySQL。接着,设置Node.js环境,下载Nodesource GPG密钥并安装Node.js 18.x。之后,使用`npm`安装Ghost-CLI,创建Ghost安装目录并进行安装。配置过程中需提供博客URL、数据库连接信息等。最后,测试访问前台首页和后台管理页面。确保DNS设置正确,并根据提示完成Ghost博客的配置。
在阿里云Ubuntu 20.04服务器中搭建一个 Ghost 博客