Be it your website or a client’s, working on a live site does have its fair share of risks. From experiencing downtime to functionality issues that affect the user experience, the list goes on. This is where installing WordPress locally is helpful.
Creating a local WordPress environment is a great way to test out themes and plugins and the new features that you plan to implement or troubleshoot the problems the clients are having without trying it out on a live site. Also, you can even try out the latest WordPress version to see if anything breaks before updating the live site.
Various tools allow you to install WordPress locally, and we have already covered them. But here, we will cover the entire process of creating a local WordPress website with those tools.
How to Install WordPress Locally Using XAMPP
XAMPP is one of the widely used tools for installing WordPress locally. XAMPP stands for, X- for the OS, Apache, MariaDB, PHP, and Perl. The process to set up a local WordPress environment with XAMPP is pretty easy. Let’s get started.
Also read: In-depth Guide on How to Optimize and Test for WordPress Accessibility
Download and install XAMPP
The first thing you need to do is to download XAMPP based on your operating system. It is available for Windows, Linux, and macOS.
Run the installer once you have downloaded the appropriate package based on your OS. We will be installing XAMPP on a Windows machine.
Hit next and on the next screen you will be presented with various configuration options. It’s a good idea to go with the default selection.
On the next screen, you can either go with the default installation path the installer creates or choose your preferred path.
Once you click next, you will be prompted to select the language.
After choosing your preferred language, the next screen will show you that XAMPP is ready to be installed. If you want to make any changes or review anything hit the back option and do so.
If not, click on Next and allow the installation to complete.
Once the setup is complete, you can decide to launch the XAMPP control panel or opt out of it.
If you do not wish to launch the app right away, you can access it from the start menu or the installed directory.
Launch the control panel
To start the process of installing WordPress locally with XAMPP, you need to launch the control panel first. As mentioned above, access it either from the start menu or from the installed directory.
This is what the control panel looks like.
Once you have launched the control panel, all the services will be inactive by default. This can be confirmed by checking if it says “Start” under the “Actions“ menu next to each module.
For running WordPress on localhost, we only need to turn on Apache and MySQL modules.
Note: You will need to run these two modules every time you wish to run the local environment
Once you have started the modules, we need to make sure it is working as intended. There are two ways to do this. Either type http://localhost/ in your browser or click on “Admin” next to any one of the activated modules.
If all is good, you will be presented with this webpage.
Creating the database
The next step is to create a database for your local WordPress site. To do that, click on phpMyAdmin.
The next screen will take you to phpMyAdmin from where you will be able to create a database. Now click on the database tab to start the process.
On the next screen, you only need to enter a database name and click Create.
Note: Make sure you remember the database name as it is needed when installing WordPress.
That’s it, the database has been created. Now, it’s time to install WordPress.
Download WordPress
Now we need to download WordPress. Head over to the download page to get the latest version.
The downloaded file will be in zip format and extracting it to a folder is needed. The following image shows the extracted files and folders.
Moving the WordPress files to the XAMPP directory
Head over to the directory where XAMPP is installed and look for a folder named htdocs.
Within this folder, create a new folder and assign it any name. It is within this folder, where you will be moving the extracted WordPress files.
Note: Remember the name you assign to this folder. It is needed each time to launch the site as it will be a part of the URL used to access the localhost website. We have used “local environment” as the name for the folder.
Installing WordPress
Now that we have all the files, it’s time to install WordPress locally with XAMPP. Now to start the installation, you need to access your server. To do this you need to enter localhost/ along with the name you assign to the folder inside htdocs.
For us, it will be: localhost/local environment and it will take us to this page.
Once you click on “Continue”, the next screen will show the needed information to complete the installation. For us, we only need the database name that we entered in phpMyAdmin.
On the next screen, we needed to enter the database name and username. Leave all the other fields as it is.
For the database name, enter the one you used when creating the database and for the username enter it as root. In our case, it will be like this.
Once you click submit, the next window will ask you to start the installation process and all you have to do is click on “Run the installation.”
Now, you are almost there. Once this is done, on the next screen you need to fill out several fields before you can access WordPress locally.
Once all the fields have been filled, click on “ Install WordPress.” The next screen will show the installation has been completed.
Accessing the local site
Now to access the site, enter the folder name along with the localhost URL in your browser.
For us, it will be: localhost/local environment and we will be taken to the homepage.
Now that you have created a local WordPress website, you can access the dashboard by adding /wp-admin to the URL and then entering the login credentials. Once you are done you can stop all the modules in the XAMPP control panel to deactivate the server.
How to Use Local to Install WordPress Locally
The next tool we can use is called Local. Compared to XAMPP the process involved here to set up everything is less complicated.
Install Local
To get started download Local based on your operating system.
You will be prompted to enter details such as your name, email address, and so on to start the download process. Providing a mobile number is not mandatory.
Once the download is complete, run the installer. Initially, the setup will ask whether you want to make the software available for everyone or just the admin. Based on your preference choose the one you like.
The next screen will ask to define an installation path. Either go with the default path or define a new location and then click on install.
Now wait for the installation process to complete.
After the installation process either launch the app straight away or if you wish to do it later, then launch it from the installed directory.
Creating the local server environment
Once you have launched the application, the process to install WordPress locally is really simple.
To start the process click on the “Create a new site” button. You can also create a new site by accessing the three horizontal lines or the hamburger menu on the top left-hand side or using the keyboard short Ctrl+N on Windows or Cmd+N on Mac.
The next screen will provide you with three options.
- Create a new site
- Create from a Blueprint
- Select an existing zip
We will be going with the first one, which is “ Create a new site”.
The next screen will ask you to enter a name for your local WordPress website and click continue.
The next step provides you with two options. One can either go with the preferred settings for the local WordPress environment or customize it according to your needs. The custom option allows you to define the PHP version, web server, and database. We will be choosing custom for this guide. Once you have selected everything click on Continue to proceed to the last step.
The last step will ask you to enter a username, password, and mail ID for the server and you can also decide if you want it to be a multisite setup or not. Then finally, click on Add Site.
Wait for the process to complete. There is no need to download WordPress here, as the application will take care of it for you.
Once the process is complete accessing WordPress locally and the files is easy. You can access the website or the backend directly from the dashboard of the application.
If you need to access the files and folders, click on “Go to site folder.”
If you need to access the database, head over to the database tab and click on “Open Adminer.”
To deactivate the server, click on Stop site at the top right-hand corner. To activate the site, click on the same location as the label will be replaced with “Start site”.
Also read: How to Identify and Fix WordPress Plugin and Theme Conflicts
How to Use Devkinsta for Installing WordPress Locally
DevKinsta is a popular tool created by Kinsta and is used by over 47,100+ users globally. The application offers a one-click WordPress installation for quickly spinning up a local website, local mail management, and so on.
Installing DevKinsta
To get started with it, download DevKinsta based on your operating system and run the installer.
During the initial step, you can define whether you want the app to be available for all users or just for the admin. Once you have made up your mind, click next.
The next step is where you choose the installation directory.
Once this is done click install and wait for the setup to complete.
The installation is super quick and once it is over, run the application.
Creating a local environment
Up on running the application, the initial screen will provide you with three options.
- New WordPress site
- Import from Kinsta
- Custom site
For this guide, we will go with “Custom site” as it allows us to determine various factors such as the PHP version, web server type, admin password, and so on. Now once you have entered the needed information for your local WordPress site, click on “Create site.”
The next screen will provide you with all the information that you need to enter to create the local WordPress site.
Once done, click on “Create site”.
It may take a few moments to install WordPress locally, so give it some time. Once it’s done, you can either view the site by selecting “Open site” or access the dashboard by clicking on “wp-admin”.
If you need to access the database, click on the database manager.
If you need to access the site files and folders, the file path is provided under the “Site Path” tab.
Also read: In-depth Guide on How to Remove Tracking Cookies in Your Browser
How to Install WordPress Locally Using MAMP
MAMP stands for Macintosh, Apache, MySQL, and PHP. It is also available for Windows users but users need to be on Windows 10 or higher. We will be running MAMP on a macOS system.
Install MAMP
Firstly download MAMP. As said we are running it on a macOS machine.
Once downloaded, run the installer and follow the on-screen instructions.
Open the MAMP Control Panel
After the installation, run MAMP, which will open up the control panel.
The control panel shows us the location of the root folder, and by default it is htdocs. Just like in XAMPP, this is where we copy and paste the WordPress files to install it locally.
Now select the web server of your preference and click on start.
Now click on WebStart which will take you to the MAMP introduction page.
This is what the introduction page looks like.
Now you need to scroll down to the page, to find the MySQL information. Note this down as this is needed later.
Creating the database
Now, we need to create a database for our local WordPress site. From the homepage of MAMP click on Tools > phpMyAdmin.
Once in phpMyAdmin click on databases.
Enter a name for the local website’s database and click Create.
Note: Remember the database name as it is needed later.
Download WordPress
Now that we have created the database, we need to download WordPress. Head over to the downloads page to get the package.
Once downloaded extract the contents of the zip file to a folder.
Move the WordPress files and folders
Now to start installing WordPress locally, you need to move all the extracted files and folders to a folder inside htdocs.
We are naming the folder as wordpress.
Remember the name you assign to this folder. It is needed each time to launch the site as it will be a part of the URL used to access the localhost website.
Installing WordPress
Now that we have the needed files and folders, it’s time to install WordPress locally. From here on the process is really simple.
To get started, you need to enter localhost/ followed by the name you assigned to the folder inside htdocs. For us it will be, localhost/wordpress This will load the following screen. Click on continue.
The next screen will alert you to the information you need to enter to start the installation process.
On the next screen, you need to enter the database name that you have assigned in phpMyAdmin and the username and password that was shown on the MAMP homepage.
The database host is localhost and the table prefix is “wp_”, do not change it. Once you have entered everything click submit.
On the next screen click on “Run the installation” to start installing WordPress locally.
On the next screen, you need to enter a few more details to add the final touches. You need to provide a site name, username, password and so on to install WordPress. Once you have entered the details, click on “Install WordPress.”
Upon a successful installation, the following screen will appear.
Login to your local WordPress website
Now that you have installed WordPress locally, to access the site use the URL localhost/, followed by the name you assigned to the folder inside htdocs.
For us it will be, localhost/wordpress
The dashboard of the locally installed WordPress site.
Wrapping Up
We have covered the most widely used tools for installing WordPress locally which is suitable for various operating systems. The local environment is really useful for developing new themes, and plugins or even testing them out to find compatibility issues.