WordPress Installation and Migration Tutorial
This guide will help you with two essential tasks: installing WordPress and migrating a WordPress site from one server to another. This tutorial is broken down into two parts: Installation and Migration.
Part 1: WordPress Installation
Step 1: Prerequisites
Before installing WordPress, you need:
- A domain name (e.g., example.com).
- Web hosting with PHP (7.4 or higher), MySQL (5.6 or higher), or MariaDB.
- FTP client (e.g., FileZilla) for file transfers, if needed.
- A text editor (e.g., Notepad++) for configuring files if required.
Many hosting providers offer 1-click installations for WordPress, but here’s a manual method.
Step 2: Download WordPress
- Go to the WordPress.org website.
- Download the latest stable version of WordPress.
Step 3: Create a Database and User
WordPress requires a MySQL or MariaDB database. You can create one via your hosting control panel (e.g., cPanel or Plesk).
- Log in to cPanel (or your hosting control panel).
- Navigate to MySQL Databases.
- Create a new database (e.g.,
wordpress_db
). - Create a new MySQL user (e.g.,
wp_user
) and assign it a strong password. - Add the user to the database with All Privileges enabled.
Step 4: Upload WordPress Files to Your Server
- Extract the WordPress zip file you downloaded.
- Use an FTP client like FileZilla to connect to your server.
- Upload all WordPress files from the extracted folder to the public_html directory (or the appropriate directory for your site).
Step 5: Configure WordPress
- Open your browser and go to your domain name (e.g.,
http://example.com
). - You’ll be greeted by the WordPress installation screen.
- Choose your language and click Continue.
- Enter the database information:
- Database Name: (the database you created earlier).
- Username: (the MySQL user you created).
- Password: (the password for your MySQL user).
- Database Host:
localhost
(or the host provided by your host). - Table Prefix:
wp_
(or any other prefix for security).
- Click Submit and run the installation.
Step 6: Complete WordPress Installation
- On the next screen, click Run the installation.
- Fill out the required information:
- Site Title: Name of your website.
- Username: Choose an admin username (do not use “admin” for security reasons).
- Password: Choose a strong password.
- Email Address: Enter your email.
- Search Engine Visibility: Uncheck to allow search engines to index your site.
- Click Install WordPress.
Step 7: Access Your WordPress Dashboard
- Once installation is complete, you’ll see a success message.
- Login using the username and password you set.
- You can now customize your website through the Dashboard!
Part 2: WordPress Migration
To migrate a WordPress site from one server to another, follow these steps.
Step 1: Backup Your Website
Before migrating, make sure to backup both your files and database.
Backup Files:
- Use an FTP client to download all files from your old server’s public_html (or the WordPress directory).
- Download all files to your local computer.
Backup Database:
- Log in to your old hosting control panel.
- Go to phpMyAdmin.
- Select the WordPress database.
- Click Export and choose Quick export method in SQL format.
Step 2: Prepare the New Server
- Set up WordPress on the new hosting, as shown in Part 1.
- Create a new database on the new server (just like in Step 3 of the installation).
- Create a new database user and assign it all privileges.
Step 3: Upload Files to the New Server
- Use your FTP client to upload the WordPress files you backed up earlier to the new server.
- Upload the files to the public_html or root directory of your new hosting.
Step 4: Import the Database to the New Server
- Log in to phpMyAdmin on the new server.
- Select the new database you created.
- Click Import and select the SQL file from the database export you downloaded earlier.
- Click Go to import the database.
Step 5: Update wp-config.php
File
On your new server:
- Open the wp-config.php file (in the root of your WordPress installation).
- Update the database connection details:
- DB_NAME: The new database name.
- DB_USER: The new MySQL user.
- DB_PASSWORD: The new MySQL user password.
- DB_HOST: Typically
localhost
, unless your host specifies otherwise.
Step 6: Update URLs in the Database
If your domain name changes during migration (e.g., from oldsite.com
to newsite.com
), you need to update the URLs in the database.
- Log in to phpMyAdmin.
- Run the following SQL query to update all instances of the old URL:
UPDATE wp_options SET option_value = replace(option_value, 'http://oldsite.com', 'http://newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
- If you used images or links with the old URL, you’ll need to replace them throughout the database. You can use plugins like Better Search Replace to do this safely.
Step 7: Test the New Site
- Visit the new domain and check if everything is working correctly.
- Log in to the WordPress Dashboard.
- Verify that all posts, pages, images, and plugins are functioning properly.
Step 8: Update DNS Settings (if applicable)
If you changed your domain name or hosting provider, you’ll need to update your domain’s DNS settings to point to the new server:
- Login to your domain registrar (e.g., GoDaddy, Namecheap).
- Find the DNS settings and update the A record or nameservers to point to the new server.
DNS changes can take up to 48 hours to propagate worldwide.
Step 9: Final Checks
- Test permalinks: Go to Settings > Permalinks and click Save Changes to flush the rewrite rules.
- Clear Cache: If you use a caching plugin, clear the cache to ensure the site reflects the new server.
- Check SSL/HTTPS: Ensure your SSL certificate is correctly installed if you’re using HTTPS.
Additional Tools for Migration
There are several migration plugins available that can simplify the process:
- All-in-One WP Migration
- Duplicator
- UpdraftPlus
These plugins provide a simple interface to backup and restore your WordPress site and handle migrations with fewer steps.
Conclusion
By following the steps above, you should have successfully installed and migrated your WordPress site. Always ensure that you keep backups of your site and database, especially before performing any migrations or updates.