How to create a local WordPress installation – risk-free testing

We recommend making a copy of your WordPress installation and to install this copy on your computer. You can use this local WordPress installation for testing plugins before installing them on your “real” website, for example. If there are problems, it’s always better to identify them on a test system beforehand. A test system also gives plenty of time for error analyses.

The steps described in this post refer to a Windows system. However, the process on Mac or Linux computers is basically the same. You might also like: Transfer your WordPress website from another provider to 1&1.

Tip: If you are using WordPress with a 1&1 Performance Server, you can use the 1-Click Stage for WordPress by 1&1 and skip this tutorial.

Note: You can only install WordPress locally when using Free Mode.

Preparations

Required programs

There are several programs for setting up a local WordPress installation. In this post, we are focusing on the following easy to use tools:

  • Install a local web server and a MySQL database. In our example, XAMPP was installed under the following folder: C:\xampp
    Note:
    This program is also available for Linux and Mac.
  • To download your WordPress files, you need an FTP client such as FileZilla Client.
  • The local WordPress installation has to be adjusted later. We have downloaded the Better Search & Replace plugin for this purpose.

Procedure

Setting up a local WordPress installation involves the following steps:

  1. Downloading WordPress files.
    Download all files of your WordPress installation and copy them to your computer.
  2. Identifying and exporting database.
    You can identify and export the database in your 1&1 Control Panel.
  3. Importing and adjusting database.
    Import the exported database and adjust it using XAMPP.
  4. Adjusting file.
    For WordPress to run locally, you have to adjust one file.
  5. Adjusting links.
    With a plugin, you adjust the links to your local WordPress installation.

 Downloading WordPress files

  1. Create a new folder under C:\xampp\htdocs. In our example: wp-testenvironment
    Note:
    Memorize this folder name. You will need it later to log in to your local WordPress installation for example.
  2. Copy all files of your WordPress installation to the newly created folder with an FTP client.

Downloading Files


Identifying database

If you don’t know which database your WordPress installation uses, check in your 1&1 App Center in advance.

  1. Log in to the 1&1 Control Panel.
  2. Click Hosting > Go to 1&1 App Center.
  3. Show all Free Mode applications.
  4. Write down your WordPress installation’s database name. The important part is the first part until the first period.

Identify Database

Exporting database

  1. Log in to the 1&1 Control Panel.
  2. Click on Hosting.
  3. Click MySQL Database in the Manage webspace section.
  4. Next to the desired database, click phpMyAdmin.
  5. Click Export.
  6. Click Go.
  7. Save the database on your computer.
    Note: Memorize the file name and where you stored the file. You need this information to import the file in the next step.

Exporting Database


Installing WordPress locally

All steps described in this section require your local web server (Apache) and the local database (MySQL) to be started. If you have stopped these modules in the XAMPP Control Panel, you cannot use the local installation.

Importing database

Now you have to import the exported database into a new, empty database of the local web server.

  1. Start the XAMPP Control Panel program.
  2. Start Apache und MySQL.
  3. In the MySQL row, click Admin.
    Start XAMPPThe locally installed phpMyAdmin will open.
  4. Click Databases.
  5. Enter a database name and click Create.
    Creating DatabaseThe new database is displayed in the section on the left. Import the previously exported database into this empty database.
  6. Click on the new database
  7. Click Import.
  8. Click Browse and select the previously exported database.
  9. Click Go.

The database is being imported.

Adjusting local database

The database entries “siteurl” and “home” have to be changed manually. Both still contain the URL under which your “real” WordPress installation can be accessed. You need to replace this URL with a local URL.

  1. On the left-hand side, click on the table ending with “options“.
    Editing Database
  2. Select siteurl and click Edit.
  3. Enter the URL under which your local WordPress installation is available. In our example: http://localhost/wp-testenvironment/
    Note: “wp-testenvironment” is the name of the folder created in the “Downloading WordPress files” section. If you have chosen another folder name, enter this name.
    Editing Siteurl
  4. Click Go.
  5. Select home and click Edit.
  6. Enter the URL of your local WordPress installation again.
    Editing Siteurl and Home
  7. Click Go.

The changed entries have to be in the option_value column.

Adjusting file

You now have to adjust the wp-config.php file. This file still contains the information about the database of your “real” WordPress installation. You have to replace this information with those relevant to your local installation.

  1. Open the folder containing your local WordPress installation. In our example: C:\xampp\htdocs\wp-testenvironment\
    Note:
    “wp-testenvironment” is the name of the folder created in the “Downloading WordPress files” section. If you have chosen another folder name, enter this name.
  2. Open the wp-config.php file in a text editor such as Notepad.
  3. Enter the following information:
    • DB_NAME: Database name of your local WordPress installation.
    • DB_USER: root
    • DB_PASSWORD: leave blank
    • DB_HOST: localhost
      Editing WP-File
  4. Save the file.

The links of the local WordPress installation still point to your online installation. You can easily change this with the Search & Replace plugin.

  1. Go to the admin area of your local WordPress installation by entering the respective URL in your browser. In our example: http://localhost/wp-testenvironment/wp-admin
    Note: “wp-testenvironment” is the name of the folder created in the “Downloading WordPress files” section. If you have chosen another folder name, enter this name.
  2. Install the Better Search & Replace plugin.
  3. Under the name of the plugin you have just installed, click Settings.
  4. Enter the URL of your “online installation” in the Search for field.
  5. Activate the All – search and replace! option.
  6. Enter the URL of your local WordPress installation in the Replace with field.
    In our example: http://localhost/wp-testenvironment/
  7. Click Go.
    Replacing URL
    The changes are being applied.
  8. Click Settings > Permalinks.
  9. Select Post name and click Save Changes.

The local WordPress installation is now set up.


Using the local WordPress installation

  1. To use the local WordPress installation, start the XAMPP Control Panel program.
  2. Start Apache and MySQL.
  3. Enter the address of your local installation in your browser. In our example:
    • http://localhost/wp-testenvironment/
      or
    • http://localhost/wp-testenvironment/wp-admin
      Note: “wp-testenvironment” is the name of the folder created in the “Downloading WordPress files” section. If you have chosen another folder name, enter this name.
  4. Use your local WordPress installation as usual.
Please rate this post :

2 thoughts on “How to create a local WordPress installation – risk-free testing

  1. Philipp Bellmann says:

    In some cases, running Skype can cause problems starting Xampp. In this case Skype is blocking ports needed by Xampp.
    Solution: start Xampp first, then Skype.

  2. Rotimi says:

    There is serious problem with your wordpress dashboard login page. It does not accept set password at all. It’s not a good omen at all. Too trivial to be a problem to a company of your supposed status. I wonder why? Yet, no repsonse from you in terms of customers support.

    I know that is no good enough. You just behaved as if you are Nigerian Start-up company. Honestly, i can’t belief this happening? So this will go on for 3days, logging me out of my account?

    Ok, it’s well.

Leave a Reply

Your email address will not be published. Required fields are marked *