gitlab学习-2

使用外部postgres

准备一个虚拟机(此处用vagrant)

vagrant init envimation/ubuntu-xenial

修改Vagrantfile
配置网络模式和Ip
config.vm.network "public_network", ip:"192.168.1.20"

配置内存大小,此处2G
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048" 
end

vagrant ssh

安装

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
安装完了修改

修改配置

 /etc/postgresql/9.5/main/postgresql.conf 中
listen_addresses = 'localhost'改为
listen_addresses = '*'

/etc/postgresql/9.5/main/pg_hba.conf
添加
host    all             all             192.168.1.255/24            md5

添加用户和数据库

sudo -u postgres createuser --superuser gitlab
    sudo -u postgres psql
\password gitlab
输入密码

CREATE DATABASE gitlabhq_production

gitlab配置

禁用内置postgresql
postgresql['enable'] = false

配置外部postgresql
gitlab_rails['db_adapter'] = "postgresql"
gitlab_rails['db_encoding'] = "utf8"
gitlab_rails['db_username'] = "gitlab"
gitlab_rails['db_password'] = 'gitlab'
gitlab_rails['db_host'] = '192.168.1.20'
gitlab_rails['db_port'] = 5432

reconfigure gitlab

vagrant ssh
sudo gitlab-ctl reconfigure

提示

修改虚拟机中文件可以安装编辑器也可以用vagrant的文件共享,也可以scp
文件共享修改

config.vm.synced_folder "/data/share/", "/home/vagrant"

你可能感兴趣的:(gitlab学习-2)