Objective
The objective is to install WordPress on Ubuntu 18.04 Bionic Beaver Linux
Operating System and Software Versions
- Operating System: – Ubuntu 18.04 Bionic Beaver
- Software: – WordPress 4.9.4 or higher
Requirements
Privileged access to your Ubuntu System as root or via sudo
command is required.
Conventions
- # – requires given linux commands to be executed with root privileges either directly as a root user or by use of
sudo
command - $ – requires given linux commands to be executed as a regular non-privileged user
Other Versions of this Tutorial
Instructions
Prerequsites
Let’s start by prerequisites. For the WordPress installation we will need curl
, unzip
and tasksel
command. The following linux command will install all three:
$ sudo apt install -y curl unzip tasksel
This guide will use Ubuntu LAMP stack ( Linux, Apache, MySQL, PHP) to run under the WordPress installation.
If you wish to run WordPress using Nginx webserver then follow our guide on How To Install Nginx, MariaDB, PHP (LEMP stack) on Ubuntu 18.04.
Next, install Ubuntu LAMP stack using tasksel
command and enable rewrite
mode:
$ sudo tasksel install lamp-server $ sudo a2enmod rewrite $ sudo systemctl restart apache2
We are now ready to download WordPress.
Download WordPress
At this stage we are ready to download and unzip WordPress into webserver’s root directory. Start by downloading the latest WordPress package using curl
command:
$ curl --output /tmp/wordpress.zip https://wordpress.org/latest.zip
Next, install WordPress files into Webserver’s root directory /var/www/html
and change the file ownership to www-data
:
$ sudo rm -fr /var/www/html $ sudo unzip /tmp/wordpress.zip -d /var/www/ $ sudo mv /var/www/wordpress/ /var/www/html $ sudo chown -R www-data.www-data /var/www/html
Configure Database
In this section we will create a new MySQL database wordpress
and assign a user access to it to a new user admin
with password pass
:
$ sudo mysqladmin create wordpress $ sudo mysql -e "CREATE USER 'admin'@'%' IDENTIFIED BY 'pass';" $ sudo mysql -e "GRANT ALL PRIVILEGES ON wordpress.* TO 'admin'@'%' WITH GRANT OPTION;"
For more configuration options regarding MySQL database installation visit page: Install MySQL on Ubuntu 18.04.
Install WordPress
We are now ready to install WordPress.
Given that your WordPress server can be resolved via wordpress-ubuntu
host name, open up your browser and navigate to URL http://wordpress-ubuntu
to access WordPress installation wizard: