2017年11月19日日曜日

Vagrantでwallabagをインストールした仮想マシン(Ubuntu16.04)を構築する

以下のVagrantfileを使用して、wallabagをインストールした仮想マシンを構築する事が出来ます。
仮想マシンを構築後、ブラウザからhttp://192.168.1.105/にアクセスする事が出来ます。
ユーザ名はwallabag、パスワードはwallabagです。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/ubuntu-16.04"
  config.vm.hostname = "ub1604wallabag"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "ub1604wallabag"
     vbox.cpus = 2
     vbox.memory = 2048
     vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
  end
  config.vm.network "private_network", ip: "192.168.55.105", :netmask => "255.255.255.0"
  config.vm.network "public_network", ip:"192.168.1.105", :netmask => "255.255.255.0"
  config.vm.provision "shell", inline: <<-SHELL
# update packages
apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
echo "mysql-server-5.7 mysql-server/root_password password root" | sudo debconf-set-selections
echo "mysql-server-5.7 mysql-server/root_password_again password root" | sudo debconf-set-selections
apt-get -y install mysql-server-5.7
mysql -uroot -proot -e "CREATE DATABASE wallabag DEFAULT CHARACTER SET utf8;"
mysql -uroot -proot -e "CREATE USER wallabag@localhost IDENTIFIED BY 'wallabag';"
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON wallabag.* TO 'wallabag'@'localhost';"
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON wallabag.* TO 'wallabag'@'%';"
mysql -uroot -proot -e "FLUSH PRIVILEGES;"
apt-get -y install apache2 libapache2-mod-php7.0
apt-get -y install php7.0-gd php7.0-json php7.0-mysql php7.0-pdo php7.0-curl php7.0-mbstring
apt-get -y install php7.0-mcrypt php7.0-xml php7.0-zip php7.0-gd php7.0-tidy php7.0-bcmath

# install wallabag
mkdir -p wallabag
cd ~/wallabag

wget http://wllbg.org/latest-v2-package
tar xvfz latest-v2-package
mv release-2.2.3 /opt/wallabag


cat << EOF > /opt/wallabag/app/config/parameters.yml
parameters:
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: null
    database_name: wallabag
    database_user: wallabag
    database_password: wallabag
    database_path: null
    database_table_prefix: wallabag_
    database_socket: null
    database_charset: utf8
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    locale: en
    secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv
    twofactor_auth: true
    twofactor_sender: no-reply@wallabag.org
    fosuser_registration: true
    fosuser_confirmation: true
    from_email: no-reply@wallabag.org
    rss_limit: 50
    rabbitmq_host: localhost
    rabbitmq_port: 5672
    rabbitmq_user: guest
    rabbitmq_password: guest
    rabbitmq_prefetch_count: 10
    redis_scheme: tcp
    redis_host: localhost
    redis_port: 6379
    redis_path: null
    redis_password: null
    sites_credentials: {  }
EOF

cat << EOF > /etc/apache2/sites-available/wallabag.conf

    ServerName 192.168.55.104
    DocumentRoot /opt/wallabag/web
    ErrorLog /var/log/apache2/bag.local.error.log
    CustomLog /var/log/apache2/bag.local.access.log combined
    LogLevel warn
    
        AllowOverride All
        Require all granted
    

EOF
cd /opt/wallabag
php bin/console wallabag:install --env=prod -n
chown -R www-data:www-data /opt/wallabag
ln -s  /opt/wallabag /var/www/html

a2ensite wallabag.conf
a2dissite 000-default.conf
systemctl reload apache2.service
echo 'access http://192.168.1.105/'
echo 'user:wallabag  password:wallabag'
SHELL
end

〇ログイン画面


〇wallabagの画面



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

0 件のコメント:

コメントを投稿