WordPress (WP) is a popular content-management system (CMS). Its ease of use, numerous themes and plugins, and strong community support have propelled it to the top of the world’s solutions list. WordPress is used for a wide range of purposes, from simple blogs to complex websites.
What exactly is cPanel?
Your web hosting server account is managed through cPanel. Many control panels, such as Softaculous, will include automated WordPress installation script installers.
Download WordPress
The most recent official version of the CMS can be downloaded from the WordPress website. Download and save the zip file to your desktop computer.
After downloading the zip file, navigate to its directory and extract the entire archive. Make a note of the extracted content’s location and upload it to your web server.
Upload WordPress Install Script to Server
- Go to your cPanel account. You will find it by browsing to your_domain_name.com/cpanel.
- Enter your user credentials and log in.
- Find the File Manager tool and open it.
- Look for the public_html directory. The public_html directory is your web root, the directory in which you want to store all your websites.
- You need to decide on the location of your WordPress site. There are two options:
- In the root directory of your domain (e.g., your_domain_name.com/)
Upload all contents of the WordPress folder, but not the folder itself. After the upload, all WP files and subfolders should reside in public_html.
- In a subfolder of your domain (e.g., your_domain_name.com/site1).
Upload the entire WordPress folder. When finished, rename the WordPress folder to your desired name (e.g. techx.pk)
- Once you’ve extracted the WordPress installation archive, remove the zip file from your web server. Delete the zip file by right-clicking it.
The files should be extracted into a WordPress folder. That folder should contain all of the necessary WordPress folders and files. You can start the WordPress installation right now by going to your domain name.com/wordpress.
However, before you begin the installation process, you will need the following:
- MySQL is a database.
- A MySQL Database User with the necessary user credentials.
- A database server.
- If you want to run multiple WordPress sites in a single database, use a table prefix.
- A One-of-a-Kind Phrase and Salt Key.
Return to cPanel to create a MySQL database and database user if you haven’t already.
Create a MySQL database and user
Use the MySQL Database Wizard in cPanel to accomplish this. This tool can be found under the Database tab.
- Create a database as the first step. Give your database a name. It will be prefixed with the name of your hosting account.
- Keep your database name in mind. It will come in handy later.
- Select Next Step to begin creating the database.
Users for the Database
The wizard will then ask you to create a database user.
- Create a username (no more than seven characters) and a password. The strength metre should ideally turn green and read Very Strong, indicating that the password is bulletproof. The username will be prefixed with the name of your hosting account.
- Note your password
Assign a User to the Database and Permissions
The newly created user does not have database access.
- Navigate to the page’s Add User To Database section.
- Select your newly created user from the User drop-down menu.
- From the Database drop-down menu, select your newly created database and click Add.
- The next step is to assign database permissions. Select the All Privileges checkbox for the first database user.
- Click Make Changes to assign the user privileges.
- To double-check, go back and scroll down to view the most recent databases. There should be a database and a privileged user associated with it.
Edit wp-config.php File
The database has been created, and the newly created super user has been assigned to the database. To complete the process, you must edit the wp-config-sample.php file using a text editor.
Admins need to insert four (4) pieces of information to complete the process. The lines below are an example, and the information you insert may look different.
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘paterpaker_demowp’);
/** MySQL database username */
define(‘DB_USER’, ‘paterpaker_dbuser’);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘abc.123.!@#’);
/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);
The important pieces of information are:
- DB_NAME. Database name.
- DB_USER. Username of the database user.
- DB_PASSWORD. This is the database user password.
- DB_HOST. In 99% of cases, it’s ‘localhost.’
Make sure to include the prepended parts when typing the value for DB_NAME and DB_USER. Additionally, bear in mind that for most cPanel hosts, the DB_HOST value is ‘localhost.’
Run WordPress Install Scripts
To finish the installation, run the install script by browsing to your WP’s directory.
- If you uploaded the files to the root directory, browse to http://your_domain_name.com/wp-admin/install.php
- If you uploaded WP installation files to a subfolder, browse to http://your_domain_name.com/site1/wp-admin/install.php
In each case, once the install scripts are initiated, WordPress will prompt you to enter database details and write them in a new wp-config.php file. If this fails, you can go back and edit and upload the wp-config.php file yourself.
Complete the WordPress Installation
The next step is the well-known five-minute WP installation procedure. Enter details such as Site Title, your desired WordPress Username and Password, and your Email Address. Please note that the username and password are for this instance of WordPress only. Do not enter the same username and password you used for your database user.
All of this information can be changed later in the WordPress Admin.
Once you are finished, click Install WordPress. When the installation procedure is completed, WP will redirect you to the login screen.
Conclusion
If you have followed this tutorial step-by-step, you should have accomplished the following:
- Downloaded and extracted the latest version of WordPress installation files.
- Uploaded the files to your desired directory.
- Created a MySQL database and database user.
- Successfully updated the wp-config-sample.php file and renamed it to wp-config.php.
- Run WordPress installation scripts, created your first WordPress admin user and named your website.
- Installed and logged into WordPress.
To read our blog on “How To protect WordPress site from cyberattacks,” click here