How To Install WordPress with LEMP on Ubuntu 22.04

To install WordPress with a LEMP (Linux, Nginx, MySQL, PHP) stack on Ubuntu 22.04, you can follow these steps:

Step 1 : Install LEMP Stack:

If you haven't installed the LEMP stack yet, please refer to the following post for a step-by-step guide: Ubuntu 22.04 Guides

Step 2 : Create a MySQL Database and User for WordPress:

- Log in to MySQL:

- Create a new database and user, and grant privileges:

Replace 'your_password' with a strong password.

Step 3 : Create Directory for WordPress:

Create a directory named "devt" inside /var/www/html and navigate to it:

Step 4 : Download and Extract WordPress:

- Download the Latest WordPress Package

- Extract the WordPress Archive

- Move the WordPress files to the current directory

Step 5 : Set Permissions:

Set the correct permissions for the WordPress directory:

Step 5 : Configure Nginx for WordPress:

- Create a new Nginx server block configuration for WordPress:

Replace example.devtutorial.io with your actual domain name, and update the configuration as needed. Here is a basic example:

- Add the following configuration:

- Enable the Nginx Configuration:

- Test the Nginx configuration:

- If there are no syntax errors, restart Nginx:

Step 6 : Open your web browser and navigate to your server's IP address or domain name. You should see the WordPress setup page. Select your preferred language and click on the "Continue" button.

Step 7 : Click on the "Let's go!" button to proceed.

Step 8 : On the next screen, WordPress will inform you that it needs the database name, username, password, database host, and table prefix. Enter the following information:

- Database Name: Use the name you created for your WordPress database (e.g., wordpressdb).

- Username: Enter the username you assigned to the WordPress user (e.g., wordpressuser).

- Password: Enter the password you set for the WordPress user.

- Database Host: Keep this as localhost.

- Table Prefix: You can leave this as the default wp_ or change it for added security.

Step 9 : Click on the "Submit" button. If you've entered the correct database information, WordPress will show you a page confirming that it can now communicate with the database. Click on the "Run the installation" button.

Step 10 : On the next screen, enter the details for your WordPress site:

- Site Title: Give your site a title.

- Username: Choose a username for the main administrator.

- Password: Set a strong password for the administrator.

- Your Email: Enter your email address.

Step 11 : Click on the "Install WordPress" button. If everything is successful, you'll see a confirmation screen. Click on the "Log In" button to access the WordPress login page.

Step 12 : Enter the administrator username and password you just created and click on the "Log In" button.

Step 13 : You can now start customizing your site, installing themes and plugins, and creating content.

Congratulations! You've successfully installed WordPress on Ubuntu 22.04 with a LEMP stack