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

WordPress: Installation on Ubuntu 22.04

neo by neo
September 11, 2025
in WordPress
0
WordPress: Installation on Ubuntu 22.04

WordPress: Installation on Ubuntu 22.04

0
SHARES
11
VIEWS
Share on FacebookShare on LinkedIn
Table of Contents
  • Installation on Ubuntu 22.04 with Apache Web Server
    • About WordPress
    • Install Dependencies
    • Install WordPress

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:

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:

ADVERTISEMENT
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

How to Extract and View Compressed Files in Linux Using tar and zmore

Next Post

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

neo

neo

Related Posts

WordPress: Automatically Website Backup with Bash Script on Linux
WordPress

WordPress: Automatically Website Backup with Bash Script on Linux

WordPress: Renew HTTPS Certificate on WordPress Site
WordPress

WordPress: Renew HTTPS Certificate on WordPress Site

WordPress: Change Port from 433 to 8443
WordPress

WordPress: Change Port from 433 to 8443

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

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

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

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

Recommended

Linux Files Operation: tar and zmore Extracting Files

How to Extract and View Compressed Files in Linux Using tar and zmore

Lesson 6: Using Bash Command Substitution

Lesson 6: Using Bash Command Substitution

FortiGate Country Address Object Generator – Block or Allow Access by Country

FortiGate Country Address Object Generator – Block or Allow Access by Country

View & Copy Image Metadata Online – Camera & GPS Info

View & Copy Image Metadata Online – Camera & GPS Info

Online WebP to JPG Converter

Online WebP to JPG Converter

Categories

  • 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
  • Web Tools
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

Recent News

FortiGate Country Address Object Generator – Block or Allow Access by Country

FortiGate Country Address Object Generator – Block or Allow Access by Country

View & Copy Image Metadata Online – Camera & GPS Info

View & Copy Image Metadata Online – Camera & GPS Info

  • 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
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools

© 2025 defencedev.com - All rights reserved.