(一) 安装
(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)数据库备份
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
(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)数据库备份
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