2018年2月26日月曜日

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

selfossはPHP製のフィードリーダーです。
以下のVagrantfileを使用して、selfossとPostgreSQLがインストールされた仮想マシンを構築する事が出来ます。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/ubuntu-16.04"
  config.vm.hostname = "ub1604selfosspg"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "ub1604selfosspg"
     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
sed -i.bak -e "s#http://archive.ubuntu.com/ubuntu/#http://ftp.riken.jp/pub/Linux/ubuntu/#g" /etc/apt/sources.list
apt-get update
apt-get -y install language-pack-ja
localectl set-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja"
localectl set-keymap jp106
#DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

# install postgresql
apt-get -y install postgresql
echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf
echo "standard_conforming_strings=off" >> /etc/postgresql/9.5/main/postgresql.conf

sed -i 's/host.*all.*all.*127.0.0.1/#host    all             all             127.0.0.1/g' /etc/postgresql/9.5/main/pg_hba.conf

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

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


# install selfoss
apt-get -y install apache2 apache2-bin libapache2-mod-php7.0 php7.0-pgsql php7.0-mbstring php7.0-xml php7.0-gd unzip
mkdir -p /opt/selfoss
cd /opt/selfoss
wget https://github.com/SSilence/selfoss/releases/download/2.17/selfoss-2.17.zip
unzip selfoss-2.17.zip
cp defaults.ini config.ini
sed -i -e 's/db_type=sqlite/db_type=pgsql/' config.ini
#db_host=localhost
#db_database=selfoss
sed -i -e 's/db_username=root/db_username=selfoss/' config.ini
sed -i -e 's/db_password=/db_password=selfoss/' config.ini
sed -i -e 's/db_port=/db_port=5432/' config.ini
echo '0,10,20,30,40,50 * * * * root /usr/bin/php /opt/selfoss/cliupdate.php' >> /etc/crontab
systemctl restart cron

chown -R www-data:www-data /opt/selfoss
ln -s  /opt/selfoss /var/www/html
cat << EOF >> /etc/apache2/apache2.conf
<Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>
EOF
a2enmod rewrite
service apache2 restart

echo 'access http://192.168.1.105/selfoss/'
echo 'sample feed: http://serverarekore.blogspot.com/feeds/posts/default'
SHELL
end

〇selfossの画面

VagrantでAptana Studio、Cinnamon Desktop環境、XRDPがインストールされた仮想マシン(Debian Stretch/9.3)を構築する

Aptana Studioは Java製のWebオーサリングツールです。
以下のVagrantfileを使用して、Aptana Studio、Cinnamon Desktop環境、XRDPをインストールした仮想マシン(Debian Stretch/9.3) を構築できます。
XRDPがインストールされているので、Windowsのリモートデスクトップで接続することができます。ユーザ名はVagrant、パスワードもVagrantでログオンできます。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/debian-9.3"
  config.vm.hostname = "db93cinnamonaptanastudio"
config.vm.network "public_network", ip:"192.168.1.116", :netmask => "255.255.255.0"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "db93cinnamonaptanastudio"
     vbox.gui = true
     vbox.cpus = 4
     vbox.memory = 4096
  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
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
apt-get update
cat << EOF > /etc/default/keyboard
XKBMODEL="pc106"
XKBLAYOUT="jp"
XKBVARIANT=""
XKBOPTIONS=""
BACKSPACE="guess"
EOF
cat << EOF > /home/vagrant/.xsessionrc
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
sed -i -e "s/^EnabledIMList.*$/EnabledIMList=fcitx-keyboard-jp:True,mozc:True,fcitx-keyboard-us:False/" /home/vagrant/.config/fcitx/profile
fcitx-remote -r
fcitx -r -d
EOF
chown vagrant:vagrant .xsessionrc
apt-get -y install  xrdp fcitx-mozc task-cinnamon-desktop tigervnc-standalone-server

apt-get -y install build-essential module-assistant dkms
wget http://download.virtualbox.org/virtualbox/5.2.6/VBoxGuestAdditions_5.2.6.iso
mount -o loop -t iso9660 VBoxGuestAdditions_5.2.6.iso /media/
/media/VBoxLinuxAdditions.run


im-config -n fcitx
sudo -u vagrant bash -i -c "export DISPLAY=:0.0 && fcitx -r"

cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.org
cat /etc/xrdp/xrdp.ini.org | gawk '/\\[Globals\\]/,/\\[Xorg\\]/' | sed -e 's/\\[Xorg\\]//' > /etc/xrdp/xrdp.ini
cat << EOF >> /etc/xrdp/xrdp.ini
[Xvnc]
name=Xvnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=-1
EOF
systemctl restart xrdp
systemctl enable xrdp


# install oracle java
apt-get -y install software-properties-common
add-apt-repository ppa:webupd8team/java
apt-get update
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
apt-get install -y --allow-unauthenticated oracle-java8-installer oracle-java8-set-default

# install aptana studio
apt-get -y install unzip
wget https://github.com/aptana/studio3/releases/download/v3.6.1/Aptana_Studio_3_Setup_Linux_x86_64_3.6.1.zip
unzip Aptana_Studio_3_Setup_Linux_*
mv Aptana_Studio_3 /opt
apt-get -y install chromium libjpeg62 libwebkitgtk-1.0-0

cat << EOF > /usr/share/applications/aptana.desktop
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/opt/Aptana_Studio_3/AptanaStudio3
Icon=/opt/Aptana_Studio_3/icon.xpm
Name=Aptana Studio
Categories=Development;
EOF


init 5
SHELL
end

○Aptana Studioの画面

VagrantでEasy!AppointmentsとMySQLがインストールされた仮想マシン(Debian Stretch/9.3)を構築する

Easy!Appointmentsでスケジュールを管理する事ができます。
以下のVagrantfileを使用して、Easy!AppointmentsとMySQLをインストールした仮想マシン(Debian Stretch/9.3)を構築する事ができます。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/debian-9.3"
  config.vm.hostname = "db93easyappointments"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "db93easyappointments"
     vbox.cpus = 2
     vbox.memory = 2048
     vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
  end
config.vm.network "private_network", ip: "192.168.55.101", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.101", :netmask => "255.255.255.0"
  config.vm.provision "shell", inline: <<-SHELL
apt-get -y install task-japanese
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
apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

# install mysql
wget https://dev.mysql.com/get/mysql-apt-config_0.8.9-1_all.deb
export DEBIAN_FRONTEND=noninteractive
echo mysql-apt-config mysql-apt-config/enable-repo select mysql-5.7-dmr | sudo debconf-set-selections
dpkg -i mysql-apt-config_0.8.9-1_all.deb
apt-get update
apt-get -y install mysql-server
mysql -uroot -e "CREATE DATABASE easyappointments DEFAULT CHARACTER SET utf8;"
mysql -uroot -e "CREATE USER easyappointments@localhost IDENTIFIED BY 'easyappointments';"
mysql -uroot -e "GRANT ALL PRIVILEGES ON easyappointments.* TO 'easyappointments'@'localhost';"
mysql -uroot -e "FLUSH PRIVILEGES;"


# install Easy!Appointments
apt-get -y install apache2 apache2-bin libapache2-mod-php7.0 php7.0-mysql php7.0-mbstring php7.0-xml php7.0-json unzip
mkdir -p /opt/easyappointments
cd /opt/easyappointments
wget https://github.com/alextselegidis/easyappointments/releases/download/1.2.1/easyappointments_1.2.1.zip
unzip easyappointments_1.2.1.zip
sed -i -e "s#http://url-to-easyappointments-directory#http://192.168.55.101/easyappointments/#" /opt/easyappointments/config.php
sed -i -e "s#DB_HOST.*= '';#DB_HOST       = 'localhost';#" /opt/easyappointments/config.php
sed -i -e "s#DB_NAME.*= '';#DB_NAME       = 'easyappointments';#" /opt/easyappointments/config.php
sed -i -e "s#DB_USERNAME.*= '';#DB_USERNAME   = 'easyappointments';#" /opt/easyappointments/config.php
sed -i -e "s#DB_PASSWORD.*= '';#DB_PASSWORD   = 'easyappointments';#" /opt/easyappointments/config.php

chown -R www-data:www-data /opt/easyappointments
ln -s  /opt/easyappointments /var/www/html
service apache2 restart

echo 'access http://192.168.1.101/easyappointments/'

SHELL
end

〇Easy!Appointmentsの初期設定画面


〇Easy!Appointmentsの画面


2018年2月25日日曜日

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

EspoCRMはPHP製のCRMソフトウェアです。
以下のVagrantfileを使用して、EspoCRM、MySQLがインストールされた仮想マシン(Ubuntu16.04)を構築する事ができます。
仮想マシン構築後、http://192.168.55.105/にアクセスして初期設定を行います。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/ubuntu-16.04"
  config.vm.hostname = "ub1604espocrm"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "ub1604espocrm"
     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


# install mysql
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 espocrm DEFAULT CHARACTER SET utf8mb4;"
mysql -uroot -proot -e "CREATE USER espocrm@localhost IDENTIFIED BY 'espocrm';"
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON espocrm.* TO 'espocrm'@'localhost';"
mysql -uroot -proot -e "FLUSH PRIVILEGES;"


# install EspoCRM
apt-get -y install apache2 libapache2-mod-php7.0 php7.0 php7.0-mysql php7.0-mbstring php7.0-xml php7.0-gd php7.0-zip php7.0-curl unzip php7.0-mcrypt php7.0-json php7.0-imap

wget https://www.espocrm.com/downloads/EspoCRM-5.0.5.zip
unzip EspoCRM-5.0.5.zip
mv EspoCRM-5.0.5 /opt/espocrm
sed -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 20M/'  /etc/php/7.0/apache2/php.ini
sed -i -e 's#;date.timezone =#date.timezone = Asia/Tokyo#'  /etc/php/7.0/apache2/php.ini
sed -i -e 's#max_execution_time = 30#max_execution_time = 180#'  /etc/php/7.0/apache2/php.ini
sed -i -e 's#max_input_time = 60#max_input_time = 180#'  /etc/php/7.0/apache2/php.ini
sed -i -e 's#memory_limit = 128M#memory_limit = 256M#'  /etc/php/7.0/apache2/php.ini
sed -i -e 's#post_max_size = 8M#post_max_size = 20M#'  /etc/php/7.0/apache2/php.ini


chown -R www-data:www-data /opt/espocrm
#ln -s  /opt/espocrm /var/www/html
cat << EOF > /etc/apache2/sites-available/espocrm.conf
<VirtualHost *:80>
    ServerName 192.168.55.105
    DocumentRoot /opt/espocrm
    <Directory /opt/espocrm>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
EOF
a2enmod rewrite
a2ensite espocrm.conf
a2dissite 000-default.conf
systemctl restart apache2.service

echo '* * * * * cd /opt/espocrm; /usr/bin/php -f cron.php > /dev/null 2>&1' >> /var/spool/cron/crontabs/www-data

echo 'access http://192.168.55.105/'
SHELL
end

○EspoCRMの初期設定画面1


○EspoCRMの初期設定画面2


○EspoCRMの初期設定画面3


○EspoCRMの初期設定画面4


○EspoCRMの初期設定画面5


○EspoCRMの初期設定画面6


○EspoCRMの初期設定画面7


○EspoCRMの初期設定画面8


○EspoCRMの画面


VagrantでSnipe-IT、MySQLがインストールされた仮想マシン(Ubuntu16.04)を構築する

Snipe-ITを使用して、資産管理を行う事ができます。
以下のVagrantfileを使用して、Snipe-IT、MySQLをインストールした仮想マシン(Ubuntu16.04)を構築する事ができます。
仮想マシン構築後、ブラウザからhttp://192.168.1.105/にアクセスして初期設定を行います。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/ubuntu-16.04"
  config.vm.hostname = "ub1604snipeit"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "ub1604snipeit"
     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
sed -i.bak -e "s#http://archive.ubuntu.com/ubuntu/#http://ftp.riken.jp/pub/Linux/ubuntu/#g" /etc/apt/sources.list
apt-get update
apt-get -y install language-pack-ja
localectl set-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja"
localectl set-keymap jp106
#DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

# install mysql
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 snipeit DEFAULT CHARACTER SET utf8mb4;"
mysql -uroot -proot -e "CREATE USER snipeit@localhost IDENTIFIED BY 'snipeit';"
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON snipeit.* TO 'snipeit'@'localhost';"
mysql -uroot -proot -e "FLUSH PRIVILEGES;"


# install php
apt-get -y install apache2 libapache2-mod-php7.0 php7.0 php7.0-mysqlnd php7.0-pdo php7.0-mbstring php7.0-curl php7.0-mcrypt php7.0-xml php7.0-gd php7.0-zip php7.0-ldap php7.0-bcmath unzip curl git

# install composer
curl -s https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

mkdir -p /opt/snipeit
git clone https://github.com/snipe/snipe-it /opt/snipeit
cd /opt/snipeit
composer install --no-dev --prefer-source
composer dump-autoload

cp /opt/snipeit/.env.example /opt/snipeit/.env
sed -i -e "s#APP_URL=null#APP_URL=http://192.168.1.105/#" /opt/snipeit/.env
sed -i -e "s#APP_TIMEZONE='UTC'#APP_TIMEZONE='Asia/Tokyo'#" /opt/snipeit/.env
sed -i -e "s#APP_LOCALE=en#APP_LOCALE=ja#" /opt/snipeit/.env
sed -i -e "s#DB_DATABASE=null#DB_DATABASE=snipeit#" /opt/snipeit/.env
sed -i -e "s#DB_USERNAME=null#DB_USERNAME=snipeit#" /opt/snipeit/.env
sed -i -e "s#DB_PASSWORD=null#DB_PASSWORD=snipeit#" /opt/snipeit/.env
php artisan migrate --force
php artisan key:generate --force
php artisan config:clear
php artisan config:cache

chown -R www-data:www-data /opt/snipeit
chmod -R 755 /opt/snipeit/storage
chmod -R 755 /opt/snipeit/public/uploads
chmod -R 755 /opt/snipeit/bootstrap/cache

ln -s  /opt/snipeit/public /var/www/html
cat << EOF > /etc/apache2/sites-available/snipeit.conf
<VirtualHost *:80>
    ServerName 192.168.55.105
    DocumentRoot /opt/snipeit/public
    <Directory /opt/snipeit/public>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
EOF
a2enmod rewrite
a2ensite snipeit.conf
a2dissite 000-default.conf
systemctl restart apache2.service

echo 'access http://192.168.1.105/'
SHELL
end

〇Snipe-ITの初期設定画面1


〇Snipe-ITの初期設定画面2


〇Snipe-ITの初期設定画面3


〇Snipe-ITの画面


Raspberry Pi上のDockerでNextcloudがインストールされたコンテナ(Alpine 3.7)を構築する

NextcloudはDropboxのようなファイルを共有できるサーバーアプリケーションです。
以下の手順で、NextcloudとMySQLのコンテナを構築・実行します。

○構築方法
1. Nextcloudイメージの作成(Dockerfileがあるフォルダで実行)
docker build -t nextcloud .

Dockerfile
FROM alpine:3.7
WORKDIR /
RUN  apk update \
  && apk add --no-cache apache2 php7-apache2 php7-mysqli php7-pdo php7-pdo_mysql php7-intl php7-mcrypt php7-mbstring php7-session php7-curl php7-json php7-xml php7-zip php7-tokenizer php7-ctype php7-gd php7-xmlwriter php7-xmlreader php7-dom php7-zlib php7-iconv php7-simplexml openssl openrc unzip \
  && rm -rf /var/cache/apk/* \
  && wget https://download.nextcloud.com/server/releases/nextcloud-12.0.4.zip \
  && unzip nextcloud-12.0.4.zip \
  && rm -f nextcloud-12.0.4.zip \
  && mkdir -p /opt \
  && mv nextcloud /opt/nextcloud \
  && mkdir -p /opt/nextcloud/data \
  && chown -R apache:apache /opt/nextcloud \
  && ln -s  /opt/nextcloud /var/www/localhost/htdocs \
  && mkdir -p /run/apache2
EXPOSE 80
VOLUME /opt/nextcloud
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]

2. NextcloudとMySQLコンテナの構築・実行(docker-compose.ymlがあるフォルダで実行)
docker-compose up -d

docker-compose.yml
version: "2"
services:
  nextcloud:
    image: nextcloud
    container_name: "nextcloud"
    volumes:
      - "nextcloud-data:/opt/nextcloud"
    ports:
      - "80:80"
    depends_on:
      - db
  db:
    image: hypriot/rpi-mysql:5.5
    command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    container_name: "nextcloud-db"
    volumes:
      - "db-data:/var/lib/mysql"
    environment:
        MYSQL_DATABASE: nextcloud
        MYSQL_ROOT_PASSWORD: nextcloud
volumes:
  db-data:
    driver: local
  nextcloud-data:
    driver: local

3. ブラウザからhttp://<Dockerホストの名またはIP>/nextcloud/にアクセス
Installer画面で以下の項目を入力し、「セットアップを完了します」をクリックする
データベースのユーザ名: root
データベースのパスワード: nextcloud
データベース名: nextcloud
データベースのホスト名: db:3306
他の項目は好みに合わせて入力


○Nextcloudの画面


〇動作環境
動作環境:arm32(Raspberry Pi 3 Model B)
Raspberry Piでdocker-composeを使用するには、「Raspberry Pi Raspbian GNU/Linux 9 (stretch)にdocker-composeをインストールする」を参照してください。

VagrantでProjectLibre、Xfce Desktop環境、XRDPがインストールされた仮想マシン(Debian Stretch/9.3)を構築する

ProjectLibre を使用してMicrosoft Projectのようにプロジェクト管理を行う事ができます。
以下のVagrantfileを使用して、ProjectLibre 、Xfce Desktop環境、XRDPをインストールした仮想マシン(Debian Stretch/9.3) を構築できます。
XRDPがインストールされているので、Windowsのリモートデスクトップで接続することができます。ユーザ名はVagrant、パスワードもVagrantでログオンできます。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/debian-9.3"
  config.vm.hostname = "db93xfceprojectlibre"
config.vm.network "public_network", ip:"192.168.1.115", :netmask => "255.255.255.0"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "db93xfceprojectlibre"
     vbox.gui = true
     vbox.cpus = 4
     vbox.memory = 4096
  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
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
apt-get update
cat << EOF > /etc/default/keyboard
XKBMODEL="pc106"
XKBLAYOUT="jp"
XKBVARIANT=""
XKBOPTIONS=""
BACKSPACE="guess"
EOF
cat << EOF > /home/vagrant/.xsessionrc
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
sed -i -e "s/^EnabledIMList.*$/EnabledIMList=fcitx-keyboard-jp:True,mozc:True,fcitx-keyboard-us:False/" /home/vagrant/.config/fcitx/profile
fcitx-remote -r
fcitx -r -d
EOF
chown vagrant:vagrant .xsessionrc
apt-get -y install  xrdp fcitx-mozc task-xfce-desktop tigervnc-standalone-server fcitx-tools

apt-get -y install build-essential module-assistant dkms
wget http://download.virtualbox.org/virtualbox/5.2.6/VBoxGuestAdditions_5.2.6.iso
mount -o loop -t iso9660 VBoxGuestAdditions_5.2.6.iso /media/
/media/VBoxLinuxAdditions.run


export DISPLAY=:0.0
im-config -n fcitx
sudo -u vagrant bash -i -c "export DISPLAY=:0.0 && fcitx -r"
cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.org
cat /etc/xrdp/xrdp.ini.org | awk '/\\[Globals\\]/,/\\[Xorg\\]/' | sed -e 's/\\[Xorg\\]//' > /etc/xrdp/xrdp.ini
cat << EOF >> /etc/xrdp/xrdp.ini
[Xvnc]
name=Xvnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=-1
EOF
systemctl restart xrdp
systemctl enable xrdp


# install java
apt-get -y install openjdk-8-jdk

# install projectlibre
wget https://sourceforge.net/projects/projectlibre/files/ProjectLibre/1.7/projectlibre_1.7.0-1.deb
dpkg -i projectlibre_1.7.0-1.deb


init 5
SHELL
end

〇ProjectLibreの画面