In our previous posts, we have discussed, how you can install WordPress in a web hosting site like Bluehost. Have you ever imagine that this CMS (I am talking about WordPress) can be used offline also? Yes, you can use it offline and without buying the web hosting from any site.
You can install WordPress on your computer with the help of localhost server. If you don’t know what a localhost server is, don’t worry you get to know about the localhost server in this post.
Click here if you want to Start a self-hosted Blog on WordPress.org.
Installing WordPress on your Console is very helpful. You can test and experience the platform (WordPress) freely. You would be thinking that if we can install the themes and plugins or not? The answer is you can use this whether you installed WordPress in the localhost or on the web host, WordPress will work like the same. The only difference is that you will be the one who can see the blog.
In this post, I will share how you can install the WordPress locally using XAMPP server (other localhost servers also present, but I will recommend you to install XAMPP).
What is localhost?
In computer networking, localhost is a hostname that means ‘this computer‘. Every website or blogs you are looking are hosted on the servers. Now, what is a server? A server is nothing but a computer where the data is stored. When the computers are connected in through a network(or web), then these computers are called web servers.
When you are purchasing a hosting (or we can say some web space) for your blog, then your data is stored at web servers. But when you store the database and files of your blog on your own computer then it is referred as localhost.
To create your computer as a server we need an application (software). Here, XAMPP will do the work. It is a compilation of Cross Platform, Apache HTTP Server, My SQL Database, PHP, and Perl. It manages the databases, PHP codes, etc.
Now you have to follow the steps to install WordPress on your Linux localhost.
The first thing you need to do is download the XAMPP application. To do that you need to visit the website My Apache Friends (https://www.apachefriends.org/download.html) and search for the version for your Linux in the Download section.
Installation of Xampp is a little bit tricky but don’t worry you can do with a few minutes.
- First of all, fetch the downloaded file(xampp setup) to the desktop. It is done to make the installation easier.
- Try to install it by double-clicking it.
If the setup runs then its a very good news for you. You can jump to Step 4.
But if the setup does not occur don’t and shows the error, then follow the next step.
- Open terminal and Enter the following command
(it is used to make you super user)
(this command is used to tell the console to make the current directory as Desktop )
chmod 755 xampp-linux-x64-7.0.20-0-installer-run
(chmod is used to change the mode to access the file. Here chmod 755 is used to tell the console that we are accessing the file as read and write format becoming an owner)
(this command is used to tell the console to do something. Often used to open any file)
- Wait for 10 secs and the dialogue box will appear. The setup wizard is opened.
- Then next steps are pretty simple, Just click on next options.
- Your XAMPP is installed in the Directory /opt/lampp. Click on Finish, and Launch the Application
Next time when you want to launch the application, just enter the following code in the terminal.
- Click on Manage server
There you will see three options. You have to start MySQL Database and Apache Web Server.
- Open any web browser and type localhost/myphpadmin in the URL and press Enter.
- You will see a page. That’s your localhost home page.
Cheers .. You have successfully installed XAMPP on your Linux. Now you have to install WordPress on the localhost. Don’t worry it won’t take much time.
On the very beginning, you have to visit the WordPress.org (official website), to download the WordPress CMS.
- Download the zip file from the website. (It is free to download)
- Go to the location where the zip file(wordpress) is downloaded, and extract it to the htdocs folder, which is located inside the LAMPP folder (Directory:- .opt/lampp/htdocs )
Note: The contents of the WordPress folder is only readable. You cannot edit it directly. So have patience and follow the steps.
- Open your web browser and type URL localhost/wordpress and press enter. You will see the following web page.
Click on Let’s Go
- In the next step, you have to fill the following form by changing the values of
Database – wordpress
Username – root
Password – (keep it blank)
Click on the Submit
- Now they will provide you the code. Just copy the code.
Create a notepad file at the Desktop. Name it as wp-config.php and paste the code in it.
- We have to move the notepad file to the wordpress folder which is present in lampp/htdocs.
Since the wordpress folder is only readable that’s why we are unable to paste it directly.
We have to make the folder read and writable, to do so type the following command in terminal
(this code changes the directory to htdocs)
sudo chmod -R 77 /opt/lampp/htdocs/wordpress
(it makes the components of the folder read and writeable)
- Now paste the notepad file (wp-config.php) in the wordpress folder.
- Again move to the set-up which you were doing in the web browser and Click on Run the install.
- In this step, you have to fill the following form as per your wish where Username and Password are mandatory.
- Your dashboard will open
After working on WordPress save the things and close the browser. Then open the XAMPP application and click on Stop All and close the window.
But if you want to open the XAMPP again then you have to follow the following instructions. You have to enter two commands in your terminal.
Opening the Xampp Application
- Open the terminal
- Write the command
sudo /opt/lampp/manager-linux-x64 .run(this code will run the application forcefully through terminal)
- Open your web browser and enter localhost/wordpress
- The sign in page will open. Fill the form using the information you have at the time of set-up.
Hurray.. You have installed the WordPress in your localhost. Yeah, it is a bit difficult but you can do it easily, just don’t lose the patience. Now when you have installed the WordPress start inspecting all the options and edit the things. You can download the plugins or install different themes.
If Error Occurs on Installing Plugins or Themes
You may find an error of FTP. Don’t worry just follow the steps:
- Go to the directory opt/lampp/htdocs/wordpress
- Open wp-config.php
- Add the syntax define(‘FS_METHOD’, ‘direct’);
You can add this syntax anywhere in the file.
- Save it
- Now you can install plugins and themes.
You will notice that you can upload the themes and plugins after downloading. You will also notice that it works faster. Whether you are offline or online you can write the post edit the settings. Then only thing is that no one can see your blog.
I have mentioned that there are many localhost servers if you want to install any other. But the basic steps will be same. When you have installed the WordPress in your localhost you can avail all the features of the WordPress.org.
We cannot say that the WordPress will work fully offline, as you have to install the plugins or themes, then you definitely should have an internet connection.
If you own a blog which is on a web server then you cannot directly test any plugins or themes there on your dedicated blog. In case you want to test the plugins you can run it on your localhost WordPress. There is also an advantage that no one is going to watch your blog at the localhost.
For the newbies, it is very useful to gain the experience and knowledge about the platform.
I hope you this post has helped you and if you want for posts on blogging then keep visiting our blog. You can share this guide to your friends so that this guide may help them also.