itsmeit.bizitsmeit.biz
  • Home
  • Windows
    • Windows Software
  • Ubuntu & Linux
    Ubuntu & Linux
    The top blog articles on Ubuntu and Linux, featuring valuable tips and tricks, empower you to master these operating systems and enhance your experience.
    Show More
    Top News
    How to use chmod command in Linux or Ubuntu with examples
    How to use chmod command in Linux or Ubuntu with examples
    November 11, 2023
    How to Remove Ubuntu Dual boot Windows 11 UEFI and Legacy
    How to Remove Ubuntu Dual boot Windows 11 UEFI and Legacy
    November 10, 2023
    How to install php7.4 on Ubuntu & Config php7.4-fpm - itsmeit.biz
    How to install php7.4 on Ubuntu 22.04 | 20.04 LTS
    November 10, 2023
    Latest News
    How to install Composer on Ubuntu 20.04 | 22.04 & Linux
    November 13, 2023
    How to Configure Redis Cache to Speed ​​Up WordPress Site
    November 15, 2023
    Install Ibus-bamboo or Ibus-unikey for Accented Letters on Ubuntu 22.04
    November 11, 2023
    How to install MariaDB on Ubuntu 22.04, 20.04 and Debian
    November 11, 2023
  • Web developer
    • Wordpress Theme
      • Blog News
      • Fashion Theme
      • Theme Elementor
      • WooCommerce Theme
    • Wordpress Plugin
    • Magento Developer
Reading: How to install WordPress on Ubuntu 22.04 | 20.04 Apache2
Share
Font ResizerAa
itsmeit.bizitsmeit.biz
Font ResizerAa
  • Linux & Ubuntu
  • Windows
    • Tips & Trick
    • Windows Software
  • Web developer
    • Magento Developer
    • Wordpress Plugin
    • WP Blog Theme
    • WP Fashion Theme
    • WooCommerce Theme
  • Log Out
Have an existing account? Sign In
Follow US
Copyright © 2022. All Rights Reserved.
Ubuntu & Linux

How to install WordPress on Ubuntu 22.04 | 20.04 Apache2

duyanh
Last updated: November 10, 2023
By duyanh Published April 14, 2022
Share
SHARE

Table of contents

  1. How to install WordPress on ubuntu 22.04 | 20.04 use apache2
    1. Step 1. Install PHP and MySQL to install WordPress
    2. Step 2. Install Apache 2 on Ubuntu 22.04, 20.04 or Debian
    3. Step 3. Download the WordPress source code
    4. Step 4. Apache web server configuration file for WordPress
    5. Step 5. Config hosts domain localhost for WordPress
    6. Step 6. Create Users and database for Wordpress, grant permissions in MySQL
    7. Step 7. Install WordPress on Ubuntu 22.04, 20.04 or Debian

How to install WordPress on ubuntu 22.04 or 20.04 with apache2, config guide WordPress with apache2, Php, and Mysql. In this way, you can also install it on any Linux operating system like Debian or VPS server.

How to install WordPress on ubuntu 22.04 | 20.04 use apache2

This tutorial applies to Linux-based operating systems like Ubuntu or Debian. Additionally, if you are using Nginx, we have also provided a guide on how to install WordPress with Nginx in a separate article, which you can find here.

Step 1. Install PHP and MySQL to install WordPress

Before installing WordPress on Ubuntu with Apache, make sure your computer meets the following requirements:

  • PHP: WordPress requires PHP to operate, so you need to install PHP.
  • MySQL: You need to install the MySQL database to store WordPress data.

Step 2. Install Apache 2 on Ubuntu 22.04, 20.04 or Debian

On Ubuntu, there is usually Apache 2 available, but if you don’t have it, you can install Apache as instructed below. First, check if Apache 2 is installed on the system or not.

apache2 -version
How to install wordpress on ubuntu 20.04 | 22.04 apache2

Check apache 2 operational status.

sudo service apache2 status
How to install wordpress on ubuntu 20.04 | 22.04 apache2

If Apache 2 does not exist on your system, you can run the command below to install it.

sudo apt update
sudo apt install apache2

After installing Apache, the command below can be used to stop, start and enable Apache to always start with the system.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

Open your web browser and enter either ‘localhost’ or ‘127.0.0.1’ into the address bar. If the display appears as shown in the image below, it indicates that Apache has been successfully installed. Now you can start with installing WordPress on Ubuntu 22.04, 20.04, or Debian. Please continue to follow itsmeit for the next steps.

Install Apache 2 on Ubuntu 22.04, 20.04 or Debian to setup Wordpress (illustration)
Install Apache 2 on Ubuntu 22.04, 20.04 or Debian to setup Wordpress (illustration)

Step 3. Download the WordPress source code

At this step, you need to create a directory to store the source and download the WordPress zip file. ItsmeIT will do it as follows:

cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
sudo mkdir -p /var/www/vhosts/dev.itsmeit.biz/httpdocs
cd wordpress && sudo mv * /var/www/vhosts/dev.itsmeit.biz/httpdocs
sudo chown -R $USER:www-data /var/www/vhosts/

Using the commands above, ItsmeIT utilized the terminal to navigate to the /tmp directory, which is a temporary directory. Next, ItsmeIT created a directory at the path “/var/www/vhosts/dev.itsmeit.biz/httpdocs” and unzipped the file, before moving the source to the httpdocs folder.

Note:

The name of the directory can be set as desired (it is recommended to name it according to the project). The directory path will be configured in Apache in the next steps. Finally, ItsmeIT has granted permission to the directory at /vhosts.

Set directory permissions when installing Wordpress with Apache2 (illustration)
Set directory permissions when installing Wordpress with Apache2 (illustration)

To understand more about the permissions of directories and files in Linux when install WordPress on Ubuntu 22.04, 20.04 or Debian, you may refer to the article.

Step 4. Apache web server configuration file for WordPress

Create a new “dev.itsmeit.biz.conf” configuration file in the /etc/apache2/sites-available/ directory for your site by running the command, should name the file the domain name and paste the content below.

sudo nano /etc/apache2/sites-available/dev.itsmeit.biz.conf
<VirtualHost *:80>
  ServerName dev.itsmeit.biz
  ServerAlias www.dev.itsmeit.biz
  ServerAdmin admin@dev.itsmeit.biz
  DocumentRoot /var/www/vhosts/dev.itsmeit.biz/httpdocs
  <Directory /var/www/vhosts/dev.itsmeit.biz/httpdocs/>
       Options FollowSymlinks
       AllowOverride All
       Require all granted
  </Directory>
       ErrorLog ${APACHE_LOG_DIR}/error.dev.itsmeit.biz.log
       CustomLog ${APACHE_LOG_DIR}/access.dev.itsmeit.biz.log combined
</VirtualHost>

Edit the domain name (ServerName, ServerAlias) and path to your source code (DocumentRoot), and press Ctrl + X to select Y to save the file. After saving the above config file, run the commands below to activate and restart apache2.

sudo a2ensite dev.itsmeit.biz.conf
sudo systemctl restart apache2.service

If there is any error message then run the below command to check and fix the config.

sudo apachectl configtest

Continue to run the command to set permission for the directory

sudo chown -R $USER:www-data /var/www/
how to install wordpress on ubuntu apache2 9
How to install wordpress on Ubuntu 22.04 | 20.04 apache2 (illustration)

Step 5. Config hosts domain localhost for WordPress

If you install WordPress on a localhost running Ubuntu, you’ll need to take an additional step to set up the IP address 127.0.0.1 for the domain. To do this, open the “hosts” file and add the following information.

sudo nano /etc/hosts
127.0.0.1 dev.itsmeit.biz

With the hosts the configuration above, when you run the domain dev.itsmeit.biz on your browser, it will point to the IP localhost 127.0.0.1 like a real domain without having to run localhost/project.

For the server or hosting, skip this step and have to transfer the domain pointing to the IP of the provider. Please contact the provider.

Now, open your web browser and enter the URL “dev.itsmeit.biz.” If the result displayed is successful, proceed to the next step, which is installing and setting up the website.

how to install wordpress on ubuntu apache2 4
How to install wordpress on Ubuntu 22.04 | 20.04 apache2 (illustration)

Step 6. Create Users and database for Wordpress, grant permissions in MySQL

To establish a connection with the database and start configuring the website, it’s necessary to create a database. In this case, a database will be created and utilized with a MySQL user who has PRIVILEGES privileges, rather than the root user.

Login to MySQL

sudo mysql (or) sudo mysql -u root -p

The following commands will create a MySQL database and user that you can use to install WordPress with Apache2 on Ubuntu. Remember to change the “user” and “database” to your own information.

CREATE DATABASE dev_itsmeit;
CREATE USER 'dev_itsmeit'@'localhost' IDENTIFIED BY 'Password123#';
GRANT ALL PRIVILEGES ON dev_itsmeit.* TO dev_itsmeit@localhost IDENTIFIED BY 'Password123#';
FLUSH PRIVILEGES;

Step 7. Install WordPress on Ubuntu 22.04, 20.04 or Debian

Open the browser running the domain that you configured in the steps above, click Let’s go!, and start setting up.

Setup/install wordpress on ubuntu apache2 (illustration)
Setup/install wordpress on ubuntu apache2 (illustration)

Enter the database, user, and password information that you created in step 5 and configure it as shown in the image above, then click the “submit” button.

Continue, press “Ctrl + A” in the frame as shown below, and copy the all content.

How to config and install WordPress on Ubuntu 22.04, 20.04
How to config and install WordPress on Ubuntu 22.04, 20.04 (illustration)

Next, run the command to create wp-config.php the file and paste the copied content here. (The path to your wp-config.php file).

nano /var/www/vhosts/dev.itsmeit.biz/httpdocs/wp-config.php
Config and install wordpress on ubuntu apache2
Config and install wordpress on ubuntu apache2 (illustration)

Press “Ctrl + X” and select “Y” to save the changes. Then return to your web browser and click on “Run the Installation” to continue the install WordPress on Ubuntu 22.04, 20.04.

how to install wordpress on ubuntu apache2 8
Setup WordPress on Ubuntu 22.04 | 20.04 apache2 (illustration)

Done! Now you can log in to the “wp-admin” using the account you created and start building your website. There are many themes and plugins available for WordPress, feel free to explore and download them to enhance your site.

Above are the steps for installing WordPress with Apache 2 on Ubuntu 22.04, 20.04, or Debian. You can also try creating an SSL to use “https” on your localhost for your website. Hopefully, it will help you!

TAGGED: install wordpress ubuntu, ubuntu apache wordress

– Advertising –

Share this Article
Facebook Twitter Pinterest LinkedIn Reddit Telegram
Leave a comment Leave a comment
Subscribe
Connect with
Login
Notify of
guest
Connect with
guest
0 Comments
Inline Feedbacks
View all comments
Previous Article 3 Methods Fix missing settings in Ubuntu 20.04, 22.04 LTS 3 Methods Fix missing settings in Ubuntu 20.04, 22.04 LTS
Next Article How to install WordPress with Nginx on Ubuntu 22.04 | Debian How to install WordPress with Nginx on Ubuntu 22.04 | Debian

You Might Also Like

How to install Composer on Ubuntu 20.04 | 22.04 & Linux

How to Configure Redis Cache to Speed ​​Up WordPress Site

Install Ibus-bamboo or Ibus-unikey for Accented Letters on Ubuntu 22.04

How to install MariaDB on Ubuntu 22.04, 20.04 and Debian

How to Install Android Studio on Ubuntu 22.04 or 20.04

Stay Connected

Facebook Like
Twitter Follow
Pinterest Pin
Telegram Follow

Popular Posts

Download Office 2024 Professional Plus Preview LTSC AIO Full Repack + Activate + Multilanguage
Download Office 2024 Professional Plus Preview LTSC AIO
December 9, 2023 2 Views
Download Adobe Photoshop 2024 v25.2.0.196 Repack (Full Activated)
Photoshop 2024 Repack v25.2.0.196 Full + AI / Neural Filters
December 9, 2023 442 Views
Download IDM FULL Crack v6.42.2 + Repack (Fix fake serial)
Download IDM FULL Crack v6.42.2 + Repack (Fix fake serial)
December 8, 2023 690 Views
Download WPBakery v7.2 Drag and Drop WordPress Page Builder Plugins
WPBakery v7.2 Drag and Drop WordPress Page Builder Plugins
December 4, 2023 27 Views
Download Plugin Product Video Gallery for Woocommerce v1.5.0
Plugin Product Video Gallery for Woocommerce v1.5.0
November 17, 2023 11 Views
Download Prevent Spam Register Plugin - Block WordPress Spam Accounts
Prevent Spam Register Plugin – Block WordPress Spam Accounts
November 17, 2023 17 Views
We provide tips and tricks on Internet technology, computers, servers as well as share experiences for developers and website designers.

DMCA.com Protection Status

Quick Link

  • Linux | Ubuntu
  • Windows & Software
  • Magento Developer
  • Wordpress Plugin
  • Wordpress Theme

General Policy

  • About US
  • Contact US
  • Disclaimer
  • Privacy Policy
  • Terms of Service

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

itsmeit.bizitsmeit.biz
Follow US
Copyright © 2023. All Rights Reserved.
  • WP Blog Theme
  • WP Fashion Theme
  • WooCommerce Theme
  • Wordpress Plugin
Welcome Back!

Sign in to your account

Continue with Google
Continue with TikTok
Continue with GitHub
Register Lost your password?