WordPress is by far the most popular open-source blogging and CMS platform that powers over a quarter of the world’s websites. It is based on PHP and MySQL and packs a ton of features that can be extended with free and premium plugins and themes.
Here are the step-by-step instructions on how to install WordPress with Apache on Ubuntu 18.04:
- Update your Ubuntu 18.04 system to the latest version:
sudo apt update && sudo apt upgrade
- Install Apache web server:
sudo apt install apache2
- Install MySQL server:
sudo apt install mysql-server
- Install PHP and its dependencies:
sudo apt install php libapache2-mod-php php-mysql php-curl php-gd php-json php-zip
- Create a MySQL database and user for WordPress:
sudo mysql -u root -p
Enter your MySQL root password when prompted, then create a new database, user, and grant the user permissions to the database:
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'yourpassword';
FLUSH PRIVILEGES;
exit;
- Download the latest version of WordPress:
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
- Copy the WordPress files to the Apache web root directory:
sudo cp -r /tmp/wordpress/* /var/www/html/
- Set the correct permissions on the WordPress files:
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
- Create a new Apache virtual host configuration file for WordPress:
sudo nano /etc/apache2/sites-available/wordpress.conf
Add the following content to the file:
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /var/www/html/
<Directory /var/www/html/>
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/wordpress_error.log
CustomLog ${APACHE_LOG_DIR}/wordpress_access.log combined
</VirtualHost>
Replace your-domain.com
with your actual domain name or IP address.
- Enable the new virtual host and Apache rewrite module:
sudo a2ensite wordpress.conf sudo a2enmod rewrite
- Restart the Apache web server to apply the changes:
sudo systemctl restart apache2
- Finish the WordPress installation by accessing the WordPress web installer via a web browser:
http://your-domain.com
Follow the on-screen instructions to complete the WordPress installation process.
That’s it! You have successfully installed WordPress with Apache on Ubuntu 18.04.
Discover more from Gadget Rumours
Subscribe to get the latest posts sent to your email.