• Contact
  • About Me
  • Privacy Policy
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
DefenceDev
No Result
View All Result
ADVERTISEMENT
Home Projects WordPress

WordPress: Installation on Ubuntu 22.04

neo by neo
May 27, 2025
in WordPress
0
WordPress: Installation on Ubuntu 22.04

WordPress: Installation on Ubuntu 22.04

0
SHARES
6
VIEWS
Share on FacebookShare on Twitter
ADVERTISEMENT

Installation on Ubuntu 22.04 with Apache Web Server

In WordPress: Installation on Ubuntu 22.04, we will walk you through the steps to install WordPress on a fresh installation of Ubuntu 22.04. You will learn how to set up the necessary LAMP stack components (Linux, Apache, MySQL, and PHP), download and configure WordPress, and ensure everything runs smoothly for your website or blog.

By the end of this post, you’ll have a fully functional WordPress site running on your Ubuntu 22.04 server. Whether you’re setting up a personal blog or a professional site, this guide will help you get up and running quickly and easily.

About WordPress

WordPress is a widely-used open-source content management system (CMS) that powers a significant portion of websites on the internet. Known for its user-friendly interface and extensive plugin ecosystem, WordPress allows users to easily create and manage websites without extensive coding knowledge. Initially designed for blogging, it has evolved into a versatile platform for various types of websites, from personal blogs to corporate sites. Its themes and plugins offer customization options, making it a go-to choice for both beginners and experienced developers seeking flexibility and scalability in website development.

More information at the page: https://wordpress.com/about/

Install Dependencies

sudo apt update
sudo apt install apache2 \
                 ghostscript \
                 libapache2-mod-php \
                 mysql-server \
                 php \
                 php-bcmath \
                 php-curl \
                 php-imagick \
                 php-intl \
                 php-json \
                 php-mbstring \
                 php-mysql \
                 php-xml \
                 php-zip

Install WordPress

In our case we will install WordPress in /srv/www folder. It is recommend by https://ubuntu.com/tutorials/install-and-configure-wordpress#3-install-wordpress

sudo mkdir -p /srv/www
sudo chown www-data: /srv/www
curl https://wordpress.org/latest.tar.gz | sudo -u www-data tar zx -C /srv/www

Configure Apache

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

Copy the following content:

<VirtualHost *:80>
    ServerName hostname.example.com
    DocumentRoot /home/defenced/public_html
    <Directory /srv/www/wordpress>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Require all granted
    </Directory>
    <Directory /home/defenced/public_html/wp-content>
        Options FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>

Enable site with

sudo a2ensite wordpress

Enable URL rewriting with:

ADVERTISEMENT
sudo a2enmod rewrite

Disable the default “It Works” site with:

sudo a2dissite 000-default

Restart Apache2 Service:

sudo service apache2 reload

Configure Database

sudo mysql -u root

mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE USER wordpress@localhost IDENTIFIED BY 'YourPassworD';
Query OK, 0 rows affected (0.02 sec)

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON wordpress.* TO wordpress@localhost;
Query OK, 0 rows affected (0.01 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

Enable MySQL Service

sudo service mysql start

Configure WordPress to connect to the Database

Copy the sample configuration file to wp-config.php:

sudo -u www-data cp /home/defenced/public_html/wp-config-sample.php /home/defenced/public_html/wp-config.php

Edit wp-config.php file:

sudo -u www-data nano /home/defenced/public_html/wp-config.php
// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );

/** Database username */
define( 'DB_USER', 'wordpress' );

/** Database password */
define( 'DB_PASSWORD', 'YourPassworD' )

Generate salts on the link: https://api.wordpress.org/secret-key/1.1/salt/

Edit the wp-config.php file and replace generated lines:

ADVERTISEMENT
ADVERTISEMENT
sudo -u www-data nano /home/defenced/public_html/wp-config.php

With Ctrl+K you can remove complete line and just copy generated lines:

define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );

Check IP Address and open WordPress

hostname -I

Open the WordPress on this way http://IP-ADDRESS

defencedev.com

About The Author

neo

See author's posts

Tags: wordpress
ADVERTISEMENT
Previous Post

Linux Files Operation: tar and zmore Extracting Files

Next Post

WordPress: Install Certbot Certificate on Your Site (Let’s Encrypt)

neo

neo

Next Post
WordPress: Install Certbot Certificate on Your Site (Let's Encrypt)

WordPress: Install Certbot Certificate on Your Site (Let's Encrypt)

Follow Us

  • Trending
  • Comments
  • Latest
MikroTik: Export Configuration in Text File

MikroTik: Export Configuration in Text File

Fortinet FortiGate: Static Route Configuration via GUI and CLI

Fortinet FortiGate: Static Route Configuration via GUI and CLI

Immich: Installation on Ubuntu 22.04

Immich: Installation on Ubuntu 22.04

Fortinet FortiGate Upgrade Path Tool

Fortinet FortiGate Upgrade Path Tool

NextCloud: Port Forwarding - Essential Ports for Smooth Functionality

NextCloud: Port Forwarding – Essential Ports for Smooth Functionality and Remote Access

Organizing and Managing Photos with Immich: Features I Use

Organizing and Managing Photos with Immich: Features I Use

Install Ubuntu 22.04 on Oracle VM Virtual Box

Install Ubuntu 22.04 on Oracle VM Virtual Box

Linux Directories: cd (Change Directory), pwd (Print Working Directory), mkdir (Make Directory)

Linux Directories: cd (Change Directory), pwd (Print Working Directory), mkdir (Make Directory)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Recent News

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

MikroTik: Check Your Wireless Password

MikroTik: Check Your Wireless Password

ADVERTISEMENT

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Browse by Category

  • Blog
  • Cloud
    • Private
  • Linux Tutorials
    • Bash Scripting Tutorials
    • Commands
    • Networking
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Solutions
    • Docker
  • Video Tutorials
    • MikroTik Videos

Recent News

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

  • Site Map
  • Privacy Policy
  • Facebook Page
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos

© 2025 defencedev.com - All rights reserved.