This guide provides step-by-step instructions for installing and configuring WHMCS via the command line for cPanel and Plesk resellers. This method is efficient for bulk provisioning and supports seamless, automated setup in a Linux environment.
Pre-Requirements
- A valid WHMCS license key.
- Command-line access to your server with administrative privileges.
- A MySQL database with the following details:
- Database Host
- Database Port
- Database User
- Database Name
- Password
- The latest WHMCS .zip file (available from WHMCS Downloads).
Step-by-Step Command Line WHMCS Installation
1. Download and Unzip WHMCS
Download the WHMCS .zip file and unzip it:
wget https://downloads.whmcs.com/WHMCS_latest.zip
unzip WHMCS_latest.zip -d /path/to/whmcs
Replace /path/to/whmcs
with your desired installation path.
2. Rename the Configuration File
After unzipping, navigate to the WHMCS directory and rename configuration.php.new
to configuration.php
:
cd /path/to/whmcs
mv configuration.php.new configuration.php
3. Install WHMCS Using Command Line Options
WHMCS provides an installation script with various options. Here’s a breakdown of the options available:
Option | Description |
---|---|
-c or --config |
Provide configuration data in JSON format. |
-h or --help |
Display help information. |
-i or --install |
Perform a new WHMCS installation. |
-n or --non-interactive |
Run installation without requiring user input. |
-s or --status |
Check status of files and databases in the WHMCS installation. |
-u or --upgrade |
Upgrade an existing WHMCS installation. |
-v or --verbose |
Enable verbose output for troubleshooting. |
4. Supplying Configuration Data
Using the -c
or --config
option, you can supply configuration data in JSON format directly from the command line:
#!/bin/env bash
CONF='{
"admin":{
"username":"admin_name",
"password":"'$ADMIN_PASS'"
},
"configuration":{
"license": "'$LICENSE_KEY'",
"db_host": "'$DB_HOST'",
"db_username": "'$DB_USER'",
"db_password": "'$DB_PASS'",
"db_name": "'$DB_NAME'",
"cc_encryption_hash": "'$ENCRYPT_HASH'",
"mysql_charset": "utf8"
}
}'
echo $(echo $CONF | tr -d "\n") | php -f bin/installer.php -- -i -n -c
Gotcha:
Make sure to generate a 64-character encryption hash value. You can use OpenSSL for this:
ENCRYPT_HASH=$(openssl rand -base64 128 | tr -d "\n\/+=" | cut -c 1-64)
This hash value is critical for encrypting sensitive information in WHMCS.
5. Access WHMCS Admin Panel
Once the installation is complete, log in to the WHMCS Admin area. The URL typically follows this format:
http://yourdomain.com/whmcs/admin
Post-Installation Configuration for cPanel & Plesk Resellers
After installation, configure WHMCS for reseller management on cPanel or Plesk.
1. Set Up cPanel and Plesk Servers
In WHMCS, go to Configuration > System Settings > Servers:
- Select Add New Server.
- Choose either cPanel or Plesk from the module dropdown.
- Enter server details, including hostname, IP address, and access credentials.
- Save your changes.
Gotcha:
Ensure correct API credentials for both cPanel and Plesk to avoid connection issues.
2. Configure Reseller Products
In Configuration > System Settings > Products/Services:
- Set up reseller packages by adding products tailored to cPanel and Plesk features.
- Assign the product to the appropriate server group (cPanel or Plesk).
3. Set Up Payment Gateways
In Configuration > System Settings > Payment Gateways, enable your preferred gateways and configure as necessary.
4. Customize Client Area and Ordering
Customize the client area experience for your resellers:
- In General Settings > Ordering, select an order form template optimized for resellers.
- Under Domains, configure domain pricing if offering domains as part of reseller plans.
5. Enable Automation Settings
Ensure automated provisioning and billing for your resellers:
- Go to Configuration > System Settings > Automation Settings.
- Enable daily automation, including suspension and termination options.