如何在CentOS 8/RHEL 8上安装cPanel和WHM

时间:2020-03-21 11:48:15  来源:igfitidea点击:

cPanel是用于企业Linux服务器的商业企业级Web托管控制面板。
它是针对最新企业Linux的最受嘉奖和推荐的cPanel。
它是为满足托管需求而设计的,大多数托管都将其用于专用托管,半专用托管,共享托管以及云VPS托管提供商。

步骤1(安装cPanel和WHM软件包依赖项)

# dnf install perl*

在安装cPanle和WHM期间暂时禁用防火墙

# systemctl stop firewalld

将服务器的主机名设置为FQDN-完全合格的域名

[root@theitroad ~]# hostnamectl set-hostname cpanel.theitroad.com

输出示例

Static hostname: cpanel.theitroad.com
 Icon name: computer-laptop
 Chassis: laptop
 Machine ID: b292a5b69a2343149ed86f7e6fe782c8
 Boot ID: b50bcafaed9a4ab0941b800ba4356198
 Operating System: CentOS Linux 7 (Core)
 CPE OS Name: cpe:/o:centos:centos:7
 Kernel: Linux 3.10.0-229.el7.x86_64
 Architecture: x86_64

将目录更改为home

# cd ~

步骤2(下载cPanel脚本)

# wget https://securedownloads.cpanel.net/latest

运行下载的cPanel安装脚本

[root@theitroad ~]# bash latest

注意:cPanel需要几分钟才能完成安装。
在安装期间请耐心等待。
取决于Internet连接和系统硬件。

输出示例

2015-01-06 22:14:58 594 ( INFO): cPanel & WHM installation started at: Wed Jan 6 22:14:58 2015!
2015-01-06 22:14:58 595 ( INFO): This installation will require 20-50 minutes, depending on your hardware.
2015-01-06 22:14:58 596 ( INFO): Now is the time to go get another cup of coffee/jolt.
2015-01-06 22:14:58 597 ( INFO): The install will log to the /var/log/cpanel-install.log file.
2015-01-06 22:14:58 598 ( INFO):
2015-01-06 22:14:58 599 ( INFO): Beginning Installation v3...
2015-01-06 22:14:58 392 ( INFO): CentOS 7 (Linux) detected!
2015-01-06 22:14:58 408 ( INFO): Checking 内存 now...
2015-01-06 22:14:58 467 ( INFO): Validating that the system hostname ('cpanel.theitroad.com') is a FQDN...
2015-01-06 22:14:58 1277 (DEBUG): - ssystem [BEGIN]: /usr/bin/rdate -s rdate.cpanel.net
2015-01-06 22:15:04 1277 (DEBUG): - ssystem [END]
2015-01-06 22:15:04 1279 ( INFO): The system set the clock to: Wed Jan 6 22:15:04 2015
2015-01-06 22:15:04 1289 ( INFO): The system changed the clock by 6 seconds.
2015-01-06 22:15:04 995 ( INFO): The installation process will now set up the necessary empty cpanel directories.
2015-01-06 22:15:04 1015 ( INFO): The installation process will now ensure that GPG is set up properly before it imports keys.
2015-01-06 22:15:04 1018 ( INFO): The installation process will now import GPG keys for yum.
2015-01-06 22:15:04 916 ( INFO): Congratulations! Your installation of cPanel & WHM 11.52 is now complete.

步骤3(为cPanel配置防火墙)

启动防火墙

# systemctl start firewalld

安装cPanel之后,我们需要设置防火墙以为cPanel配置服务器。

# cd /usr/local/cpanel/
# bash /scripts/configure_firewall_for_cpanel

步骤4(检查主机名和服务器IP地址)

对于主机名

# hostnamectl

对于服务器IP地址

# ifconfig

注意:我们需要记下主机名和服务器IP地址,以进一步配置cPanel。

步骤5(在Web浏览器中打开cPanel)

打开Web浏览器,例如Mozilla Firefox,Google Chrome等。
在导航列中键入给定的地址。

对于带SSL的WHM
'https://SERVER-IP-ADDRESS:2087'或者'https://SYSTEM-HOSTNAME-(FQDN):2087'
对于不带SSL的WHM
'http://SERVER-IP-ADDRESS:2086'或者'http://SYSTEM-HOSTNAME-(FQDN):2086'
对于带有SSL的cPanel
'https://SERVER-IP-ADDRESS:2083'或者'https://SYSTEM-HOSTNAME-(FQDN):2083'
对于没有SSL的cPanel
'http://SERVER-IP-ADDRESS:2082'或者'http://SYSTEM-HOSTNAME-(FQDN):2082'

步骤6(登录到cPanel和WHM并访问仪表板面板)

输入root登录凭据(如用户名和密码),然后最后单击Login(登录)按钮。

成功登录后,我们需要访问cPanel和WHM的仪表板面板。

现在我们已经在CentOS和RHEL上安装了cPanel和WHM。