首页 > 系统相关 >Centos7搭建Gitlab服务器

Centos7搭建Gitlab服务器

时间:2023-01-05 15:11:18浏览次数:58  
标签:gitlab -- Gitlab Centos7 yum ctl 服务器 docker 安装

GitLab介绍

GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的Web服务。

官方网站:https://about.gitlab.com/

安装配置需求:2.5GB的存储空间(SSD更好),推荐4核CPU(自测或使用人不多,2核即可),最小内存4G(必需)

详见官方文档:https://docs.gitlab.cn/jh/install/requirements.html

两种常见安装方式:shell命令安装和在docker下安装

shell命令安装

1 安装依赖

sudo yum install -y curl policycoreutils-python openssh-server perl
sudo systemctl enable sshd
sudo systemctl start sshd

2 配置镜像

curl -fsSL https://packages.gitlab.cn/repository/raw/scripts/setup.sh | /bin/bash

3 开始安装

sudo EXTERNAL_URL="http://192.168.3.101" yum install -y gitlab-jh

ip改成你自己的。

4 登录使用

访问 http://192.168.3.101

用户名:root
密码存在下面文件中,登录后需要改密码,不然24小时之后密码失效

cat /etc/gitlab/initial_root_password

gitlab常用命令

gitlab-ctl start                  # 启动所有 gitlab 组件;
gitlab-ctl stop                   # 停止所有 gitlab 组件;
gitlab-ctl restart                # 重启所有 gitlab 组件;
gitlab-ctl status                 # 查看服务状态;
gitlab-ctl reconfigure            # 启动服务;
vi /etc/gitlab/gitlab.rb         # 修改默认的配置文件;
gitlab-ctl tail                   # 查看日志;

在docker下安装

1 安装docker (已安装请忽略)

docker要求系统内核至少在3.10以上

uname -r 命令可查看系统内核版本

[root@localhost ~]# uname -r
3.10.0-957.el7.x86_64

1.1 更新yum源(生产环境慎重使用)

yum update

1.2 安装依赖

yum install -y yum-utils device-mapper-persistent-data lvm2

1.3 添加镜像

//国外镜像
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
//阿里镜像(推荐)
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

1.4 查看源中可使用版本

yum list docker-ce --showduplicates | sort -r

1.5 安装(不指定版本默认最新)

yum install docker

1.6 配置开机启动

systemctl start docker
systemctl enable docker

2 使用docker安装gitlab

2.1 拉取镜像

docker pull gitlab/gitlab-ce

2.2 启动容器

docker run -d \
	-p 443:443 -p 80:80 \
	--name gitlab \
	--restart always \
	-v /usr/local/gitlab/config:/etc/gitlab \
	-v /usr/local/gitlab/logs:/var/log/gitlab \
	-v /usr/local/gitlab/data:/var/opt/gitlab \
	--shm-size 256m \
	gitlab/gitlab-ce

GitLab产品将分为三个发行版:CE(社区版),EE(企业版)和JH(JiHu版)。CE发行版将继续在全球范围内提供。EE发行版仅在中国境外出售。JH发行版仅在中国销售。

2.3 查看已存在的容器

docker ps -a

2.4 访问自建gitlab

http://192.168.3.101 (ip改成你自己的。)

首次运行,可能出现502,不要慌

  1. 确认虚拟机内存不少于4G
  2. 稍微再等等,启动需要一段时间,等会刷新一下就好了

用户名:root

密码存在容器内下面文件中,登录后需要改密码,不然24小时之后密码失效

cat /etc/gitlab/initial_root_password

2.5 修改密码

如果忘记了密码,可以进入容器内docker exec -it gitlab bash,依次执行下面即可

gitlab-rails console -e production
user = User.where(id: 1).first
user.password = '123456'
user.password_confirmation = '123456'
user.save!
exit

标签:gitlab,--,Gitlab,Centos7,yum,ctl,服务器,docker,安装
From: https://www.cnblogs.com/tenny-peng/p/17027612.html

相关文章

  • Centos7系统中mongodb的安装详解
    MongoDB的下载网址1.下载完成后上传解压并重命名为mongodb2.在mongodb目录下创建data、logs目录[root@kht118mongodb]#mkdirdatalogs3.创建logs/mongodb.log文......
  • 私有软件仓库GitLab
    ​一、GitLab介绍   GitLab是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,提供了Web界面用于访问公开或私有的项目。GitLab的优势如下:开源免费可以作为Gi......
  • linux服务器cup100%问题排查
    一、出现问题在发现公司门禁服务无法开门的第一时间,去线上服务器上查看了一下进程的运行情况,具体运行如下:   第一次在查看的时候发现并没有我需要的服务entrancegua......
  • unity之network客户端向服务器发送消息【Command】方法详解
    如果是纯粹是聊天室功能则可以使用NetworkView的方法来进行,简单实用。如果不是聊天室功能而是要传递数据给服务器,同时为了以后更多功能的拓展性,还是应该用networkmanager来......
  • ubuntu下搭建git服务器
    1、安装gitaptinstallgitaptinstallopenssh-server2、安装​​gitolite​​​​https://github.com/sitaramc/gitolite​​Installationandsetupserverrequirementsa......
  • 搭建DNS服务器dnsmasq
    公司内部DNS搭建基本功能:静态解析公司内部域名的访问;如:公司内网的一些环境,如:ftp服务器,版本服务器,论坛,内部搭建的各种服务,不对外开放。一、DNS服务简介1、DNS服务简介DNS......
  • Comet:基于HTTP长连接的“服务器推”技术
     作者:​​周婷​​(​​[email protected]​​),软件工程师,IBM中国软件开发技术实验室周婷,软件工程师,目前在IBM中国软件开发技术实验室从......
  • Jenkins通过安装ssh插件实现构建后推送到其它服务器
    参考博客:https://www.cnblogs.com/zhchoutai/p/8869898.html一、PublishOverSSH 安装   因为我这里已经安装了PublishOverSSH 所以在installdeplugins中可......
  • SVN服务器搭建和使用(二)
     上一篇介绍了VisualSVNServer和TortoiseSVN的下载,安装,汉化.这篇介绍一下如何使用VisualSVNServer建立版本库,以及TortoiseSVN的使用.首先打开VisualSVNServerManage......
  • C#获得SQLServer服务器名、数据库名、表名、以及字段名
    usingSystem.Data.SqlClient;///<summary>///获取局域网内的所有数据库服务器名称///</summary>///<returns>服务器名称数组</ret......