Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "archlinux/archlinux"
config.vm.hostname = "alpgsql"
config.vm.provider :virtualbox do |vbox|
vbox.name = "alpgsql"
vbox.cpus = 4
vbox.memory = 4096
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.107", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.107", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
# update packages
pacman -Syy
# set locale
pacman --noconfirm -S locale-gen
sed -i -e 's/#ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
# install postgresql
pacman --noconfirm -S postgresql
# initialize postgresql server
sudo -u postgres -H initdb --locale ja_JP.UTF-8 -E UTF8 -D '/var/lib/postgres/data'
echo "listen_addresses='*'" >> /var/lib/postgres/data/postgresql.conf
echo "standard_conforming_strings=off" >> /var/lib/postgres/data/postgresql.conf
#sed -i 's/host.*all.*all.*127.0.0.1/#host all all 127.0.0.1/g' /var/lib/postgres/data/pg_hba.conf
echo "host all all 127.0.0.1/32 password" >> /var/lib/postgres/data/pg_hba.conf
echo "host all all 192.168.1.0/24 password" >> /var/lib/postgres/data/pg_hba.conf
echo "host all all 192.168.55.0/24 password" >> /var/lib/postgres/data/pg_hba.conf
chown -R postgres:postgres /var/lib/postgres/data/
systemctl start postgresql.service
su - postgres << EOF
psql -c "
alter user postgres with password 'postgres';
"
EOF
echo "postgres:postgres" | chpasswd
SHELL
end
0 件のコメント:
コメントを投稿