Install WordPress in ubuntu 20.04

1. Update the apt package manager cache:

sudo apt update

2. Install the Apache web server:

sudo apt install apache2

3. Install the MySQL database server:

sudo apt install mysql-server

4. Install PHP and the necessary modules:

sudo apt install php libapache2-mod-php php-mysql

5. Download and extract the WordPress archive:

cd /tmp


tar xzvf latest.tar.gz

6. Copy the files to the Apache document root:

sudo cp -a /tmp/wordpress/. /var/www/html/

7. Create a MySQL database for WordPress:

mysql -u root -p


GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';



8. Configure WordPress:

sudo mv /var/www/html/wp-config-sample.php /var/www/html/wp-config.php

9. Configure the WordPress database connection:

sudo nano /var/www/html/wp-config.php

10. Give the web server write permissions to the WordPress directory:

sudo chown -R www-data:www-data /var/www/html

11. Create an Apache virtual host:

sudo nano /etc/apache2/sites-available/wordpress.conf

12. Enable the virtual host:

sudo a2ensite wordpress.conf

13. Restart Apache:

sudo systemctl restart apache2

14. Open your browser and complete the WordPress installation:

Leave a Reply