马来西亚云服务

# # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # # Listen 12.34.56.78:80 Listen 80

Search For Pot In The Configuration File

Change Document Root Directory

# DocumentRoot: The directory out of which you will
  # serve your documents. By default, all requests are taken from
  # this directory, but symbolic links and aliases may be used to point to
  # other locationss.
  #
DocumentRoot "/your/desired/directory"
<Directory "/your/desired/directory"></Directory>

Save And Close The File:

Configure MYSQL
my.ini option for MySQL module
Close The Configuration File: Start Apache and Mysql
Control Panel log showing the status of Apache & MySQL

This complete configuration of XAMPP is used to set up a local WordPress development environment.

C. Create MYSQL Database Using PHPMyAdmin

  1. Access PhpMyAdmin:
  1. Create Database:

In PHPMyAdmin, go to the databases tab.

Create new Database in phpMyAdmin

In the Creating Database section, enter a unique name for the database. Avoid common names like “wp-database.” For increased security, use a mix of letters and numbers.

  1. Set Encoding

For the encoding system, use the default option, utf8mb4-general-ci.

  1. Complete The Creation

Do not add the table to the database at this point. WordPress installer will handle table creation during the installation process.

D. Install WordPress

Folder structure of Xamp

Then, run the WordPress installer. This script helps install WordPress and set up the database. To access the installer, open the browser and go to “localhost/my website/wp-admin/ setup-config.php.” Note that you should replace the website with the name of the folder just created.

After everything is set up, the browser shows the installer’s first screen. Here, you must choose a language.

Language Selection during WordPress Installation

Select language, and the installer will remind you to enter the database name, password, username, and table prefix to continue. 

Reminder of database name, username, password & host during WordPress Installation

Leave the database host field as localhost and the table prefix as “wp-“.

The setting of the database name, username, password & host during WordPress Installation

Click on submit and enter the website’s username, password, or title.

Choosing site title, username, & password during WordPress Installation

Click Install WordPress to see the success page, then log in to access the dashboard. 

Logging into the WordPress

Now your WordPress is installed locally, entering localhost/your website URL in the browser, XAMPP is running, and its modules are activating.

If you close XAMPP or stop Apache and MYSQL modules, you cannot connect to the WP local site. To do so, restart the application.

Install WordPress Locally On MacOS

In the following steps, we will walk you through installing WordPress locally on a MacOS device. First, you need to select the right tool, like MAMP.

3. By Download MAMP

MAMP is one of the most popular tools for creating a local server on MAC devices in seconds. The acronym stands for MySQL, PHP, Apache, and Macintosh, significant elements in running software.

MAMP

A. Download And Install MAMP

Visit the MAMP website and download the macOS version.

Downloading MAMP

Open the downloaded file and follow the next instructions.

Installation of MAMP

Wait to complete installation.

Finish Installation of MAMP

B. Customize Preference

Launch MAMP and go to preference to ports.

Setting of Apache, Nginx & MySQL Port in MAMP

Set the Apache port to 80, keep the Nginx port at 8888, and keep the MySQL port at 8889, then press “ok.

Changing Apache, Nginx & MySQL Port in MAMP

Go to preference > web server and choose the folder to store the website.

The Server tab under MAMP preferences.

After making changes, click ok.

C. Download and Move WordPress

D. Create Database

The locations of phpMyAdmin on your MAMP control panel.

Under database, create a new database with uff8 general ci encoding.

The Databases tab on your phpMyAdmin.

After this, click on Create.

E. Access The Testing Site

Open the web browser and start entering “http://localhost“.

WordPress Installation

For troubleshooting, refer to the MAMP support forums. Now, the whole process is complete, and finally, you can install WordPress locally using MAMP.

Install WordPress Locally On Windows, MacOS, And Linux

Docker and Vagrant are compatible with all three operating systems, so you can follow the same steps regardless of which one you are using. 

4. With Docker

Docker

Docker is an excellent option for more advanced users who want to install WordPress locally. It helps create isolated containers for various tasks, including installing WordPress or building a new WordPress installation in an isolated container.  Let’s see the steps to use Docker for WordPress installation:

A. Download And Install Docker:

Download and install Docker from Docker’s official website.

B. Create A Docker-Compose File:


version: '3.1'
Services:
wordpress:
image: wordpress
restart: always
Ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: example user
WORDPRESS_DB_PASSWORD: example pass
WORDPRESS_DB_NAME: exampled

db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass 
MYSQL_ROOT_PASSWORD: rootpass
version: '3.1'

C. Start Dockers Containers

D. Access WordPress

E. No Coding Needed

5. By Using Vagrant

Vagrant

Vagrant is popular due to its simple functioning and adaptability to work on different tasks. For WP developers, vagrant makes it easy to install WordPress locally.  

Let’s see all the steps to install Vagrant for local installation of WordPress.

A. Install Vagrant:

Download and install Vagrant from the Vagrant official website.

B. Choose A Vagrant Box:

C. Initialize Vagrant:


vagrant init <box-
name>

D. Configure Vagrant File:


Vagrant.configure("2") do
|config|
config.vm.box= "<box-name>"
end

Start the virtual machine and run the following command.


vagrant up

E. Access the WordPress installation

F. Configure WordPress

Follow on-screen instructions to complete the WordPress installation process, which includes setting up a database and creating an admin account.

G. Work With WordPress Vagrant

You can now work with installing WordPress locally with Vagrant just as you would with a live site. Make changes and add text.

You have finished the WP installation process using Vagrant. The installation process’s specifications depend on the Vagrant box you choose. For any additional steps or customization options, refer to the documentation provided with the box.

Local WordPress Installation On Linux

Users can install WordPress locally on Linux, which works slightly differently from MacOS and Windows. One of the most common approaches for installing WordPress on Linux is setting up LAMP, so let’s start by explaining what it is and how it works.

6. By Installing LAMP

If you are using a Linux distribution, you must first download LAMP, install it, and configure it manually. 

A. Install Apache & MYSQL:

Update package list.


sudo apt update

sudo apt install apache2

Verify that MYSQL is running by running the following command.


sudo mysql

After installation is complete, determine that the MySQL server is running by using the sudo mysql command in the terminal like this.

Exit the MySQL Prompt

Once PHP is installed, all components in the LAMP stack are completed, but now configure each component to work with the WordPress run locally. 

Install PHP and Modules.


sudo apt install php libapache2-mod-php php-mysql

B. Configure LAMP:

  1. Apache Configuration:

Open the configuration file.


sudo nano /etc/apache2/apache2.conf

Verify and change the directory section.


<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted 
</Directory>

Save and exit.

2. Apache Ports Configuration

Open ports configuration file.


sudo nano /etc/apache2/ports.conf

C. MYSQL Configuration (If Needed):

Open MYSQL config file.


sudo
nano
/etc/mysql/mysql.conf.d/mysqld.cnf

D. Secure MYSQL And Create A Database

Now you have a basic LAMP setup and run MYSQL secure installation. Run command.


sudo mysql_secure_installation

Enter “y” to enable validation and password security.

Enter “Y” to enable password validation in Linux

Follow the prompt to set up the root password and improve security.

Create a database.


sudo mysql -u root -p 
CREATE DATABASE database_name
DEFAULT CHARACTER SET utf8 COLLATE
utf8_unicode_ci;
SHOW DATABASES;
exit

E. Install WordPress

Download And Extract WordPress.


cd /var/www/html 
sudo wget -c
http://wordpress.org/latest.tar.gz 
sudo tar -xzvf latest.tar.gz
sudo chown -R www-data:www- 
data /var/www/html/wordpress

Open your browser, then jump or navigate to http://localhost/WordPress” and choose a language.

Language selection in WordPress

Conclusion

Installing WordPress on a local host is straightforward and needs developers because everything runs on a computer, and loading times are significantly lower. We can safely test things before a live production environment. You can easily follow any method explained in this comprehensive guide, from WAMP, XAMPP, MAMP, Docker, and Vagrant to LAMP, according to your needs and preferences, to quickly install WordPress locally. Do you have any questions about how to install WordPress locally on Windows, Mac OS, and Linux? Feel free to ask in the comments below.

Kaif

Share
Published by
Kaif
2 years ago

Recent Posts

Is WordPress 6.9 a Game Changer? Here’s a Look

1. Introduction WordPress 6.9, codenamed "Gene," is the final major release of 2025 and one…

7 days ago

Docker vs Kubernetes: Containerization Showdown

1. Introduction to Containerization 1.1 What Is Containerization and Why It Matters Modern software development…

1 week ago

How to Set Up n8n? A Step-by-Step Guide for Self-Hosted Workflow Automation

1. Introduction If you've ever wanted to automate repetitive tasks — like syncing data between…

3 weeks ago

Top Survival Games Perfect for Dedicated Server Hosting

Introduction Survival games have become one of the most enduring and beloved genres in modern…

1 month ago

Containerize and Deploy Node.js Applications With VPS Malaysia

1. What is Node.js? Node.js lets you use JavaScript to build the "brain" of a…

1 month ago