gitlab安装

 需要内存:5G

一、使用ssh安装

官方网站

https://gitlab.cn/install

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、开始安装

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

ip地址改为自己的ip地址,阿里云的是公网地址

 4、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                   # 查看日志;

5、查看密码

grep 'Password:' /etc/gitlab/initial_root_password

 

二、在docker下安装

https://docs.gitlab.cn/jh/install/docker.html

安装docker

https://www.cnblogs.com/shining-feifan/p/15431883.html

1、更新yum源

yum update

2、安装依赖

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

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

4、查看源中可使用版本

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

5、安装指定版本

yum install docker-ce-<VERSION_STRING>

例如:yum install docker-ce-20.10.9-3.el7

6、配置开机启动项

systemctl start docker
systemctl enable docker
docker version

容器安装gitlab

1、路径设置

export GITLAB_HOME=/srv/gitlab

 

 2、添加容器

docker run --detach \
--hostname 123.56.247.24 \
--name gitlab \
--memory=3g \
--memory-swap=4g \
-p 8082:443 -p 8083:80 -p 8084:22 \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest

--hostname:填入本机地址 阿里云的公网地址

3、查看启动容器

docker ps

4、进入docker容器查看密码

docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password

账号:root

5、浏览器访问hostname地址即可

6、hostname填写错误修改

vim /srv/gitlab/data/gitlab-rails/etc/gitlab.yml

 

posted @ 2022-08-13 15:35  非帆丶  阅读(560)  评论(0编辑  收藏  举报