网址:官方网址:http//:about.gitlab.con
中文网址:GitLab-10万企业使用的一站式DevOps平台_GitLab中文官网
在ssh下安装:
1.安装依赖
sudo(root用户不加) -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://10.0.0.201" yum install -y gitlab-jh
# EXTERNAL_URL配置的是访问gitlab的地址,如果是公司要配置公司服务器的ip地址或者域名解析的
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 #查看日志
4.启动gitlab
命令:gitlab-ctl start
会瞬间启动很多的中间件
注意:gitlab默认是跑在我们虚拟机的80端口
首次登录,我们可以选择使用root用户,gitlab会给我们默认一个密码,我们可以找到这个密码所在的文件打开复制密码登录
使用:vi 或者cat密码文件,打开文件找到我们的password
这样我们就可以通过访问配置的ip地址直接访问到我们搭建的gitlab了
我们可以进行管理员密码的修改
在docker下安装gitlab
在容器中运行极狐GitLab Runner | 极狐GitLab
安装所需要最小配置:
内存4G
系统内核至少在3.10以上 uname -r命令可查看系统内核版本
安装dock
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 https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.查看源中可使用的版本
yum list docker-ce --showduplicates | sort -r
5.安装指定版本
yum install docker-ce-20.10.9-3.el7
6.配置开机启动项
systemctl start docker
systemctl enable docker
docker version
7.使用容器安装gitlab
docker run --detach \
--hostname 10.0.0.200 \ # 容器的主机名
--publish 443:443 --publish 80:80 \ # 将容器内部的端口映射到主机上的端口
--name gitlab \ # 为容器指定一个名字
--restart always \
--volume $SGITLAB_HOME/config:/etc/gitlab:z \ # $SGITLAB_HOME 是主机上存储gitlab数据的目录
--volume $SGITLAB_HOME/logs:/var/log/gitlab:z \
--volume $SGITLAB_HOME/data:/var/opt/gitlab:z \
--shm-size 256m \
registry.gitlab.cn/omnibus/gitlab-jh:latest
8.之后查看容易就可以看到我们的gitlab
9.启动gitlab
docker start gitlab
10.进入容器
docker exec -it gitlab /bin/bash
11.在容器中找到gitlab的root用户密码
cat /etc/gitlab/initial_root_password
12.通过访问主机的ip和80端口就可以直接映射到容器里面就可以使用gitlab了
注:按照这样的配置,我们启动的gitlab是映射的主机的80和443端口,可能会有影响,可以参考这边文章来进行端口的修改:修改Docker部署gitlab的外部访问地址和端口_修改gitlab的访问url和端口_b哈利路亚d的博客-CSDN博客