Setting up WordPress using the command line is fast.
You can even use a script to automate the process.
Before you begin. Create a MySQL database in Amazon RDS. You also need a working website. Then start creating a list with the following information:
If some points are unclear these how-tos should point you in the right direction:
How to install WP-CLI
How to set up a virtual host
How to activate .htaccess
How to create a MySQL database in Amazon RDS
Your root folder is beneath
/var/www/
In this tutorial are we going to install WordPress in the folder
/var/www/MyDomain1.com
Start with going to the root folder:
cd /var/www/MyDomain1.com
Verify that there are no files in this folder
sudo ls
If here is index.html or another start page file there you should delete this file to avoid problems later on.
sudo -u www-data rm index.html
The Apache web server needs permission to run WordPress.
sudo chown -R www-data /var/www/MyDomain1.com
Downloading all the WordPress files is done in a matter of seconds by issuing this command:
wp core download
Sometimes WP-CLI is unable to connect to Amazon RDS MySQL database. Then you can skip the database test by adding the following statement:
--skip-check
Creating the configuration file in WordPress. Fill in the values from the list you created previously:
wp core config --dbname=wordpress --dbuser=user --dbpass=password --dbhost=dcfgvr.1bagob.0002.euw1.cache.amazonaws.com --dbprefix=wp_ --skip-check
wp core install --url="https://www.example.com" --title="Blog Title" --admin_user="adminuser" --admin_password="password" --admin_email="email@domain.com"
It’s a good practice to examine the error logs. They are here:
cd /var/log/apache2/
sudo nano error.log
sudo nano 01-mydomain1-com-error.log
Basic permission:
sudo chown -R www-data /var/www/MyDomain1.com
More thorogh guide on setting permissions is available her: