Mar 09, 2021
How to Install WordPress: A Beginner’s Guide
WordPress is free, open-source software that is known to be versatile and effortless to install. If you’re here to know how to install WordPress, keep reading. Keep in mind, however, that this guide is for installing WordPress on shared hosting and a local machine (Windows and Mac). To learn how to install WordPress on VPS, refer to this article.
All of that said, let’s get started.
How to Install WordPress with Auto Installer
The easiest way to install WordPress is to choose a host that does it for you. We will show you the process of setting up WordPress on Hostinger, which is quick and easy thanks to its one-click installer:
- Log in to your hPanel and locate the Auto Installer under the Website section.
- Click on the WordPress icon, fill in the required fields, and click Install.
You can now log in to the administrator dashboard by selecting WordPress on the Actions field under the List of Installed Applications and begin creating your website.
How to Install WordPress Manually
If the automatic WordPress installer doesn’t seem to be working, or it’s not available in your hosting plan, you can install WordPress manually. Follow the steps below for an easy installation process.
Preparing the WordPress Install
Before we begin the installation process, let’s set up a few things first:
- Download and extract the latest version of WordPress.
- Next, we need to create a database and user. Log in to your hPanel and go to MySQL Database under the Database section. After filling in the required fields, press Create.
IMPORTANT: Make sure to copy the MySQL credentials complete with the alphanumerical strings – you will need them later.
This file contains the database information and lets WordPress know which database to pull information from. The wp-config.php file can be found in File Manager in the folder where WordPress is installed. Follow the steps below to configure your WordPress files.
- Log in to your hPanel.
- In the Files section click on File Manager. When the box pops open, select Web Root and check the box for Show Hidden Files, then click Go.
- Click and expand the file public_html and open the folder containing the WordPress installation.
- Locate the wp-config-sample.php file and rename it to wp-config.php, then right-click on it, and select Code Edit. Once open, look for the information that says:
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'database_name_here' ); /** MySQL database username */ define( 'DB_USER', 'username_here' ); /** MySQL database password */ define( 'DB_PASSWORD', 'password_here' ); /** MySQL hostname */ define( 'DB_HOST', 'localhost' );
- Replace database_name_here with the name of the MySQL Database you created earlier.
- Replace username_here with the username you created and password_here with the password you created.
- When you’ve finished editing, click Save Changes, and close the file.
Now that we have the preparation stage covered, we can proceed with the installation process. Type in your domain name in a browser to open the setup page.
The WordPress 5-minute installation wizard only has five steps in total:
- Select your language and press Continue.
- WordPress will ask to collect the MySQL details. Since you already have them, press Let’s go!
- Enter the MySQL database credentials. You may leave the Database Host and the Table Prefix fields as they are. Only change the latter if you wish to run multiple installations inside one database. Click Submit.
- WordPress will check whether it’s possible to connect to the MySQL database you have created. If there are no errors, select Run the installation.
- Fill in the website and administrator’s information. Click Install WordPress to finalize the process.
You can now press the Login button to access the WordPress admin area.
How to Install WordPress Locally
If you install WordPress locally, you will gain access to a controlled environment to test out any changes before implementing them on your live website. Let’s look at the ways to achieve this on Mac and Windows:
Installing WordPress on Mac Using MAMP
To install WordPress locally on a Mac computer, we will be using MAMP (Macintosh, Apache, MySQL, PHP).
This tool allows you to create a PHP and MySQL server on your machine. In other words, it provides all the necessary ingredients to run a WordPress environment locally for testing purposes.
Installing MAMP and Creating a Database
Similar to the manual installation on shared hosting, we must prepare the server and the database first:
- Download and install the latest version of MAMP on your Mac.
- The installation wizard is quite simple and does not require any custom settings. Proceed until the setup is complete.
- Create a database by accessing the Database tab.
- Insert the Name of the new database -> Create. For this example, we’re going to use w0rdpr3ss as our database name.
That’s it. We’re ready to set up WordPress locally on a Mac OS.
Performing the WordPress Installation
If you haven’t already, download WordPress and extract it, unzipping the WordPress package on to your local computer. If you are using an FTP client, skip to the next step. However, if you have shell access to your web server use this command to start the download:
and then unzip the WordPress package with this command:
tar -xzvf latest.tar.gz
Next, do the following:
- Move all the files inside the WordPress folder to the default MAMP document root: Applications/MAMP/htdocs.
- Access the WordPress installation wizard by entering “localhost:8888” in a browser.
- When prompted for the database and user connection details, enter your Database Name. Then, fill in root as the Username and Password. Click Submit to continue the rest of the steps as before.
The next screen will ask you to provide your website information. Choose a username and password, as well as an email address, and click Install WordPress. You should see a success message once it is finished.
Now let’s look at how to do the same thing on Windows.
Installing WordPress on Windows Using WampServer
To install WordPress locally on Windows, we will utilize WampServer instead. The name is short for Windows, Apache, MySQL, PHP. Here’s how to set it up:
Installing WampServer and Creating a Database
After downloading the latest version of WampServer on your computer, follow these steps:
- Install WampServer. No custom configuration is needed, so you may proceed until it finishes. You’ll only be prompted to choose the default browser and text editor for the server to use.
- Access WampServer from the taskbar and launch phpMyadmin.
- In the login screen, enter root as the username. Leave the password blank.
- Navigate to the Databases tab, enter a name, and Create a new database for your WordPress.5. Next, click the Users tab and make sure the user relating to the WordPress appears, if not, create a new one.
Performing the WordPress Install
Once the preparation is all taken care of, you can proceed to install WordPress by following these steps:
- Move the WordPress files inside the document root directory of C:/wamp64/www on to your computer.
- Open your browser, enter “localhost” on the search bar to open the setup page.
- Choose the language and fill in the database details when required. Again, use root as the username, but this time, leave the password field empty.
Then, make sure to complete the remaining setup steps, and you’ll have WordPress available on your local Windows machine in no time.
Common Installation Problems
The following are the most common problems encountered when installing WordPress.
Directory Listing Instead of a Web Page
This happens when the web server isn’t viewing the index.php file. Since it needs to be told to do so, we can fix this problem by using Apache. Use the DirectoryIndex index.php directive and create a new file in the installed directory named .htaccess. If that doesn’t work, delete it and add the directive to the web server’s configuration files instead.
Headers Already Sent Error
This error is caused by introducing a syntax error when editing the wp-config.php file. To fix this error, begin by downloading the wp-config.php file over again. Open the file in a text editor and make sure that the first line is <?php and that there is nothing before it. Then, make sure that the last line is ?> and that there is nothing after it. Save the file and re-upload it, then reload your page.
Page Looks Like Gibberish
If the source code in your page is filled with <?php ?> tags everywhere, your PHP is not working correctly. All PHP code needs to be executed before the server sends the HTML results to your web browser. To fix this error, make sure your web server meets the requirements needed to run WordPress. Also, check if PHP is installed correctly and no errors appear when being configured. If problems still persist, contact your web host or customer support team for additional help.
Error Connecting to Database
If an Error connecting to the database is popping up, but you are positive that your configuration is correct, you can try resetting your MySQL password. To do so via shell, use the following command:
SET PASSWORD FOR 'wp_username'@'hostname' = OLD_PASSWORD('new_password');
If you do not have shell access, try logging into your phpMyAdmin and entering the command into an SQL query. If that doesn’t work either, log into your panel and reset the password in your Database section.
By finishing this tutorial, you have learned how to install WordPress automatically and manually on shared hosting. Also, we’ve learned the steps to install it locally on Mac and Windows machines.
Leave a comment below and let us know if you have any questions.