# Wordpress on VM ## ホスト情報 ``` ip_address: 192.168.11.20 ``` ## VM情報 `Vagrantfile` ``` # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "bento/ubuntu-18.04" config.vm.define "wp01" do |wp| wp.vm.hostname = "wp01" wp.vm.network "forwarded_port", guest: 80, host: 10080 end config.vm.define "wp02" do |wp| wp.vm.hostname = "wp02" wp.vm.network "forwarded_port", guest: 80, host: 20080 end end ``` ## OS環境 ``` $ cat /etc/os-release | grep -e ^ID -e VERSION VERSION="18.04.2 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian VERSION_ID="18.04" VERSION_CODENAME=bionic ``` ## タイムゾーンの変更 ``` $ sudo su - # timedatectl set-timezone Asia/Tokyo # date Fri Sep 13 21:15:41 JST 2019 ``` ## Apacheのインストール ``` # apt -y update # apt -y install apache2 # systemctl enable apache2 # systemctl start apache2 ``` ## アクセステスト クライアント側のブラウザから http://192.168.11.20:${forwarded_port} にアクセスする ![apache](https://i.imgur.com/dfch7GZ.png) ## PHP&MySQL(MariaDB)のインストール ``` # apt -y install php7.2 php7.2-mysql # apt -y install mariadb-server mariadb-client # systemctl enable mariadb # systemctl start mariadb ``` ## Wordpressのインストール ``` # cd /var/www/html # wget https://ja.wordpress.org/latest-ja.tar.gz # tar xvf latest-ja.tar.gz # chmod -R 777 /var/www/html/wordpress/ ``` ## WordPress用データベース作成 `terminal` ``` # mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 42 Server version: 10.1.41-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. ``` ``` MariaDB [(none)]> create database wordpress default character set utf8; MariaDB [(none)]> grant all on wordpress.* to wordpress@localhost identified by 'password'; MariaDB [(none)]> flush privileges; ``` ## WordPressにアクセス クライアント側のブラウザから http://192.168.11.20:${forwarded_port}/wordpress にアクセス ![wordpress](https://i.imgur.com/hAvnjRU.png) アクセスできたら、`さぁ、はじまましょう!` ボタンを押す ## WordPressの設定 Databaseで投入した設定に合わせて情報を入力する 送信後、`インストール実行`ボタンを押す ![](https://i.imgur.com/yHM82ff.png) 残りはガイド通りに入力フォームを適当に入力して、ブログが見れることを確認する ![](https://i.imgur.com/2ucmAms.png) ![](https://i.imgur.com/hhoovt3.png) これでWordpress構築は完了