當前位置:首頁 » 操作系統 » gitlab資料庫

gitlab資料庫

發布時間: 2022-05-17 13:37:22

『壹』 gitlab在資料庫中存放了哪些東西

將GitLab的資料庫導入阿里雲Postgresql RDS GitLab的資料庫用的是PostgreSQL,之前由於阿里雲RDS不支持PostgreSQL,只能將GitLab的資料庫部署在雲伺服器上。 6月1日得知阿里雲推出了PostgreSQL RDS,於是立馬將GitLab的資料庫遷移至PostgreSQL

『貳』 如何在 CentOS 上安裝 Gitlab

#gitlab基於ruby開發模仿Github的版本控制軟體,因為是開源的,,但是我們確實有這樣的需求,相比Gtihub來說可以減少很多成本.
#從安裝ruby、git、資料庫、web、和gitlab到訪問,一定要有耐心.
#安裝環境
##[root@localhost config]# uname -r
##2.6.32-279.el6.x86_64
##[root@localhost config]# cat /etc/redhat-release
##CentOS release 6.3 (Final)
一.安裝依賴
## 安裝epel-release
yum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
#安裝ruby依賴包
## packages (from rvm install message):
yum -y install libicu-devel patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel mysql-devel
#安裝或者更新git
yum -y remove git
yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
wget http://git-core.googlecode.com/files/git-1.8.3.4.tar.gz
tar -zxf git-1.8.3.4.tar.gz
cd git-1.8.3.4
make prefix=/usr all
make prefix=/usr install
cd ..
#安裝前版本
[root@gitlab ~]# git –version
git version 1.7.1
#安裝後版本
[root@gitlab ~]# git –version
git version 1.8.3.4
二.安裝RVM
#RVM工具
curl -L get.rvm.io | bash -s stable
#出現以下信息為安裝成功
# Administrator,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
#載入RVM,改名(使用淘寶源)
source /etc/profile.d/rvm.sh
cp /usr/local/rvm/config/db /usr/local/rvm/config/db.bk
sed -i 's#ftp.ruby-lang.org/pub/ruby#ruby.taobao.org/mirrors/ruby#' /usr/local/rvm/config/db
sed -i 's#cache.ruby-lang.org/pub/ruby#ruby.taobao.org/mirrors/ruby#' /usr/local/rvm/config/db
#安裝libyaml(防止後期報錯,可不裝)
rvm pkg install libyaml
三.安裝ruby
#安裝ruby
#rvm install 2.0.0-p247 –with-libyaml-dir=/usr/local/rvm/usr
#rvm –default use 2.0.0-p247
rvm install 2.0.0-p353 –with-libyaml-dir=/usr/local/rvm/usr
rvm –default use 2.0.0-p353
#引用淘寶ruby源
gem sources –remove https://rubygems.org/
gem sources -a http://ruby.taobao.org/
gem sources -l
#安裝bundler
gem install bundler –no-ri –no-rdoc
四.安裝gitlab-shell
#創建用戶git
adser –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.7.0"
##修改配置文件
su – git -c "cp gitlab-shell/config.yml.example gitlab-shell/config.yml"
##安裝
su – git -c "gitlab-shell/bin/install"
五.安裝Redis和mysql
#安裝Redis,據說高級特性需要
yum -y install redis ;service redis start ; chkconfig redis on
#安裝mysql
#安裝Mysql資料庫.略過,以及資料庫操作
##yum install -y mysql-server mysql-devel ; chkconfig mysqld on ; service mysqld start
#編譯安裝宣告下變數
##export PATH="/opt/mysql/bin:$PATH"
##echo "export PATH="/opt/mysql/bin:$PATH"">>/etc/profile
##修改root密碼
#echo "UPDATE mysql.user SET Password=PASSWORD('$MYSQL_ROOT_PW') WHERE User='root'; FLUSH PRIVILEGES;" | mysql -u root
##創建gitlab資料庫
#echo "CREATE DATABASE IF NOT EXISTS gitlabhq_proction DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';" | mysql -u root
CREATE DATABASE IF NOT EXISTS gitlabhq_proction DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
##創建連接資料庫用戶
grant all on gitlabhq_proction.* to gitlab@localhost identified by '123456';
六.安裝gitlab
#復制GitLab到本地
su – git -c "git clone https://github.com/gitlabhq/gitlabhq.git gitlab"
## 檢查
su – git -c "cd gitlab;git checkout 5-4-stable"
#以下操作在/home/git/gitlab
cd /home/git/gitlab
### 復制配置文件
su git -c "cp config/gitlab.yml.example config/gitlab.yml"
### 修改配置文件主機名(可以不做)
sed -i "s/ host: localhost/ host: gitlab.test/g" config/gitlab.yml
### 修改郵件地址
sed -i "s/from: gitlab@localhost/from: [email protected]/g" config/gitlab.yml
#修改puma.rb文件
su git -c "cp config/puma.rb.example config/puma.rb"
sed -i "s/0.0.0.0:9292/127.0.0.1:3000/g" /home/git/gitlab/config/puma.rb
sed -i "s/# bind/bind/g" /home/git/gitlab/config/puma.rb
#為git用戶授權
su git -c "chown -R git /home/git/gitlab/log/;chmod -R u+rwx /home/git/gitlab/log/;chown -R git /home/git/gitlab/tmp/;chmod -R u+rwx /home/git/gitlab/tmp/;mkdir /home/git/gitlab-satellites;mkdir /home/git/gitlab/tmp/pids/;chmod -R u+rwx /home/git/gitlab/tmp/pids/;mkdir /home/git/gitlab/tmp/sockets/;chmod -R u+rwx /home/git/gitlab/tmp/sockets/;mkdir /home/git/gitlab/public/uploads;chmod -R u+rwX /home/git/gitlab/public/uploads"
### 復制數據配置文件
su git -c "cp config/database.yml.mysql config/database.yml"
### 設置mysql用戶和密碼
sed -i "s/root/gitlab/g" config/database.yml
sed -i "s/secure password/123456/g" config/database.yml
### 配置git用戶

su git -c 'git config --global user.name "GitLab"'
su git -c 'git config --global user.email "gitlab@$GL_HOSTNAME"'

七.安裝 Gems
## 安裝

gem install charlock_holmes --version '0.6.9'

#bundle使用淘寶源,並且安裝(時間長.)
sed -i '1s/https/http/g' /home/git/gitlab/Gemfile
sed -i '1s/rubygems/ruby.taobao/g' /home/git/gitlab/Gemfile
#安裝bundle
su git -c "bundle install –deployment –without development test postgres"
八.初始化資料庫
#初始化資料庫

export force=yes
su git -c "bundle exec rake gitlab:start RAILS_ENV=proction"
su git -c "bundle exec rake gitlab:setup RAILS_ENV=proction"

#初始化在資料庫里添加數據,最後後會出現:
#用戶名:[email protected]
#密 碼:5iveL!fe
#su git -c "bundle exec rake gitlab:env:info RAILS_ENV=proction"
九.啟動腳本
#curl –output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab-centos
#chmod +x /etc/init.d/gitlab
curl –output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/init.d/gitlab
chmod +x /etc/init.d/gitlab
#在17行後添加2行內容
sed -i "17 a source /etc/profile.d/rvm.shnrvm use 1.9.3-p448" /etc/init.d/gitlab
#或者復制
##cp /home/git/gitlab/lib/support/init.d/gitlab /etc/init.d/
#添加到開機啟動項
chkconfig gitlab on
#啟動
/etc/init.d/gitlab start
十.配置web站點
#配置nginx
#安裝nginx,(編譯安裝和rpm都能實現)
# yum -y install nginx
#下載nginx下的gitlab.conf文件
curl –output /etc/nginx/conf.d/gitlab.conf https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/nginx/gitlab
#修改下server標簽監聽埠和域名
vim /etc/nginx/conf.d/gitlab.conf
server {
listen 80;
server_name gitlab.wine.cn;
#..略..
}
更改安裝目錄許可權
# chown -R git:git /etc/nginx
#更改nginx所屬用戶
#注意:
#需要nginx用戶改為git,否則會出現502訪問錯誤.
vim /etc/nginx/nginx.conf
#user nginx;
user git;
/etc/init.d/gitlab start
/etc/init.d/nginx start
#然後訪問
gitlab.wine.cn
#####以下是報錯環節,沒怎麼整理很亂###################
[root@gitlab init.d]# sh gitlab start
Could not find mysql2-0.3.11 in any of the sources
Run `bundle install` to install missing gems.
#解決

『叄』 gitlab為什麼葯妝資料庫和redis

# 修改資料庫賬號密碼, 剛才添加過gitlab這個資料庫用戶 直接修改成該賬號即可
sudo -u git vim config/database.yml
還沒來得及裝CentOS

『肆』 centos7安裝gitlab 為什麼還要裝資料庫

當然可以,但是生產環境不建議裝在centos中,還是redhat 或者 oracle linux 比較靠譜,就算出了問題,oracle服務業跟的上。

『伍』 支持win7系統的GitLab安裝包及教程

GitLab是由Ruby語言開發的基於Linux的Git伺服器,是我見過的最強大的Git伺服器。發現它之後,立即決定將Git伺服器換成GitLab。
但安裝好GitLab之後面臨一個問題,如何將伺服器上的git項目直接導入到GitLab,之前的Git伺服器是由是git+apache搭建的(詳見在Linux上用Apache搭建Git伺服器)。
在網上發現了這篇文檔——Import bare repositories into your GitLab instance,並按之進行了操作。
1)設置存放代碼庫的主目錄
vi /etc/gitlab/gitlab.rb

比如這里設置為:git_data_dir "/gitlab/repos"
2)訪問剛搭建的GitLab站點,創建一個group,比如cnblogs。
這時會在 /gitlab/repos 下創建 /gitlab/repos/repositories/cnblogs 文件夾
然後在/gitlab/repos/repositories/創建一個文件夾,比如cnblogs
3)將現有的所有git項目文件復制到這個文件夾
cp -r /data/git/* /gitlab/repos/repositories/cnblogs

4)修改一下復制過來的文件夾的所有者:
chown -R git:git /gitlab/repos/repositories/cnblogs

5)運行GitLab導入命令
cd /var/opt/gitlab
gitlab-rake gitlab:import:repos

等了一段時間之後,顯示done,卻一個項目也沒導入進來。
經研究發現,在導入時,GitLab只認文件夾名以.git結尾的項目。於是,將要導入的項目文件夾名稱加上.git後綴,再次進行導入。
結果顯示導入成功,比如:
Processing cnblogs/CNBlogsJob.git
* Created CNBlogsJob (cnblogs/CNBlogsJob.git)
Done!

可以是GitLab站點上卻看不到已導入的項目。多次努力,也沒能解決這個問題。
後來,實在沒辦法,改為手動導入,導入方法如下:
1)在GitLab站點上創建與要導入的項目同名的項目。
2)進入剛創建的項目文件夾
cd /gitlab/repos/repositories/cnblogs/項目名稱.git

3)刪除該文件下的所有文件
rm -rf *

4)將要導入的項目文件夾下的所有文件復制過來
cp -r /data/git/CNBlogsJob/* /gitlab/repos/repositories/cnblogs/CNBlogsJob.git

就這樣將項目一個一個地導入進來。
5)導入完成後,修改一下導入的所有項目的文件所有者
chown -R git:git /gitlab/repos/repositories/cnblogs

如果不修改所有者,客戶端無法進行git push。
就這樣手動地完成了現有Git項目的導入。
備註:操作系統是CentOS 6.2,GitLab版本是7.8.4

『陸』 求問極狐(GitLab)公司的獨角獸計劃的入選條件是什麼

據我所知,極狐gitlab獨角獸計劃初創企業入選需要同時滿足2個條件:1、注冊在中國境內,且未完成A輪融資的企業;2、符合「專、精、特、新」國家政策扶植的科技類企業,包括但不限於智能汽車產業、半導體晶元、醫葯與生命科學、人工智慧、區塊鏈與元宇宙、機器人、數字孿生、IoT,動力電池與綠色能源、材料科學、資料庫與數據科學應用、航天科技、實體經濟數字化轉型行業解決方案企業,完全自主研發的開源技術企業等,自己也可以去網路。

『柒』 如何在ubuntu server 14.04下安裝gitlab中文版

安裝步驟有:

1. 依賴包
2. ruby
3. 用戶創建
4. 資料庫初始化
5. redis
6. gitlab源碼
7. apache

本文可能會用到VPN連接,在命令行下創建VPN連接的方法如下:

sudo apt-get install pptp-linux
sudo pptpsetup --create VPN名稱 --server 伺服器地址 --username 用戶名 --password 密碼 [--encrypt] --start

以上命令會創建一個設備,如果沒有其他的撥號設備,這個設備會是ppp0,用ifconfig可以看到,「--encrypt」選項可選,因為有的伺服器不支持,會提示MPPE required but peer negotiation failed,創建時帶上「--start」選項可以看到連接的情況。
pptpsetup創建的VPN連接重啟後會失效,如果想在不重啟的情況下刪除VPN連接:

sudo pptpsetup --delete VPN名稱

創建VPN連接後還需要使能,並且添加到路由列表:

sudo pon VPN名稱
sudo route add default dev ppp0

禁用VPN連接的方法是:

sudo poff VPN名稱

下面開始正文:

1. 依賴包

我裝的是ubuntu server 14.04,安裝的時候可以選是否安裝LAMP(Linux+Apache+MySQL+PHP),如果沒裝,可以用下面的命令裝:

sudo tasksel install lamp-server

安裝的時候會提示輸入MySQL的root密碼,下面要用。
接下來是依賴關系:

sudo apt-get install flex bison ruby 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-docutils pkg-config cmake libkrb5-dev nodejs git-core

注意:這裡面裝了ruby,應該是1.9.1版本的,gitlab需要2.0以上的ruby,但是安裝2.0以上的ruby需要低版本的ruby,所以我們先裝上,一會兒卸掉。另外,ubuntu 14.04的軟體庫里有ruby 2.0,但是實測不能用,所以還是從源碼裝ruby吧。

2. ruby

下載,編譯,安裝(安裝前刪掉ruby 1.9.1):

curl -L --progress http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz | tar xz
cd ruby-2.1.5
./configure --prefix=/usr --disable-install-rdoc
make
sudo apt-get autoremove ruby
sudo make install

然後安裝bundler:

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

3. 用戶創建

為gitlab創建一個git用戶:

sudo adser --disabled-login --gecos 'GitLab' git

4. 資料庫初始化

官方指南用的是PostgreSQL,不過官方也有MySQL的說明:
http://doc.gitlab.com/ce/install/database_mysql.html

sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
mysql -u root -p

輸入MySQL的root密碼登陸,然後:

mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '$password';

記得把上面這句的"$password"換成實際的密碼,然後:

mysql> SET storage_engine=INNODB;
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_proction` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_proction`.* TO 'git'@'localhost';
mysql> \q

5. Redis

Redis貌似是用來存key的資料庫吧,不知道,反正按步驟安裝:

sudo apt-get install redis-server
sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig
sed 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.conf
echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.conf
echo 'unixsocketperm 770' | sudo tee -a /etc/redis/redis.conf
sudo service redis-server restart
sudo usermod -aG redis git

6. gitlab源碼

gitlab源碼默認是安裝在/home/git/gitlab,如果要更改,請參照官方手冊。獲取中文版源碼的過程如下:

cd /home/git
sudo -u git -H git clone https://gitlab.com/larryli/gitlab.git

不知道是因為GFW還是什麼,git clone這個版本庫可慢可慢了,我用了VPN,速度會快點。
git clone完以後可以checkout你想要的版本,在本文編寫的時間(2015年4月22日),可以:

sudo -u git -H git checkout 7-7-zh

然後配置源碼

cd /home/git/gitlab
sudo -u git -H cp config/gitlab.yml.example config/gitlab.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 -u git -H mkdir /home/git/gitlab-satellites
sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
sudo chmod -R u+rwX tmp/pids/
sudo chmod -R u+rwX tmp/sockets/
sudo chmod -R u+rwX public/uploads
sudo -u git -H cp config/unicorn.rb.example 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 user.name "GitLab"
sudo -u git -H git config --global user.email "[email protected]"
sudo -u git -H git config --global core.autocrlf input
sudo -u git -H cp config/resque.yml.example config/resque.yml

當然,你可以把[email protected]改成你的email;上面的那些yml文件裡面的配置基本都不用更改;然後,配置資料庫用戶名和密碼:

sudo -u git cp config/database.yml.mysql config/database.yml
sudo -u git -H editor config/database.yml
sudo -u git -H chmod o-rwx config/database.yml

然後,安裝gems:

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

這一步必須使用VPN,因為萬惡的GFW屏蔽了rubygems.org,所以會提示connection reset by peer之類的,這部時間也會比較久,如果你的機器是多核的,也可以加上和make相同-jN參數,N等於核數。

(2015年5月2日追加)
發現淘寶做了個rubygrems.org的國內鏡像,http://ruby.taobao.org/,可以參照上面的內容設置,加快gems安裝速度。

再接下來安裝gitlab shell:

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

把gitlab的url改成http://localhost/或者你的域名。
在接下來初始化資料庫:

sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=proction

加入啟動項:

sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo update-rc.d gitlab defaults 21

初始化日誌:

sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab

檢查應用狀態:

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

編譯附件:

sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=proction

啟動gitlab服務:

sudo service gitlab start

7. apache

下載apache的配置文件:https://gitlab.com/gitlab-org/gitlab-recipes/blob/master/web-server/apache/gitlab-apache2.4.conf
將其中的「ProxyPassReverse
http://gitlab.example.com/」改成「ProxyPassReverse
http://localhost/」或者你的域名,將其中的「/var/log/httpd/logs/」改為「/var/log/apache2/」。
用命令來說:

wget https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/web-server/apache/gitlab-apache2.4.conf
mv gitlab-apache2.4.conf 001-gitlab.conf
editor 001-gitlab.conf (進行上述修改)
sudo cp 001-gitlab.conf /etc/apache2/sites-available
cd /etc/apache2/sites-enabled
sudo rm 000-default.conf
sudo ln -s ../sites-available/001-gitlab.conf 001-gitlab.conf

另外,還需要使能代理模塊以實現反向代理功能,不然會提示「ProxyPassReverse」無效之類的。

cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/proxy.conf proxy.conf
sudo ln -s ../mods-available/proxy.load proxy.load
sudo ln -s ../mods-available/proxy_connect.load proxy_connect.load
sudo ln -s ../mods-available/proxy_http.load proxy_http.load
sudo ln -s ../mods-available/rewrite.load rewrite.load

重啟apache:

sudo service apache2 restart

然後,檢查下配置是否正確:

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=proction

如果都是綠色的結果,那就可以訪問了。登陸用戶名:root,初始密碼:5iveL!fe

最後配置一下郵件,修改/home/git/gitlab/config/gitlab.yml,裡面的「email_from:」為一個有效的email地址;修改/home/git/gitlab/config/environments/proction.rb,裡面的 「config.action_mailer.delivery_method=」為「:smtp」;最後:

cd /home/git/gitlab/config/initializers
sudo -u git -H cp smtp_settings.rb.sample smtp_settings.rb

然後把文件的里的內容修改正確了,再重啟一下gitlab服務就行了:

sudo service gitlab restart

熱點內容
ftp帶字幕 發布:2024-10-11 17:19:37 瀏覽:430
android測試環境 發布:2024-10-11 17:10:45 瀏覽:797
如何查找內網伺服器地址 發布:2024-10-11 16:54:55 瀏覽:394
cvs編譯器哪個好 發布:2024-10-11 16:54:51 瀏覽:676
SQL資料庫文件的類型 發布:2024-10-11 16:35:12 瀏覽:115
安卓手機怎麼下載阿迪達斯 發布:2024-10-11 16:34:20 瀏覽:762
存儲系統的層次結構 發布:2024-10-11 16:28:12 瀏覽:149
Android圖片指定位置 發布:2024-10-11 16:28:05 瀏覽:79
HTML什麼編譯器 發布:2024-10-11 16:22:16 瀏覽:753
精銳一卡通密碼是什麼 發布:2024-10-11 16:17:55 瀏覽:796