Table of Contents
WordPress + LAMP: Popular CMS and Web Server
Install WordPress on Ubuntu 18.04 Using a LAMP
Requirements for Setting Up WordPress on Ubuntu 18.04
Step 1: Create a database for WordPress user
mysql -u root -p
mysql> CREATE DATABASE wordpressdb;
mysql> mysql> GRANT ALL ON wordpress.* TO 'admin-suser'@'localhost' IDENTIFIED BY 'PASSWORD';
mysql> FLUSH PRIVILEGES;
mysql> EXIT;
Step 2: Install additional PHP extensions
# sudo apt update
# sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php- soap php-intl php-zip
# sudo systemctl restart apache2
Step 3: Download WordPress
# cd /var/www/```
# curl -O https://wordpress.org/latest.tar.gz
# tar -xvf latest.tar.gz
# rm latest.tar.gz
Step 4: Configure the wordpress directory
# sudo chown -R www-data:www-data /var/www/wordpress
# sudo find /var/www/wordpress/ -type d -exec chmod 750 {} \;
# sudo find /var/www/wordpress/ -type f -exec chmod 640 {} \;
# cd /var/www/wordpress
# mv wp-config-sample.php wp-config.php
# vim wp-config.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpressdb');
/** MySQL database username */
define('DB_USER', 'admin-user');
/** MySQL database password */
define('DB_PASSWORD', 'StrongPassword');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
# curl -s https://api.wordpress.org/secret-key/1.1/salt/
define('AUTH_KEY', 'UV>...SAMPLE ONLY...COPY YOUR OWN VALUES...mL)');
define('SECURE_AUTH_KEY', 'bn(UV>...SAMPLE ONLY...COPY YOUR OWN VALUES...emL)zx');
define('LOGGED_IN_KEY', '-naUV>...SAMPLE ONLY...COPY YOUR OWN VALUES...emL{fY');
define('NONCE_KEY', '{xNwUV>...SAMPLE ONLY...COPY YOUR OWN VALUES...emL8Fq');
define('AUTH_SALT', 'j+;UV>...SAMPLE ONLY...COPY YOUR OWN VALUES...emLZpu');
define('SECURE_AUTH_SALT', '0M=UV>...SAMPLE ONLY...COPY YOUR OWN VALUES...emL*xC');
define('LOGGED_IN_SALT', 'G&2UV>...SAMPLE ONLY...COPY YOUR OWN VALUES...emLps+');
define('NONCE_SALT', '2gZUV>...SAMPLE ONLY...COPY YOUR OWN VALUES...emLh/L');
# vim wp-config.php
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');
Step 5: Modify Apache configuration
# vim /etc/apache2/sites-available/000-default.conf
<Directory /var/www/wordpress/>
AllowOverride All
</Directory>
# sudo a2enmod rewrite
# sudo apache2ctl configtest
# sudo systemctl restart apache2
Step 6: Run WordPress installation using the web browser
http://server_IP_address or http://YOUR-DOMAIN
Hit the ‘Login’ button and you’ll head to the world-famous WordPress dashboard that you see below: