服务器上创建搭建gitlab

一、下载与安装

在主目录操作~

1.使用wget下载

php 复制代码
wget --no-check-certificate https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.0.1-ce.0.el7.x86_64.rpm

可以在开源软件镜像站选择合适的版本,版本不同页面菜单会稍有差异,此次选择的是14.0.1,gitlab-ce-14.0.1-ce.0.el7.x86_64.rpm

参考地址:Index of /gitlab-ce/yum/el7/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

2.安装

php 复制代码
rpm -i gitlab-ce-14.0.1-ce.0.el7.x86_64.rpm

安装成功样式

3.修改配置文件

php 复制代码
vim  /etc/gitlab/gitlab.rb

主要修改ip和port端口号,有域名直接填写域名,也可以写ip地址

4.重置gitlab

php 复制代码
gitlab-ctl reconfigure

5.重启gitlab

php 复制代码
gitlab-ctl start

二、打开浏览器访问

例如本地访问就是 http://47.97.159.12

此处设置root用户的密码,设置新密码,如果之前安装过其他版本,这里可能直接是登陆,可以用命令重置gitlab密码

php 复制代码
sudo gitlab-rails console
 
user = User.where(id: 1).first
user.password = 'YOURPASSWORD'
user.password_confirmation = 'YOURPASSWORD'
user.save!

三、遇到的问题

1.安装gitlab

rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm时出现这个错误,或者可安装其他版本

php 复制代码
error: Failed dependencies: 	policycoreutils-python is needed by gitlab-ce-10.0.0-ce.0.el7.x86_64

解决

php 复制代码
yum install policycoreutils-python

四、如果遇到管理员密码忘记的情况可重置换密码

gitlab重置用户密码:https://blog.csdn.net/weixin_33937913/article/details/91769988

五、卸载gitlab

卸载GitLab并重装:https://blog.csdn.net/jia12216/article/details/84853136

在服务器创建gitlab配置文件,/usr/local/nginx/conf/vhost,gitlab_nginx.conf

php 复制代码
upstream gitlab-workhorse {
  server unix:/var/opt/gitlab/gitlab-workhorse/sockets/socket;
}

server
    {
        listen 80;
        #listen [::]:80;
        server_name IP地址或解析域名;
        server_tokens off;
        root /opt/gitlab/embedded/service/gitlab-rails/public;
        client_max_body_size 250m;

        location / {
            client_max_body_size 0;
            gzip off;

            ## https://github.com/gitlabhq/gitlabhq/issues/694
            ## Some requests take more than 30 seconds.
            proxy_read_timeout      300;
            proxy_connect_timeout   300;
            proxy_redirect          off;

            proxy_http_version 1.1;

            proxy_set_header    Host                $http_host;
            proxy_set_header    X-Real-IP           $remote_addr;
            proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
            proxy_set_header    X-Forwarded-Proto   $scheme;

            proxy_pass http://gitlab-workhorse;
          }
          location ~ ^/(assets)/  {
                root /opt/gitlab/embedded/service/gitlab-rails/public;
                # gzip_static on; # to serve pre-gzipped version
                expires max;
                add_header Cache-Control public;
          }
    }

参考文档:Linux Centos7 gitlab安装_lunix 安装gitlab error: failed dependencies:-CSDN博客

相关推荐
测试开发技术2 天前
git rm 命令与系统的 rm 命令有什么区别?
git·gitlab·github·面试题
云和数据.ChenGuang3 天前
关闭 GitLab 升级提示的详细方法
运维·自动化·gitlab·es运维
读创商闻3 天前
极狐GitLab CEO 柳钢——极狐 GitLab 打造中国企业专属 AI 编程平台,引领编程新潮流
人工智能·gitlab
小川zs3 天前
gitee某个分支合并到gitlab目标分支
gitee·gitlab
你的人类朋友3 天前
✨【GitLab】【CI/CD】核心概念一览
gitlab·自动化运维·devops
Gold Steps.4 天前
基于 Gitlab、Jenkins与Jenkins分布式、SonarQube 、Nexus 的 CiCd 全流程打造
运维·ci/cd·gitlab·jenkins
咚咚?4 天前
基于gitlab 构建CICD发布到K8S 平台
容器·kubernetes·gitlab
荔枝吻8 天前
【保姆级喂饭教程】GitLab创建用户规范,分支开发规范,提交日志规范
gitlab·git规范·分支规范
云畅新视界8 天前
从 CODING 停服到极狐 GitLab “接棒”,软件研发工具市场风云再起
人工智能·gitlab