Installation of WordPress on localhost
WordPress is world’s most popular and best CMS to develop dynamic website. A series of WordPress Tutorial has been started on Blog4Beginners which will guide beginners and will be helpful for experts as well. In this article we are going to explain installation of WordPress on localhost.
Before we get started there are some important things to know.
How to Download and Install WordPress?
There are two methods of WordPress installation.
- Installation of WordPress on Web Hosting
- Installation of WordPress on Local Computer (Localhost)
If you have purchased domain name and hosting, Then you should install WordPress on web hosting. It is easy and professional way. Complete method of WordPress installation on web hosting has been explained in our article ‘Installation of WordPress on web hosting’.
But if you are beginner and just want to learn WordPress and don’t have a web hosting, then you can try WordPress on your local computer (localhost).
We will cover following topics in this article:
How to run WordPress on localhost?
An HTML website is developed on HTML, CSS and its pages could be run by double click on html files in your computer. But WordPress could not be run like HTML. Because WordPress is developed on php and MySql, which is Server-side script. A server-side script is a program which need to be connect with a database on a server. So all Server-side scripts need a server also. That’s why we need a software which will convert our computer in a server and we will be able to run WordPress, Joomla CMS or any other php script on it.
Software required for Installation of WordPress on localhost
There are many free software available on internet which installs Apache + MariaDB + PHP + Perl. We recommend XAMP Server. Complete method of downloading and installation of XAMP is as follow:
- Click here to Download XAMP
- Click on XAMP for Windows in this page.
XAMP setup will start downloading. Once download completed, install XAMP by double click on downloaded setup (Setup file could be ‘xampp-windows-x64-8.0.1-1-VS16-installer.exe’ or similar to it).
Note: You have to remember XAMP installation folder. Because after installation you will be need to go in XAMP installation folder for copying WordPress files.
3. Once installation completed, Click on start menu and search ‘XAMP’, then click on ‘XAMP Control panel’.
4. XAMP control panel will be open. Now start Apache and Mysql by click start buttons in front of each.
5. color of both (Apache and Mysql) should be green or yellow. Not red.
Now XAMP is ready. We can install WordPress, Joomla CMS or any other php script on this computer.
After installation of XAMP, now download WordPress zip file from following link;
- Click here to download WordPress
- You will get a zip file from this link. Now copy this zip file in the folder where XAMP is installed. For example XAMP is installed in C: so open C:/XAMP
- In this folder find htdocs folder (C:\xampp\htdocs) and paste WordPress zip file in this folder
- Unzip WordPress in this htdocs folder.
- Once file has unzipped, you will find a WordPress folder with same name of zip file.
- Open this folder there will be another folder ‘wordpress’
- Cut this folder then go back and paste it in main htdocs folder.
- Rename this folder and name it what you want, but don’t use capital letter and don’t use space in the folder name
For example you renamed the WordPress folder and named it ‘mysite’. Remember this name.
Now your WordPress destination folder is C:/xamp/htdocs/mysite
Now open any web browser like Google Chrome, Mozila Firefox, Internet Explorer etc. and type localhost in address bar of web browser
Note: Must check XAMP control panel. Apache and Mysql should be start and their colors should be green or yellow.
Type localhost and press enter. Localhost Dashboard will open. This means that your XAMP is working properly.
Now remove /dashboard from address bar and type your WordPress folder name after localhost. For example your WordPress folder name in htdocs folder is ‘mysite’, so type localhost/mysite and press enter key.
When you will press enter key, WordPress installation will be started.
Step 1: Select Language. You can select 1st default language, English (United States) and press continue button.
Step 2: You will be asked to create database. Don’t close this tab and open a new tab.
Creating Database for WordPress:
Step 3. In new tab type localhost and press enter. Localhost host dashboard will open again. Click on phpMyAdmin button on right top corner.
Step 4: phpMysql dashboard dashboard will be open. Now click on New button on left top.
Step 5: write any name for database but don’t use capital letters and don’t use space in the database name. For example you can type database name also mysite. And then click Create button.
Step 6: Database has been created. Now come back to old tab where database name was aske. and click Let’s go! button.
Connecting WordPress with database:
Step 7: In next window You will be asked for database name, username, password, data host and Table Prefix.
In database name type the database name which database you created. We typed mysite in example of database creation, so in our example case we will type mysite in database.
In username type root
Remove text from password (Leave password blank)
In front of Database Host already written localhost, so don’t remove it. Database Host is localhost
In front of Table Prefix already written wp_ don’t remove it. Table Prefix is wp_
Then click Submit button.
Step 8: Database connection successful message will appear. This mean you hve connected WordPress with database. Cick on Run the installation button.
Step 9: Website information will be asked.
Site Title: Type you Website Name. You can use Capital letters and space here. For example we are typing My Website in this field.
Username & Password: These are important fields. You will be asked for this username and password at the time of login to WordPress cPanel for theme/plugin installation and other operations. Don’t use capital and space in username and type a strong password. In this example I am using username: muhammad
Email: Type your email address. You could be ask for this email in case of password forgot.
Fill all fields and click install WordPress button.
That’s it. You have installed WordPress on your local computer.
Next stage is installation theme as per website requirement. For example you are designing website for a school, you will choose an education theme or a hospital website need a health design theme.
So let’s go for next steps.
Login to WordPress cPanel
WordPress theme installation