本篇内容主要讲解“怎么用GitLab搭建自己的私有GitHub库”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习”怎么用GitLab搭建自己的私有GitHub库”吧!
<>强安装依赖强>
Debian/Ubuntu下:
代码如下:
sudo apt-get安装- y建设重要zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh服务器redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate
安装python(注意需要2.5以上版本):
sudo apt-get install -y python python-docutils
安装git(注意需要1.7.10以上版本):
sudo apt-get install -y git-core
Centos下官方仓库的软件比较老旧,推荐先添加epel源,然后再安装依赖:
代码如下:
sudo yum安装git补丁gcc-c + + readline-devel zlib-devel libffi-devel openssl-devel使autoconf automake libtool野牛libxml2-devel libxslt-devel libyaml-devel git python python-docutils
<强>安装Ruby 2.0 强>
需要安装Ruby2.0,软件仓库中的Ruby 1.8不支持:
mkdir /tmp/ruby ,, cd /tmp/Ruby curl ——progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz cd ruby-2.0.0-p353 。/configure ——disable-install-rdoc 使 sudo make 安装
安装打包机宝石:
sudo gem install bundler ——no-ri ——no-rdoc
<强>配置gitlab-shell 强>
创建git用户:
sudo adduser ——system ——create-home ——comment & # 39; GitLab& # 39;, git
配置gitlab-shell
su 作用;git -c “git clone https://github.com/gitlabhq/gitlab-shell.git",, su 安康;git -c “cd gitlab-shell ,,, git checkout v1.3.0", su 安康;git -c “cp gitlab-shell/config.yml.example gitlab-shell/config.yml", sed 我;“s/localhost/gitlab.51yip.com/g",/home/git/gitlab-shell/config.yml su 安康;git -c “gitlab-shell/bin/install", chmod 600年,/home/git/. ssh/authorized_keys chmod 700年,/home/git/sh
<>强数据库强>
GitLab支持MySQL和PostgreSQL数据库。下面以MySQL为例,介绍安装方法:
Debian/Ubuntu下使用如下命令安装:
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
Centos下使用如下命令:
sudo yum install mysql-server sudo chkconfig  mysqld
配置MySQL:
sudo echo “CREATE DATABASE IF NOT EXISTS gitlabhq_production DEFAULT CHARACTER SET & # 39; use utf8 # 39;, COLLATE & # 39; utf8_unicode_ci& # 39;;“, |, mysql -u root sudo echo “UPDATE mysql.user  SET 密码=密码(& # 39;123456 & # 39;),WHERE 用户=& # 39;根# 39;;,FLUSH 特权;“,|,mysql -u 根
注意,用你的密码替换123456。
安装配置gitlab
su 作用;git -c “git clone https://github.com/gitlabhq/gitlabhq.git gitlab", su 安康;git -c “cd gitlab; git checkout 5-1-stable", su git  -c “cp 配置/gitlab.yml.example 配置/gitlab.yml", su git  -c “mkdir /home/git/gitlab-satellites", su git  -c “mkdir 公共/uploads", su git  -c “mkdir  -p tmp/套接字“, su git  -c “mkdir  -p tmp/pid/? sed 我;“s/,主持人:,localhost/,主持人:;gitlab.segmentfault.com/g",,配置/gitlab.yml sed 我;“s/:, gitlab@localhost/从:,gitlab@gitlab.segmentfault.com/g",配置/gitlab.yml su git  -c “cp 配置/puma.rb.example 配置/puma.rb", su git  -c & # 39; git config ——global user.name “GitLab" & # 39;, su git  -c & # 39; git config ——global user.email “gitlab@gitlab.segmentfault.com" & # 39;
注意将gitlab.segmentfault.com替换为你自己的内容。