仮想マシン構築後、ブラウザでhttp://192.168.55.107/drupal/にアクセスして初期設定を行います。
データベース名、データベースユーザ名、データベースパスワードにはdrupalを指定します。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.hostname = "ub1604drupal842pgsql"
config.vm.provider :virtualbox do |vbox|
vbox.name = "ub1604drupal842pgsql"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.107", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.107", :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
apt-get -y install unzip
# install postgresql
apt-get -y install postgresql
echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.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
#locale-gen ja_JP.UTF-8
#localectl set-locale LANG=ja_JP.UTF-8
createdb -T template0 --locale=C --encoding=UTF8 drupal
psql -c "
ALTER DATABASE drupal SET bytea_output = 'escape';
alter user postgres with password 'postgres';
create user drupal with password 'drupal';
grant all privileges on database drupal to drupal;
"
EOF
echo "postgres:postgres" | chpasswd
systemctl restart postgresql.service
systemctl enable postgresql.service
# install apache2 kanboard
apt-get -y install php7.0 libapache2-mod-php7.0 apache2 php7.0-mbstring php7.0-pgsql php7.0-gd php7.0-curl php7.0-dom
wget https://ftp.drupal.org/files/projects/drupal-8.4.2.tar.gz
tar xvfz drupal-8.4.2.tar.gz
mv drupal-8.4.2 /opt/drupal
chown -R www-data:www-data /opt/drupal
sudo ln -s /opt/drupal/ /var/www/html/
cat << EOF >> /etc/apache2/apache2.conf
<Directory /var/www/html>
AllowOverride All
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>
EOF
a2enmod rewrite
systemctl restart apache2
echo 'access http://192.168.55.107/drupal/'
echo 'db:drupal user: drupal, password: drupal'
SHELL
end
〇Drupal初期設定画面1

〇Drupal初期設定画面2

〇Drupal初期設定画面3

〇Drupal初期設定画面4

〇Drupal画面

○関連情報
・Drupalに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿