1、系统环境
# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core) <---最小化安装
2、对系统进行优化
#!/bin/bash
##关闭SElinux
check_selinux=$(grep "SELINUX=enforcing" /etc/selinux/config | wc -l)
if [ ${check_selinux} -eq 1 ];then
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
setenforce 0 >/dev/null 2>&1
fi
##安装相关软件
if [ ! -d /etc/yum.repos.d/bak ]; then
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
yum install -y vim wget bash-completion lrzsz net-tools zip unzip nmap
fi
##关闭防火墙
stop_firewalld () {
systemctl stop firewalld
systemctl disable firewalld
}
stop_firewalld
##关闭邮件服务
stop_postfix () {
systemctl stop postfix
systemctl disable postfix
}
stop_postfix
##配置时间同步
config_chrony () {
yum install chrony -y
cat > /etc/chrony.conf << EOF
server ntp.aliyun.com iburst
driftfile /var/lib/chrony/drift
makestep 1 -1
rtcsync
bindcmdaddress 127.0.0.1
logdir /var/log/chrony
EOF
systemctl restart chronyd
systemctl enable chronyd
}
config_chrony
3、安装相关软件
#配置源
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/1epel.repo.bak
yum install https://mirror.webtatic.com/yum/el7/webtatic-release.rpm -y
rm -rf /etc/yum.repos.d/epel.repo
mv /etc/yum.repos.d/1epel.repo.bak /etc/yum.repos.d/epel.repo
yum clean all
yum makecache
#安装软件
yum install mariadb-server httpd php72w php72w-cli php72w-mysqlnd php72w-gd -y
4、配置whmcs包
#下载whmcs包并解压到指定位置
wget -P /root https://s3.amazonaws.com/releases.whmcs.com/v2/pkgs/whmcs-8.5.1-release.1.zip
unzip /root/whmcs-8.5.1-release.1.zip -d /var/www/html
#配置configuration.php
cp /var/www/html/configuration.php.new /var/www/html/configuration.php
chmod 666 /var/www/html/configuration.php
5、配置ioncube包
#下载ioncube_loaders_lin包并解压
wget -P /root https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar -xvf /root/ioncube_loaders_lin_x86-64.tar.gz
#移动相关文件并赋权
mv /root/ioncube/ioncube_loader_lin_7.2*.so /usr/lib64/php/modules/
chmod 755 /usr/lib64/php/modules/ioncube_loader_lin_7.2*
mv /root/ioncube/loader-wizard.php /var/www/html/loader.php
#添加ioncube.ini文件
cat > /etc/php.d/ioncube.ini <<EOF
zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_7.2.so
EOF
#查看mod_rewrite.so是否存在
grep mod_rewrite.so /etc/httpd/conf.modules.d/00-base.conf
6、搞定License文件
链接: https://pan.baidu.com/s/1i4DMlpz 密码: ukrx
找到对应的文件License.php,将/var/www/html/vendor/whmcs/whmcs-foundation/lib的License.php文件替换掉。
7、配置相关应用
#启动MySQL和httpd
systemctl enable httpd mariadb
systemctl start httpd mariadb
#配置MySQL
mysql_secure_installation <---设置完MySQL root 密码后一路"Y"
create database whmcs;
8、登录相关页面查看
http://<IP>/loader.php ###查看是否已经Loader Installed
9、查看相关文件的权限是否正常
#以下是正常的权限
ll /var/lib/php
总用量 8
drwxrwx---. 2 root apache 4096 6月 13 12:57 session
drwxrwx---. 2 root apache 4096 10月 1 2020 wsdlcache
注:
[1]我就是因为这个问题导致了登录的时候报了“Invalid csrf protection token”。
[2]参考了官网的“https://help.whmcs.com/m/troubleshooting/l/678268-troubleshooting-login-problems”解决的。
10、进行whmcs的配置安装
http://<IP>/admin ###根据提示信息操作就行了
注:许可证密钥那块随便写就行了。License已经替换了,不会在验证许可证信息了。
11、配置中文
https://github.com/kaneawk/WHMCS-CN-translations
注:网页有提示如何配置成中文。