2017年11月23日木曜日

VagrantでCMS Made SimpleとMySQLをインストールした仮想マシン(CentOS7.4)を構築する

以下のVagrantfileを使用して、CMS Made SimpleとMySQLをインストールした仮想マシンを構築できます。
仮想マシン構築後、ブラウザからhttp://192.168.55.108/cmsms-2.2.3.1-install.phpにアクセスして初期設定を行います。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"

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

# 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 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 cmsms DEFAULT CHARACTER SET utf8;"
export MYSQL_PWD=$MYSQL_ROOTPWD

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

# install
yum -y install epel-release
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

# install apache2 and cmsms
yum -y install --enablerepo=remi,remi-php71 httpd php php-devel php-mbstring php-pdo php-mysql php-gd php-xml php-zip

# download CMS made simple
yum -y install unzip
wget -c http://s3.amazonaws.com/cmsms/downloads/13927/cmsms-2.2.3.1-install.zip
unzip cmsms-2.2.3.1-install.zip
mkdir cmsms
mv cmsms-2.2.3.1-install.php cmsms
mv cmsms /var/www
chown -R apache:apache /var/www/cmsms
sed -i -e 's#DocumentRoot "/var/www/html"#DocumentRoot "/var/www/cmsms"#' /etc/httpd/conf/httpd.conf
systemctl enable httpd
systemctl restart httpd

echo 'access http://192.168.55.108/cmsms-2.2.3.1-install.php'
echo 'db: cmsms, user: cmsms, password: cmsms'

SHELL
end

〇CMS Made Simpleの初期設定画面1


〇CMS Made Simpleの初期設定画面2


〇CMS Made Simpleの初期設定画面3


〇CMS Made Simpleの初期設定画面4


〇CMS Made Simpleの初期設定画面5


〇CMS Made Simpleの初期設定画面6


〇CMS Made Simpleの初期設定画面7


〇CMS Made Simpleの初期設定画面8


〇CMS Made Simpleの初期設定画面9


〇CMS Made Simpleの管理者画面


0 件のコメント:

コメントを投稿