How to Install WordPress on Ubuntu 22.04 (LAMP)

Install Wordpress on Ubuntu 22.04 with LAMP stack on Linode

WordPress is a popular content management system (CMS) that allows you to create and manage websites easily. By combining WordPress with a LAMP stack (Linux, Apache, MySQL, and PHP), you can set up a powerful and flexible website hosting environment. In this tutorial, we will guide you through the process of installing WordPress on Ubuntu 22.04 with a LAMP stack on Linode.

Step 1: Set up a Linode Server

1. Sign in to you Linode account and create a new Linode server.

2. Choose Ubuntu 22.04 as the distribution and select an appropriate plan for your needs.

3. Configure the server’s hostname, root password, and SSH key if desired.

4. Deploy the Linode server and wait for the deployment to complete.

Step 2: Update and Secure the Server

1. Connect to your Linode server via SSH using a terminal or an SSH client.

2. Update the server’s package by running the following command:

sudo apt update && sudo apt upgrade

3. Install a firewall to secure your server by running the following commands:

sudo apt install ufw
sudo ufw allow OpenSSH
sudo ufw enable

Step 3: Install and Configure LAMP Stack

1. Install Apache by running the following command:

sudo apt install apache2

2. Install MySQL by running the following command:

sudo apt install mysql-server

3. Secure the MySQL installation by running the following command and following the prompts:

sudo mysql_secure_installation

4. Install PHP and necessary extensions by running the following command:

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

5. Configure Apache to use PHP by running the following command:

sudo nano /etc/apache2/mods-enabled/dir.conf

Move the PHP module to the first position, save the file, and exit the editor.

Step 4: Install and Configure WordPress

1. Download the latest version of WordPress by running the following command:

wget https://wordpress.org/latest.tar.gz

2. Extract the downloaded file by running the following command:

tar -xvxf latest.tar.gz

3. Move the extracted WordPress files to the Apache web rooot directory by running the following command:

sudo mv wordpress/* /var/www/html/

4. Set the correct ownership and permissions for the WordPress files by running the following commands:

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

5. Create a new MySQL database and user for WordPress by running the following command:

sudo mysql -u root -p
   CREATE DATABASE wordpress;
   CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
   GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
   FLUSH PRIVILEGES;
   EXIT;

6. Rename the WordPress configuration file and update the database details by running the following command:

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

Update the database name, username, and password with the ones you created in the previous step, save the file, and exit the editor.

Step 5: Complete the WordPress Installation

1. Open a web browser and navigate to your Linode server’s IP address or domain name.

2. Follow the WordPress installation wizard by selecting the desired language, entering the site title, creating an admin username and password, and providing your email address.

3. Click on the “Install WordPress” button to complete the installation.

Congratulations! You have successfully installed WordPress on Ubuntu 22.04 with a LAMP stack on Linode. You can now start building and customizing your website using the powerful features of WordPress.

Remember to regularly update WordPress, plugins, and themes to ensure the security and performance of your website. Additionally, consider implementing additional security measures such as SSL certificates and regular backups to protect your website and its data.

Enjoy using WordPress and creating your website on your Linode server!

Related articles:

Leave a Reply