国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 服務器 > Web服務器 > 正文

用GitLab搭建自己的私有GitHub庫的步驟

2024-09-01 13:53:21
字體:
來源:轉載
供稿:網友

Gitlab是一個用Ruby on Rails開發的開源項目管理程序,可以通過WEB界面進行訪問公開的或者私人項目。它和Github有類似的功能,能夠瀏覽源代碼,管理缺陷和注釋。

下面介紹如何在 Debian/Ubuntu 和 Centos 下搭建配置 GitLab。

安裝依賴

Debian/Ubuntu下:

 

復制代碼 代碼如下:

sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server 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 install git patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel git python python-docutils

 

安裝 Ruby 2.0

需要安裝Ruby2.0,軟件倉庫中的Ruby 1.8不支持:

mkdir /tmp/ruby && cd /tmp/rubycurl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xzcd ruby-2.0.0-p353./configure --disable-install-rdocmakesudo make install

安裝Bundler Gem:

sudo gem install bundler --no-ri --no-rdoc

配置gitlab-shell

創建git用戶:

sudo adduser --system --create-home --comment 'GitLab' 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 -i "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/.ssh

數據庫

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 on

配置MySQL:

sudo echo "CREATE DATABASE IF NOT EXISTS gitlabhq_production DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';" | mysql -u root sudo echo "UPDATE mysql.user SET Password=PASSWORD('123456') WHERE User='root'; FLUSH PRIVILEGES;" | mysql -u root 

注意,用你的密碼替換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 config/gitlab.yml.example config/gitlab.yml" su git -c "mkdir /home/git/gitlab-satellites" su git -c "mkdir public/uploads" su git -c "mkdir -p tmp/sockets/" su git -c "mkdir -p tmp/pids/" sed -i "s/ host: localhost/ host: gitlab.segmentfault.com/g" config/gitlab.yml sed -i "s/from: gitlab@localhost/from: gitlab@gitlab.segmentfault.com/g" config/gitlab.yml su git -c "cp config/puma.rb.example config/puma.rb" su git -c 'git config --global user.name "GitLab"' su git -c 'git config --global user.email "gitlab@gitlab.segmentfault.com"'

注意將gitlab.segmentfault.com替換為你自己的內容。

配置數據庫連接:

sudo su git -c "cp config/database.yml.mysql config/database.yml"sudo sed -i "s/secure password/mysql的root密碼/g" config/database.yml

安裝MySQL需要的Gems

sudo -u git -H bundle install --deployment --without development test postgres aws

初始化:

sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=productionsudo cp lib/support/init.d/gitlab /etc/init.d/gitlabsudo chmod +x /etc/init.d/gitlabsudo update-rc.d gitlab defaults 21

查看是否配置妥當:

sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

重啟GitLab:

sudo service gitlab start

配置Nginx

Debian/Ubuntu下:

sudo apt-get install -y nginx

CentOS下:

sudo yum install nginx

下載配置文件樣例:

sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlabsudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab

修改 /etc/nginx/sites-available/gitlab,特別留意將 YOUR_SERVER_FQDN 改成自己的。

重啟nginx:

sudo service nginx restart

好了,你可以登錄GitLab了,默認安裝后的用戶名:admin@local.host,密碼5iveL!fe。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 得荣县| 威远县| 天门市| 尉犁县| 北川| 理塘县| 灵山县| 永宁县| 南乐县| 临猗县| 洛扎县| 军事| 长泰县| 衡阳市| 盐亭县| 乌鲁木齐县| 丰都县| 神木县| 临潭县| 兰西县| 新乐市| 孟津县| 家居| 绥江县| 葫芦岛市| 怀宁县| 刚察县| 鸡西市| 山阴县| 即墨市| 嘉义县| 九龙城区| 和林格尔县| 南通市| 平潭县| 巴楚县| 滨海县| 海门市| 百色市| 思茅市| 澄迈县|