2019年2月10日日曜日

VagrantでMiniflux2がインストールされた仮想マシン(Debian Stretch/9.6)を構築する

Miniflux2はGo製のfeed readerです。

○Miniflux2の画面


〇構築方法
以下のVagrantfileを使用して、Miniflux2とPostgreSQL11がインストールされた仮想マシン(Debian Stretch/9.6)を構築する事ができます。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/debian-9.6"
  config.vm.hostname = "db96miniflux"
config.vm.network "public_network", ip:"192.168.1.103", :netmask => "255.255.255.0"
config.vm.network "private_network", ip: "192.168.55.103", :netmask => "255.255.255.0"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "db96miniflux"
     vbox.gui = true
     vbox.cpus = 2
     vbox.memory = 2048
  end
  config.vm.provision "shell", inline: <<-SHELL
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
apt-get -y install task-japanese gawk
sed -i -e 's/# ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
update-locale LANG=ja_JP.UTF-8
localectl set-locale LANG=ja_JP.UTF-8
localectl set-keymap jp106
timedatectl set-timezone Asia/Tokyo

# install postgresql
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
apt-get -y install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt-get update
apt-get upgrade
apt-get -y install postgresql-11

echo "listen_addresses='*'" >> /etc/postgresql/11/main/postgresql.conf

echo "host    all         all         127.0.0.1/32          password" >> /etc/postgresql/11/main/pg_hba.conf
echo "host    all         all         192.168.1.0/24          password" >> /etc/postgresql/11/main/pg_hba.conf
echo "host    all         all         192.168.55.0/24          password" >> /etc/postgresql/11/main/pg_hba.conf

systemctl restart postgresql.service
su - postgres << EOF
createdb -T template0 --locale=ja_JP.UTF-8 --encoding=UTF8 miniflux2
psql -c "
alter user postgres with password 'postgres';
create user miniflux with password 'miniflux';
grant all privileges on database miniflux2 to miniflux;
"
EOF
echo "postgres:postgres" | chpasswd
systemctl restart postgresql.service

wget https://github.com/miniflux/miniflux/releases/download/2.0.14/miniflux_2.0.14_amd64.deb
dpkg -i miniflux_2.0.14_amd64.deb

echo "DATABSE_URL=postgres://miniflux:miniflux@localhost/miniflux2?sslmode=disable" >> /etc/miniflux.conf

miniflux -migrate

apt-get -y install expect
/usr/bin/expect << EOF
spawn miniflux -create-admin
expect "Enter Username:"
send "admin\\r"
expect "Enter Password:"
send "admin123\\r"
expect eof
exit
EOF
systemctl enable miniflux
systemctl start miniflux

echo 'access http://192.168.55.103:8080/'
echo 'user: admin  password: admin123'
echo 'sample feed: http://serverarekore.blogspot.com/feeds/posts/default'

SHELL
end


○関連情報
・Minifluxに関する他の記事はこちらを参照してください。


○関連情報
・Minifluxに関する他の記事はこちらを参照してください。

0 件のコメント:

コメントを投稿