Lab 5-3: Setting up WordPress on LAMP
Install WordPress:
Download the latest WordPress installation package with the wget command. The following command should always download the latest release.
Unzip and unarchive the installation package. The installation folder is unzipped to a folder called wordpress
.
Log in to the database server as the root
user. Enter your database root
password when prompted; this may be different than your root
system password, or it may even be empty if you have not secured your database server.
Create a user and password for your MySQL database. Your WordPress installation uses these values to communicate with your MySQL database. Enter the following command, substituting a unique user name and password.
Create your database. Give your database a descriptive, meaningful name, such as wordpress-db
.
Grant full privileges for your database to the WordPress user that you created earlier.
Flush the database privileges to pick up all of your changes.
Exit the mysql
client.
To create and edit the wp-config.php file
Copy the wp-config-sample.php
file to a file called wp-config.php
. This creates a new configuration file and keeps the original sample file intact as a backup.
Edit the wp-config.php
file with your favorite text editor (such as nano or vim) and enter values for your installation. If you do not have a favorite text editor, vi
is suitable for beginners.
Find the section called Authentication Unique Keys and Salts
. These KEY
and SALT
values provide a layer of encryption to the browser cookies that WordPress users store on their local machines. Basically, adding long, random values here makes your site more secure. You can create unique values by visiting https://api.wordpress.org/secret-key/1.1/salt/ Links to an external site. Links to an external site.to randomly generate a set of key values that you can copy and paste into your wp-config.php
file. To paste text into a PuTTY terminal, place the cursor where you want to paste the text and right-click your mouse inside the PuTTY terminal.
WordPress will run at your document root, socopy the contents of the wordpress installation directory (but not the directory itself) as follows:
Open the httpd.conf
file with your favorite text editor (such as nano or vim). If you do not have a favorite text editor, nano
is suitable for beginners.
Change the AllowOverride None
line in the above section to read AllowOverride All
.
Note
There are multiple AllowOverride
lines in this file; be sure you change the line in the <Directory "/var/www/html">
section.
To install the PHP graphics drawing library on Amazon Linux 2:
Use the following command to install the PHP graphics drawing library on Amazon Linux 2. For example, if you installed php7.2 from amazon-linux-extras as part of installing the LAMP stack, this command installs version 7.2 of the PHP graphics drawing library.
To verify the installed version, use the following command:
To fix file permissions for the Apache web server
Grant file ownership of /var/www
and its contents to the apache
user.
Grant group ownership of /var/www
and its contents to the apache
group.
Change the directory permissions of /var/www
and its subdirectories to add group write permissions and to set the group ID on future subdirectories.
Recursively change the file permissions of /var/www
and its subdirectories to add group write permissions.
Restart the Apache web server to pick up the new group and permissions.
To run the WordPress installation script with Amazon Linux 2
Use the systemctl command to ensure that the httpd
and database services start at every system boot.
SUBMIT: Screenshot of Post-Install Wordpress Site.
Last updated