2018年3月9日金曜日

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

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

Vagrantfile
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/centos-7.4"
  config.vm.hostname = "co74easyappointments"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "co74easyappointments"
     vbox.cpus = 2
     vbox.memory = 2048
     vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
  end
  config.vm.network "private_network", ip: "192.168.55.104", :netmask => "255.255.255.0"
  config.vm.network "public_network", ip:"192.168.1.104", :netmask => "255.255.255.0"
  config.vm.provision "shell", inline: <<-SHELL
localectl set-locale LANG=ja_JP.UTF-8

# install mysql
sudo yum -y remove mariadb-libs
yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum -y install yum-utils
yum-config-manager --disable mysql57-community
yum-config-manager --enable mysql56-community
yum -y install mysql mysql-devel mysql-server mysql-utilities
sudo systemctl enable mysqld.service
sudo systemctl start mysqld.service

# change password and create users and databases.
chkconfig mysqld on
service mysqld start
export MYSQL_ROOTPWD='Root123#'
export MYSQL_PWD=`cat /var/log/mysqld.log | awk '/temporary password/ {print $NF}'`
mysql -uroot --connect-expired-password -e "SET PASSWORD = PASSWORD('$MYSQL_ROOTPWD');"
export MYSQL_PWD=$MYSQL_ROOTPWD
export MYSQL_ROOTPWD='root'
mysql -uroot --connect-expired-password -e "UNINSTALL PLUGIN validate_password;"
mysql -uroot --connect-expired-password -e "SET PASSWORD = PASSWORD('$MYSQL_ROOTPWD'); FLUSH PRIVILEGES;"
mysql -uroot -proot -e "CREATE DATABASE easyappointments DEFAULT CHARACTER SET utf8;"
export MYSQL_PWD=$MYSQL_ROOTPWD

mysql -uroot -proot -e "CREATE USER easyappointments@localhost IDENTIFIED BY 'easyappointments';"
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON easyappointments.* TO 'easyappointments'@'localhost';"
mysql -uroot -proot -e "FLUSH PRIVILEGES;"


# install apache2
yum -y install --enablerepo=remi,remi-php71 httpd php php-devel php-mbstring php-pdo php-mysqlnd php-gd php-xml php-zip
sed -i -e 's#;date.timezone =#date.timezone="Asia/Tokyo"#' /etc/php.ini

# install Easy!Appointments
mkdir -p /opt/easyappointments
cd /opt/easyappointments
yum -y install unzip
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.104/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 apache:apache /opt/easyappointments
ln -s  /opt/easyappointments /var/www/html
service httpd restart

echo 'access http://192.168.1.104/easyappointments/'
SHELL
end

〇Easy!Appointmentsの初期設定画面


〇Easy!Appointmentsの画面



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

0 件のコメント:

コメントを投稿