Tuesday, October 1, 2019

docker: Setup Wordpress site with linode/lamp container

This time I tried to setup Wordpress website with deploying linode/lamp container. Here's how I did it.
# Start docker service, and retrieve linode/lamp image.
service docker start

docker pull linode/lamp
# Create docker volume for Wordpress contents.
docker volume create my-vol
# Primarily download Wordpress contents.
curl https://wordpress.org/wordpress-5.0.6.zip -o wordpress-5.0.6.zip
unzip wordpress-5.0.6.zip
mv wordpress/* /var/lib/docker/volumes/my-vol/_data
# Run pulled linode/lamp image with mounting created docker volume.
docker run --name linode-dev -it -v my-vol:/var/www/html -p 80:80  linode/lamp /bin/bash
# Update softwares on linode/lamp.
apt-get update
apt-get install  php5-mysqlnd-ms
# Reconfigure MySQL root password
dpkg-reconfigure mysql-server-5.5
# Setup Wordpress database
mysql -uroot -p
CREATE DATABASE awswp;
GRANT ALL PRIVILEGES ON awswp.* TO "wpdbuser"@"localhost" IDENTIFIED BY "xxxxxx";
# Edit apache2 config file to point Wordpress contents.
vi /etc/apache2/sites-available/example.com.conf
 # domain: example.com
 # public: /var/www/example.com/public_html/

 
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin webmaster@example.com
  ServerName  www.example.com
  ServerAlias example.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  #DocumentRoot /var/www/example.com/public_html
  DocumentRoot /var/www/html
  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/wp/log/error.log
  CustomLog /var/www/wp/log/access.log combined
  #ErrorLog  /var/www/example.com/log/error.log
  #CustomLog /var/www/example.com/log/access.log combined
 
# Start MySQL and Apache daemon
service mysql start
service apache2 start

Now you will see Wordpress page and ready for configuration!

No comments:

Post a Comment