How to Install WordPress on Linux using XAMPP (2023)

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.

  1. Installing XAMPP Server on your Linux
  2. Run WordPress on the Localhost

Installing XAMPP Server on your Linux


Downloading
XAMPP

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.

Installing XAMPP

Installation of Xampp is a little bit tricky but don’t worry you can do with a few minutes.

  1. First of all, fetch the downloaded file(xampp setup) to the desktop. It is done to make the installation easier.
  2. 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.
    error
  3. Open terminal and Enter the following command
    install-xampp-using terminalsu root
    (it is used to make you super user)
    cd Desktop

    (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)
    sudo ./xampp-linux-x64-7.0.20-0-installer-run
    (this command is used to tell the console to do something. Often used to open any file)
  4. Wait for 10 secs and the dialogue box will appear. The setup wizard is opened.
    xampp-setup
  5. Then next steps are pretty simple, Just click on next options.
  6. Your XAMPP is installed in the Directory /opt/lampp. Click on Finish, and Launch the Application
    xampp-directory
    Next time when you want to launch the application, just enter the following code in the terminal.
  7. Click on Manage server
    start-apache-sql
    There you will see three options. You have to start MySQL Database and Apache Web Server.
  8. Open any web browser and type localhost/phpmyadmin in the URL and press Enter.
  9. You will see a page. That’s your localhost home page.
    myphpadmin

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.

Installing WordPress on the Localhost

On the very beginning, you have to visit the WordPress.org (official website), to download the WordPress CMS.

  1. Download the zip file from the website. (It is free to download)
    How to Install WordPress on Linux using XAMPP (2023) 1
  2. 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.
  3. Open your web browser and type URL localhost/wordpress and press enter. You will see the following web page.
    Click on Let’s Go
    setup-localhost-wordpress
  4. 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
    editing-database
  5. Now they will provide you the code. Just copy the code.
    edit-wp-config-within-itCreate a notepad file at the Desktop. Name it as wp-config.php and paste the code in it.
  6. 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
    make-wordpress-writeablecd /opt/lampp/htdocs
    (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)
  7. Now paste the notepad file (wp-config.php) in the wordpress folder.
  8. Again move to the set-up which you were doing in the web browser and Click on Run the install.
  9. In this step, you have to fill the following form as per your wish where Username and Password are mandatory.
    install-wordpress
  10. Your dashboard will opendashboard

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

  1. Open the terminal
  2. Write the command
    sudo /opt/lampp/manager-linux-x64 .run
    (this code will run the application forcefully through terminal)
  3. Open your web browser and enter localhost/wordpress
  4. The sign in page will open. Fill the form using the information you have at the time of set-up.

sign-in

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:

  1. Go to the directory opt/lampp/htdocs/wordpress
  2. Open wp-config.php
  3. Add the syntax define(‘FS_METHOD’, ‘direct’);
    You can add this syntax anywhere in the file.
  4. Save it
  5. 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.

CONCLUSION

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.

8 thoughts on “How to Install WordPress on Linux using XAMPP (2023)”

  1. What an informative and fantastic tutorial it is! Actually, this tutorial will be most effective for the audience. I hope, you gift us more article like this. Thank for sharing the most informative tutorial .

    Reply
  2. Took me a while to get this right. My problem was that the .zip file was extracted as a folder named “wordpress-5.7.1” and it had yet another folder called “wordpress” inside.

    What I did was:
    -open file explorer as admin (on Ubuntu that’s $ sudo nautilus)
    -moved the “wordpress” folder to the right place, this article says exactly where

    If you can’t make this work and you notice your folder is named “wordpress-someversion” this should fix it.

    Reply
  3. Hello great article, one more thing before installing WordPress, ensure to go to PHP myadmin, and under the database tab, create a database called WordPress, else you would get a database error.
    You can also use test or any name you prefer, or just use a default database already there.
    Cheers!

    Reply

Leave a Comment