Support Online
Skip to main content

Installing WordPress with LAMP on Ubuntu

What Will You Learn in This Guide?

In this guide, you will learn how to install WordPress using LAMP architecture on an Ubuntu-based server.
Database creation, file permissions, Apache settings and web interface installation are explained step by step.

Preliminary Preparations

  • Ubuntu 18.04 or above (20.04 / 22.04 recommended)
  • User with authority sudo
  • Apache, MySQL and PHP must be installed
  • Internet access must be active

1️⃣ Creating Database and Users for WordPress

  1. WordPress stores all its data on MySQL.
sudo mysql

  1. This command logs into the MySQL administration screen.

CREATE DATABASE genixnode_wp DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

  1. Creates UTF-8 supported database for WordPress.

CREATE USER 'genix_user'@'localhost' IDENTIFIED BY 'Guclu_Sifreniz_Buraya';
GRANT ALL ON genixnode_wp.* TO 'genix_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
  1. These steps create and authorize a special user.

2️⃣ Installation of Required PHP Plugins

  1. WordPress and its plugins require additional PHP modules.

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

  1. Visual rendering, XML and plugin compatibility is provided.

sudo systemctl restart apache2
  1. Apache is restarted.

3️⃣ Apache Settings and .htaccess Permission

  1. .htaccess is mandatory for SEO friendly links.

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


<Directory /var/www/wordpress/>
AllowOverride All
</Directory>
  1. Allows the use of .htaccess.

sudo a2enmod rewrite
sudo apache2ctl configtest
sudo systemctl restart apache2
  • Permanent links are activated.

4️⃣ Downloading WordPress Files


cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
  1. WordPress is downloaded with its latest version.


touch /tmp/wordpress/.htaccess
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
mkdir /tmp/wordpress/wp-content/upgrade

  1. Basic configuration files are prepared.

sudo cp -a /tmp/wordpress/. /var/www/wordpress
  • Files are moved to the web directory.

5️⃣ File Permissions and Configuration


sudo chown -R www-data:www-data /var/www/wordpress
sudo find /var/www/wordpress -type d -exec chmod 750 {} \;
sudo find /var/www/wordpress -type f -exec chmod 640 {} \;
  • Secure file permissions are assigned.

  1. Security Keys

curl -s https://api.wordpress.org/secret-key/1.1/salt/
  • Generates unique security keys for WordPress.

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

define('DB_NAME', 'genixnode_wp');
define('DB_USER', 'genix_user');
define('DB_PASSWORD', 'Guclu_Sifreniz_Buraya');
define('FS_METHOD', 'direct');

Database connection and file write permission are defined.


6️⃣ Completing the Setup from the Web Interface

  1. From the browser, go to:

https://alan-adiniz-veya-ip-adresiniz

Language: Turkish

  • Site title and administrator information are entered

Installation is completed 🎉


❓ Frequently Asked Questions (FAQ)

1. It requests FTP information, why? FS_METHOD is not set or the permissions are incorrect.

2. I'm getting a database connection error. Check wp-config.php information.

3. Only the Apache page comes up. DocumentRoot may be pointing to the wrong directory.

4. How to set up SSL? Let's Encrypt can be used with certbot --apache.

5. Can I upgrade the PHP version? Yes, PHP 8.x versions are supported.


🚀 Result

WordPress is now running on your Ubuntu server. You can switch to theme, plugin and SEO settings.

Implement your WordPress projects immediately on the GenixNode platform.