NeuronVM bread crumb arrow icon Docs bread crumb arrow icon Tutorial Install WordPress on LAMP on Ubuntu 22.04

How to Install WordPress on LAMP on Ubuntu 22.04

Eileen.B
7m
0 comments
Print
2026/05/24

If you decide to install WordPress on Ubuntu 22.04 with LAMP, you want to be in complete control of your site. No pre-built hosting, no one click installation, everything is transparent and manageable. It may seem a bit technical at first glance, but the truth is that if you take it step by step, it’s not only not difficult, but it also gives you a deeper understanding of the structure of your site. The first time I installed WordPress directly on Ubuntu, I enjoyed the feeling of knowing exactly where and how each part of the site worked more than the installation itself. This really saved me when troubleshooting later.

Prerequisites

Before you start, you need to have the following ready:

  • Ubuntu 22.04 installed and ready to go
  • Full LAMP (Apache + MySQL + PHP) installation
  • Firewall enabled
  • SSL enabled (preferably Let’s Encrypt)

WordPress deals with user data, so installing it without HTTPS is not recommended at all, even if your site is small.

Installing WordPress on LAMP on Ubuntu 22.04

Step 1: Create a database and a user for WordPress

Login to MySQL:

sudo mysql

Create database:

CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Create user:

CREATE USER 'wordpressuser'@'%' IDENTIFIED WITH mysql_native_password BY 'password';

Grant access:

GRANT ALL ON wordpress.* TO 'wordpressuser'@'%';

FLUSH PRIVILEGES;

EXIT;

Important experience: Never run WordPress as the root user.

Step 2: Install the required PHP extensions

First update:

sudo apt update

Install the packages:

sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip

And then:

sudo systemctl restart apache2

If these extensions are not installed, some WordPress plugins will give an error later, and you will have to roll back.

Step 3: Configure Apache for WordPress

Add this section to your site’s configuration file:

<Directory /var/www/wordpress/>
AllowOverride All
</Directory>

Then enable the rewrite module:

sudo a2enmod rewrite

Test the configuration:

sudo apache2ctl configtest

If you get a Syntax OK message, restart:

sudo systemctl restart apache2

This step will enable permalinks in WordPress.

Step 4: Download and Transfer WordPress

cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
sudo cp -a /tmp/wordpress/. /var/www/wordpress

Step 5: Set permissions

File ownership:

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

Folder access:

sudo find /var/www/wordpress/ -type d -exec chmod 750 {} \;

File access:

sudo find /var/www/wordpress/ -type f -exec chmod 640 {} \;

Most “update not available” errors come from this exact section. Don’t skip this step.

Step 6: Configure wp-config.php

Open the file:

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

Enter the database information:

define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wordpressuser' );
define( 'DB_PASSWORD', 'password' );
define( 'DB_HOST', 'localhost' );

And add this line:

define('FS_METHOD', 'direct');

Also, get the security keys (Secret Keys) from the official WordPress site and replace them to increase the security of the installation.

Final Step: Complete the Installation via Browser

Open your browser and go to:

https://IP-Your-Ubuntu

Select your language.

Select your language

Enter your site name, choose a hard-to-guess username (please don’t use admin), and create a strong password.

needed information for WordPress

After logging in, you will be taken to your WordPress dashboard and can start designing your site.

 

A few tips beyond installation

Installing WordPress is not the end, it’s the beginning of management. Speaking from experience, these are far more important than the installation itself:

  • Set up automatic backups
  • Don’t install unnecessary plugins
  • Always keep WordPress and plugins updated
  • Manage SSH access and system users
  • Install a security plugin from the start

A site that starts up cleanly and properly will run for years without any problems, you can also check our website for more personal tips.

Conclusion

Installing WordPress on LAMP on Ubuntu 22.04 may seem technical at first, but once you understand the structure, it’s a logical and manageable process. Experience has shown that when you do it yourself, you’ll both increase your site’s security and be able to resolve issues more quickly in the future if they arise. It’s important not to just view the installation as a setup step, instead, consider it the foundation for a stable, secure, and professional website.

Share this Post
How useful was this post for you?
0 Points from 0 votes
Frequently Asked Questions

Not really, if you follow the steps step by step, it is completely doable even if you are not very professional.

If you have a public site, yes, it is very important, both for security and for user trust.

For security and better management, this prevents many potential problems.

Eileen.B

Leave a reply

Calculate the value of (9 - 2) :

Save my name and email in this browser for the next time.

Last Comments

Show More
© Copyright 2025 NeuronVM.
Use of this Site is subject to express terms of use