centos6搭建gitlab的方法步骤

前言

原来的项目放在公网的gitlab上,处于安全考虑,在内网搭建一套,有图形界面,可以直接从外网git导入进来,使用了一下觉得挺方便,把安装流程记录下来,参考官网:https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/install/centos 可以直接移步那里看

基本环境安装(git\redis\ruby\mysql...)

yum -y groupinstall 'Development Tools'
yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel db4-devel byacc sqlite-devel libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui redis sudo wget crontabs logwatch logrotate perl-Time-HiRes git cmake libcom_err-devel.i686 libcom_err-devel.x86_64 nodejs

yum -y install python-docutils
yum -y install postfix
git --version #安装高于2.7.4的git版本
yum -y remove git
yum install zlib-devel perl-CPAN gettext curl-devel expat-devel gettext-devel openssl-devel
mkdir /tmp/git && cd /tmp/git
curl --progress https://www.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz | tar xz
cd git-2.9.0
./configure
make
make prefix=/usr/local install

yum remove ruby #安装高于2.1版本的ruby,删除老的
mkdir /tmp/ruby && cd /tmp/ruby
curl --progress https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.9.tar.gz | tar xz
cd ruby-2.1.9
./configure --disable-install-rdoc
make
make prefix=/usr/local install
gem install bundler --no-doc
yum install redis mysql
/Data/apps/mysql/bin/mysqld_safe &
/Data/apps/mysql/bin/mysql -uroot
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
mysql> grant all on gitlabhq_production.* to 'git'@'localhost' identified by 'git';

配置redis

vim /etc/redis.conf

unixsocket /var/run/redis/redis.sock
unixsocketperm 0770
mkdir -p /var/run/redis
chown redis:redis /var/run/redis
chmod 755 /var/run/redis
/etc/init.d/redis start
usermod -aG redis git

配置gitlab相关

# 下载git,用的国内源。国外的太慢了
cd /home/git
sudo -u git -H git clone http://git.oschina.net/qiai365/gitlab-ce gitlab
cd /home/git/gitlab
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
sudo -u git -H editor config/gitlab.yml
# 修改成自己的host host: iaasgit1.prod.bj1
sudo -u git -H cp config/secrets.yml.example config/secrets.yml
sudo -u git -H chmod 0600 config/secrets.yml
sudo chown -R git log/
sudo chown -R git tmp/
sudo chmod -R u+rwX,go-w log/
sudo chmod -R u+rwX tmp/
sudo chmod -R u+rwX tmp/pids/
sudo chmod -R u+rwX tmp/sockets/
sudo -u git -H mkdir public/uploads/
sudo chmod 0700 public/uploads
sudo chmod ug+rwX,o-rwx /home/git/repositories/
sudo chmod -R u+rwX builds/
sudo chmod -R u+rwX shared/artifacts/
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
nproc
sudo -u git -H editor config/unicorn.rb
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
sudo -u git -H git config --global core.autocrlf input
sudo -u git -H git config --global gc.auto 0
sudo -u git -H cp config/resque.yml.example config/resque.yml
sudo -u git -H editor config/resque.yml

配置db部分 only for mysql

sudo -u git cp config/database.yml.mysql config/database.yml
sudo -u git -H editor config/database.yml #配置production部分的password: "密码"
sudo -u git -H chmod o-rwx config/database.yml

安装gitlab相关,并启动

# install gems
cd /home/git/gitlab
sudo -u git -H bundle install --deployment --without development test postgres aws kerberos

# install gitlab shell
sudo -u git -H bundle exec rake gitlab:shell:install[v3.3.3] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production
sudo -u git -H editor /home/git/gitlab-shell/config.yml

# install gitlab-workhorse
cd /home/git
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git
cd gitlab-workhorse
sudo -u git -H git checkout v0.7.5
sudo -u git -H make

# Initialize Database and Activate Advanced Features
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production

sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword GITLAB_ROOT_EMAIL=youremail
cp lib/support/init.d/gitlab /etc/init.d/gitlab
cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
chkconfig gitlab on
cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
service gitlab start

配置nginx

yum install nginx
cp lib/support/nginx/gitlab /Data/apps/nginx/conf/include/gitlab.conf
usermod -a -G git nginx
chmod g+rx /home/git/
/Data/apps/nginx/conf/include/gitlab.conf #把这个配置里的server_name配置好

最后check一下

cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
# 启动gitlab
/etc/init.d/gitlab restart

# 直接打开server_name对应的url,发现样式都没了,执行
sudo -u git -H bundle exec rake assets:clean assets:precompile REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production

最后说明一下

这个只是记一个流水账,里边可能涉及到权限之类的问题,在确保一下nginx\git互相之间是否有权限,另外用check脚本进行check,提示很友好,一般都能搞定,祝你成功。

中间使用的yum由于用的是重写打包过的rpm,路径和默认的不同,如果你用的默认的,可以根据自己情况改一下,或者直接参考官网,我这就是官网的一个根据自己环境的阉割版。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

(0)

相关推荐

  • Centos7使用docker搭建gitlab服务器

    了解到docker的优点,搭建快,运行要求资源低,最重要的是实现的功能和效果都能达到预期,于是决定使用docker来搭建gitlab服务器. 效果图如下: 系统环境:CentOS Linux release 7.1.1503 (Core) git版本:/gitlab/gitlab-ce 一.安装和启动docker 安装:yum -y install docker 启动:systemctl start docker 开机启动:systemctl enable docker 二.拉取镜像文件 doc

  • centos下GitLab+Jenkins持续集成环境搭建(安装jenkins)

    centos下搭建GitLab+Jenkins持续集成环境,供大家参考,具体内容如下 1.安装JDK yum install -y java 2.安装jenkins 添加Jenkins库到yum库,Jenkins将从这里下载安装. wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo rpm --import https://jenkins-ci.org/redhat/jenkins

  • centos6搭建gitlab的方法步骤

    前言 原来的项目放在公网的gitlab上,处于安全考虑,在内网搭建一套,有图形界面,可以直接从外网git导入进来,使用了一下觉得挺方便,把安装流程记录下来,参考官网:https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/install/centos 可以直接移步那里看 基本环境安装(git\redis\ruby\mysql...) yum -y groupinstall 'Development Tools' yum -y instal

  • Ubuntu20.04安装配置GitLab的方法步骤

    介绍 GitLab CE或Community Edition是一个开源应用程序,主要用于托管Git存储库,以及其他与开发相关的功能,如问题跟踪.它旨在使用您自己的基础架构进行托管,并为您的开发团队提供部署内部存储库的灵活性,与用户交互的公共方式,或者为贡献者提供托管自己项目的方法. GitLab项目使用简单的安装机制在您自己的硬件上设置GitLab实例变得相对简单.在本指南中,我们将介绍如何在阿里云Ubuntu 20.04服务器上安装和配置GitLab. 前提条件 部署GitLab的实例要求至少

  • 阿里云服务器购买搭建过程的方法步骤

    1.购买服务器 在示例中购买的为阿里云服务器,在校大学生可以购买阿里云的学生认证特权服务器 (云翼计划)网址:https://promotion.aliyun.com/ntms/act/campus2018.html 购买云服务器ECS 价钱比较便宜,一年的费用也就一百多块钱,这款服务器需要进行学生学信网认证,按照要求认证就行(此服务器比较抢手,会有一些服务器贩子天天抢,你不一定能抢上). 注意: 1.购买服务器的预装环境选择你自己电脑对应的系统 2.地域选择你相对应的地区 比如: 2.阿里云配

  • vs2022 qt环境搭建调试的方法步骤

    建议:先安装qt再安装vs! 1.安装qt6,如下图,勾选msvc2019即可,其它自行决定,剩下安装自动的: 2.vs2022安装没什么说的,因为已经是模块化安装了,如下图,这是最少勾选的了: 3.安装qt vs tools插件,vs扩展,扩展管理,搜索qt即可,然后安装,重启vs后生效. 4.一般会自动识别出,如果没有手动,在扩展中的qt versions中指定qt的路径,必须指定到qt安装目录下的,mscv2019_64文件夹. 5.新建项目,直接有qt项目菜单 ,按顺序下一步,下一步即可

  • Next.js脚手架完整搭建封装的方法步骤

    针对实际的开发场景(SEO优化需求),我们直接使用next.js脚手架创建的项目还无法直接进行开发,需要再次进行配置封装搭建,这里分享一套自己的完整封装搭建给有需要的小伙伴使用; 内容包括:(1)sass样式配置;(2)axios拦截封装;(3)action模块化;(4)reducer模块化;(5)redux搭建;(6)dispatch示范;(7)saga中间件配置;(8)saga拦截示范;(9)useEffect异步请求示范;(10)getServerSideProps/getStaticPr

  • Docke实例之搭建gitlab的方法

    gitlab介绍概述 GitLab 是一个用于仓库管理系统的开源项目.使用Git作为代码管理工具,并在此基础上搭建起来的web服务.Github是公共的git仓库,而Gitlab适合于搭建企业内部私有git仓库 官网: https://about.gitlab.com/ https://github.com/gitlabhq/gitlabhq 前端:Nginx,用于页面及Git tool走http或https协议 后端:Gitlab服务,采用Ruby on Rails框架,通过unicorn实现

  • 用Docker安装Gitlab的方法步骤

    Gitlab简介 GitLab是一个Git的代码托管工具,有免费的社区版允许我们在本地搭建代码托管网站,也有付费的企业版网站,能够在线托管代码.传统方式是手动下载Gitlab的软件包,然后搭建相关运行环境.不过这种方式非常麻烦,而且如果要更换机器所有配置工作又得重来一边,如果有同学学过Java的话应该记得初学Java时配置环境变量的恐惧吧?因此更好的办法就是使用现在非常流行的Docker. 那么Docker又是个什么东西呢?这是一个虚拟化的运行工具,主要目的是将软件和整个运行环境打包起来,让我们

  • Docker-compose部署gitlab的方法步骤

    Docker-compose部署gitlab 1.安装Docker 安装必要工具 复制代码 代码如下: [root@vm_10_14_centos ~]# yum -y install yum-utils device-mapper-persistent-data lvm2 添加Docker-ce镜像源并安装 [root@vm_10_14_centos ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/li

  • 基于Docker部署GitLab环境搭建的方法步骤

    注意:建议虚拟机内存2G以上,一定要配置阿里云的加速镜像 1.下载镜像文件 docker pull beginor/gitlab-ce:11.0.1-ce.0 2.创建GitLab 的配置 (etc) . 日志 (log) .数据 (data) 放到容器之外, 便于日后升级 mkdir -p /mnt/gitlab/etc mkdir -p /mnt/gitlab/log mkdir -p /mnt/gitlab/data 3.运行GitLab容器 进入/mnt/gitlab/etc目录,运行一

随机推荐