gitlab入門教程

來源:互聯網
上載者:User
(一) 安裝 

(1)  chmod +x bitnami-gitlab-7.13.0-0-linux-x64-installer.run 

[root@localhost download]# ./bitnami-gitlab-7.13.0-0-linux-x64-installer.run 
----------------------------------------------------------------------------
Welcome to the Bitnami Gitlab Stack Setup Wizard.

----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want 
to install. Click Next when you are ready to continue.


PhpPgAdmin [Y/n] :Y


GitLab : Y (Cannot be edited)


GitLab CI [Y/n] :Y


Is the selection above correct? [Y/n]: Y


----------------------------------------------------------------------------
Installation folder


Please, choose a folder to install Bitnami Gitlab Stack


Select a folder [/opt/gitlab-7.13.0-0]: /usr/local/gitlab


----------------------------------------------------------------------------
Create Admin account


Bitnami Gitlab Stack admin user creation


Email Address [user@example.com]: wanglitao@tuzuu.com


Login [user]: git


Password :
Please confirm your password :
----------------------------------------------------------------------------
Web Server Port


Please enter the port that the bundled Apache Server will listen to by default.


Apache Web Server Port [80]: 


----------------------------------------------------------------------------
Hostname that will be used to create internal URLs. If this value is incorrect, 
you may be unable to access your Gitlab installation from other computers. It is 
advisable to use a Domain instead of an IP address for compatibility with 
different browsers.


Domain [127.0.0.1]: 


Do you want to configure mail support? [y/N]: N


----------------------------------------------------------------------------
Setup is now ready to begin installing Bitnami Gitlab Stack on your computer.


Do you want to continue? [Y/n]: Y


----------------------------------------------------------------------------
Please wait while Setup installs Bitnami Gitlab Stack on your computer.


 Installing
 0% ______________ 50% ______________ 100%
 #########################################


----------------------------------------------------------------------------
Setup has finished installing Bitnami Gitlab Stack on your computer.


Info: To access the Bitnami Gitlab Stack, go to
http://127.0.0.1:80 from your browser.
Press [Enter] to continue:




使用遠程工具串連postgresql


(1) vim /usr/local/gitlab/apps/gitlabci/htdocs/config/database.yml


  database: bitnami_gitlabci
  pool: 5
  username: bitnami
  password: "d73115599d8b"
  host: 127.0.0.1
  port: 5432




(2) cat vim /usr/local/gitlab/apps/gitlab/htdocs/config/database.yml




production:
  adapter: postgresql
  encoding: unicode
  database: bitnami_gitlab
  pool: 10
  username: bitnami
  password: "d73115599d8b"
  host: 127.0.0.1
  port: 5432
  # port: 5432 





vim /home/gitlab/postgresql/data/pg_hba.conf


http://www.ruanyifeng.com/blog/2013/12/getting_started_with_postgresql.html


gitlab 配置
vim /usr/local/gitlab/postgresql/data/pg_hba.conf 


添加 host    all    all    0.0.0.0/0    md5


vim /usr/local/gitlab/postgresql/data/postgresql.conf 
修改 listen_addresses ='*'


sh /usr/local/gitlab/ctlscript.sh stop postgresql


登入
/usr/local/gitlab/postgresql/bin/psql.bin -U bitnami -d bitnami_gitlab -h 192.168.1.39 -p 5432


或者


./psql -U bitnami -d bitnami_gitlab -h 192.168.1.30 -p 5432




常規配置

su - postgres


pg_ctl stop

pg_ctl start -l /var/lib/pgsql/pgsql.log

pg_dump  bitnami_gitlab >/tmp/tt.sql

備份
pg_dump  bitnami_gitlab >/tmp/my.sql




pg_dump -U bitnami-f mydatabase.sql  bitnami_gitlab










查看原來資料庫密碼


vim /usr/local/gitlab/apps/gitlabci/htdocs/config/database.yml




五、資料庫操作


(1) 啟動資料庫 
pg_ctl start -l /var/lib/pgsql/pgsql.log


關閉資料庫


pg_ctl stop


(2)Database Backup
pg_dump  bitnami_gitlab >/tmp/wlt.sql


(3)匯入
 psql exampledb < /tmp/wlt.sql 






(4) 
基本的資料庫操作,就是使用一般的SQL語言。
# 建立新表?
CREATE TABLE user_tbl(name VARCHAR(20), signup_date DATE);
# 插入資料?
INSERT INTO user_tbl(name, signup_date) VALUES('張三', '2013-12-22');
# 選擇記錄?
SELECT * FROM user_tbl;
# 更新資料?
UPDATE user_tbl set name = '李四' WHERE name = '張三';
# 刪除記錄?
DELETE FROM user_tbl WHERE name = '李四' ;
# 添加欄位?
ALTER TABLE user_tbl ADD email VARCHAR(40);
# 更新結構?
ALTER TABLE user_tbl ALTER COLUMN signup_date SET NOT NULL;
# 更名欄位?
ALTER TABLE user_tbl RENAME COLUMN signup_date TO signup;
# 刪除欄位?
ALTER TABLE user_tbl DROP COLUMN email;
# 表格更名?
ALTER TABLE user_tbl RENAME TO backup_tbl;
# 刪除表格?
DROP TABLE IF EXISTS backup_tbl;










(2) 日常備份


1.設定備份目錄:
vim /home/gitlab/apps/gitlab/htdocs/config/gitlab.yml 


在backup 模組裡面添加備份的目錄
 backup:
    path: "/tmp/backups"   # Relative paths are relative to Rails.root (default: tmp/backups/)








(2) 執行備份操作
// 切換使用者
/home/gitlab/use_gitlab
cd /home/gitlab/apps/gitlab/htdocs/
bundle exec bin/rake gitlab:backup:create RAILS_ENV=production
產生的備份檔案為 
/tmp/backup/1466567296_gitlab_backup.tar




(3) 回複備份操作




/home/gitlab/use_gitlab
cd /home/gitlab/apps/gitlab/htdocs/
bundle exec bin/rake  gitlab:backup:restore RAILS_ENV=production   BACKUP=1466567296
chown git:git -R /home/gitlab/apps/gitlab/repositories













聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.