loading

How to Install WordPress on Ubuntu Using LAMP Stack

Updated at
22/08/2023
Views
7594

LAMP stack is a popular open-source software bundle that includes Linux, Apache, MySQL, and PHP. It is a widely used platform for hosting websites and web applications. Here are the steps to install WordPress on Ubuntu using LAMP stack:

1. Install Apache: Use the following command to install Apache on Ubuntu:

```
sudo apt-get install apache2
```

2. Install MySQL: Use the following command to install MySQL on Ubuntu:

```
sudo apt-get install mysql-server
```

3. Secure MySQL: Run the following command to secure MySQL by setting a root password and other security measures:

```
sudo mysql_secure_installation
```

4. Install PHP: Use the following command to install PHP on Ubuntu:

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

5. Install WordPress: Download the latest version of WordPress from the official website and extract the contents to the Apache web root directory:

```
cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xzvf latest.tar.gz
sudo chown -R www-data:www-data wordpress/
```

6. Create a MySQL Database: Create a new MySQL database and user for WordPress to use. You can do this using the MySQL command-line interface:

```
mysql -u root -p
CREATE DATABASE wpdb;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
exit
```

7. Configure WordPress: Rename the WordPress sample configuration file to wp-config.php and update the database settings with the MySQL database credentials created in step 6:

```
cd /var/www/html/wordpress
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.php
```

Update the following lines in wp-config.php file with your MySQL database details:

```
define('DB_NAME', 'wpdb');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');
```

8. Restart Apache: Use the following command to restart Apache to apply the changes:

```
sudo systemctl restart apache2
```

9. Complete the WordPress Installation: Open your web browser and navigate to your server's IP address or domain name. Follow the on-screen instructions to complete the WordPress installation process.

By following these steps, you can install WordPress on Ubuntu using LAMP stack and start creating your website or blog.

YottaSrc footer

why choose us?

Better Pricing, Fast SSD Storage and Real 24/7
Technical Support.

control panel icon
cPanel

Managing Your Site Through CPanel With The Latest Version

security icon
FAST, RELIABLE & SECURE

99.8% Uptime Guarantee.
So Focus On Your Work!

support icon
24/7/365 Support

Day or night, rain or shine,
our team is here for you!

cloud backup icon
Daily Backup

Daily & Weekly Backup.
Your Files Are Safe!