Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.hostname = "ub1604greenplum"
config.vm.provider :virtualbox do |vbox|
vbox.name = "ub1604greenplum"
vbox.cpus = 4
vbox.memory = 6144
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
# private network
config.vm.network "private_network", ip: "192.168.55.114", :netmask => "255.255.255.0"
# bridge netwrok
config.vm.network "public_network", ip: "192.168.1.114", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get -y install unzip
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
# install greenplum
apt-get -y install python-pip
pip install --upgrade pip
pip install psutil
pip install lockfile
pip install paramiko
pip install setuptools
pip install conan
apt-get -y install build-essential cmake
wget https://github.com/greenplum-db/gp-xerces/archive/v3.1.2-p1.tar.gz
tar xvfz v3.1.2-p1.tar.gz
cd gp-xerces-3.1.2-p1
mkdir build
cd build
../configure --prefix=/usr/local
make
make install
cd /home/vagrant
wget https://github.com/greenplum-db/gpdb/archive/5.1.0.tar.gz
tar xvfz 5.1.0.tar.gz
chown -R vagrant:vagrant /home/vagrant/gpdb-5.1.0
cd /home/vagrant/gpdb-5.1.0/depends
conan remote add conan-gpdb https://api.bintray.com/conan/greenplum-db/gpdb-oss
conan install --build
cd ..
apt-get -y install libkrb5-dev libapr1-dev libevent-dev libxml2-dev libcurl4-openssl-dev libbz2-dev bison flex libperl-dev
# Configure to install at /usr/local
./configure --with-perl --with-python --with-libxml --with-gssapi --prefix=/usr/local/gpdb
su -l vagrant -c "make -j8"
make -j8 install
su -l vagrant -c "ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''"
su -l vagrant -c "cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys"
su -l vagrant -c "chmod 600 ~/.ssh/authorized_keys"
su -l vagrant -c "source /usr/local/gpdb/greenplum_path.sh && cd /home/vagrant/gpdb-5.1.0 && make create-demo-cluster"
su -l vagrant -c "source /usr/local/gpdb/greenplum_path.sh && cd /home/vagrant/gpdb-5.1.0 && PGPORT=15432 make installcheck-world"
cat << EOF > /home/vagrant/test.sql
create database test;
\\c test
create table test1 ( message varchar(100));
insert into test1 values ('hello world');
select * from test1;
EOF
chown vagrant:vagrant /home/vagrant/test.sql
su -l vagrant -c "source /usr/local/gpdb/greenplum_path.sh && PGPORT=15432 psql postgres -f test.sql"
SHELL
end
0 件のコメント:
コメントを投稿