Install WHMCS on CentOS 7

As you may know, WHMCS is the leading web hosting management and billing software that automates all aspects of your business from billing, provisioning, domain reselling and etc. In this article, we are going to install WHMCS 7.7.1 on CentOS 7.6.

We assume you have a valid WHMCS license and have downloaded its package from WHMCS download area.

Here are our environment OS and software versions:

  • OS: Centos 7.6 on VMware
  • WHMCS: 7.7.1
  • PHP: 7.2
  • Database: Mariadb 10.3
  • Web server: httpd 2.4

Here we start from a fresh minimal CentOS 7.6 installation.

1- Initial CentOS setup
Set correct time and date. here we use “Asia/Dhaka”:

# timedatectl set-timezone America/New_York

Change default root password:

# passwd

Set SELinux to permissive mode by editing /etc/selinux/config:

# vim /etc/selinux/config
SELINUX=permissive

Also to apply it immediately run:

# setenforce 0

Install EPEL repository:

# yum install epel-release

Update OS:

# yum update

2- Install PHP 7 and Apache
Install remi repository for PHP 7 installation:

# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Install yum-utils:

# yum install yum-utils

Enable remi repository:

# yum-config-manager --enable remi-php72

then install PHP 7:

# yum install php php-mbstring php-pear php72-php-pdo.x86_64 php-pdo.x86_64 php-mysql.x86_64 php-ioncube-loader.x86_64 php-curl curl php-soap.x86_64 php72-php-soap.x86_64 php-gd.x86_64 php72-php-gd.x86_64

Edit php.ini and set options like the following:

# vim /etc/php.ini
date.timezone = "Asia/Dhaka"
memory_limit = 1024M
extension=pdo.so
extension=pdo_mysql.so

Install apache and start it:

# yum install httpd
# systemctl enable httpd
# systemctl start httpd

3- Install Mariadb 10.3 and setup database
Install MariaDb. refere to Database replication with mariadb on centos 7 linux.

Login to mariadb and create required user and database:

# mysql –u root –p
# CREATE USER 'your user'@'localhost' IDENTIFIED BY 'your password';
# GRANT ALL PRIVILEGES ON *.* TO 'your user'@'localhost';
# Create database 'your database name';

4- Install WHMCS 7.7.1
Extract whmcs installation files to /var/www/html and change owner of files to apache:

chown -r apache:apache /var/www/html/*

Create new configuration.php file and change permission to 777:

# mv /var/www/html/configuration.php.new /var/www/html/configuration.php
# chmod 777 /var/www/html/configuration.php

In Google Chrome or Firefox navigate to your server IP address and install WHMCS. follow the instruction and filll required fiels. after installation, delete install folder from /var/www/html/

# rm -rf /var/www/html/install/

To improve security, move downloads, template_c and attachments directory from /var/www/html/ to /var/www/ :

# mv /var/www/html/attachments/ /var/www/attachments/
# mv /var/www/html/downloads/ /var/www/downloads/
# mv /var/www/html/templates_c/ /var/www/templates_c/

Change owner and permission of above directory:

# chmod 777 /var/www/attachments/ /var/www/downloads/ /var/www/templates_c/
# chown apache:apache /var/www/attachments/ /var/www/downloads/ /var/www/templates_c/

add the following lines to /var/www/html/configuration.php

$mysql_charset = "utf8";
$display_errors="off";
$templates_compiledir = "/var/www/templates_c/";
$attachments_dir = "/var/www/attachments/";
$downloads_dir = "/var/www/downloads/";

add the following line to /etc/crontab

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
*/5 * * * * root /usr/bin/php -q /var/www/html/crons/cron.php

change /var/www/html/configuration permission to 600:

chmod 600 /var/www/html/configuration

Src: https://www.tuxtips.net/how-to-install-whmcs-7-7-1-on-centos-7-linux/
Share

1 thought on “Install WHMCS on CentOS 7”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.