如何在运行 Centos 6 的虚拟服务器上安装 cPanel
状态:已弃用
本文涵盖不再受支持的 CentOS 版本。如果您当前正在运行运行 CentOS 6 的服务器,我们强烈建议您升级或迁移到受支持的 CentOS 版本。
原因:
请参阅:
关于 cPanel
cPanel 是一个方便的应用程序,允许用户通过 GUI 界面而不是传统的命令行来管理服务器。虽然 cPanel 的安装相对简单,但脚本运行需要几个小时。
笔记
- Once cPanel is installed, it cannot be removed from the server without a complete server restore. cPanel does not offer an uninstaller
- Additionally, cPanel is subject to a licensing fee which may come out to be around $200 a year. DigitalOcean does not cover the cost of cPanel. You can find out more about cPanel pricing here
Setup
Before installing cPanel on our droplet, we need to take two additional steps.
First we need to make sure that Perl is installed on the server
sudo yum install perl
After installing perl we need to take one more preliminary step. cPanel is very picky about making sure that server that it is installed on has a Fully Qualified Domain Name. To that effect, we need to provide it with a valid hostname. Skipping this step will inevitably get you the following, very common, error.
2012-11-01 16:00:54 461 (ERROR): Your hostname () is not set properly. Please
2012-11-01 16:00:54 462 (ERROR): change your hostname to a fully qualified domain name,
2012-11-01 16:00:54 463 (ERROR): and re-run this installer.
Luckily this error has a very easy solution. If you have a FQDN, you can type it in with the command:
hostname your FQDN
Otherwise, if you want to proceed with the cPanel installation but do still lack the hostname, you can input a temporary one. Once cPanel is installed, you will be able to change the hostname to the correct one on one of the first setup pages.
hostname host.example.com
Install cPanel
Although the cPanel installation only has several steps, the installation does take a long time. Although using program "screen" is not necessary in order to install cPanel, it can be a very helpful addition to the installation process. It can be especially useful if you know that you may have issues with intermittent internet or that you will need to pause the lengthy install process.
To start off, go ahead and install screen and wget:
sudo yum install screen wget
Once screen is installed, start a new session running:
screen
After opening screen, you can proceed to install cPanel with WHM or a DNS only version of cPanel.
- Use this this command to install cPanel with WHM:
wget -N http://httpupdate.cPanel.net/latest
- Use this command to install the DNS only version of cPanel:
wget -N http://httpupdate.cPanel.net/latest-dnsonly
下载请求的包后,我们可以继续并开始运行脚本:
sh latest
然后关闭屏幕。该脚本可能需要一到两个小时才能完成,它会在后台继续运行——即使您关闭了服务器。
为了分离屏幕类型:Cntrl-a-d
要重新连接到屏幕,您可以使用以下命令:
screen -r
一旦 cPanel 最终安装完毕,您可以通过转到您的 IP 地址访问登录:2087(例如 12.34.45.678:2087l)或域(example.com:2087)
您的登录名将是:
username: your_server_user
password: your_password
从那里,您可以创建您的 cpanel 用户并最终登录到 ipaddress/cpanel 或 domain/cpanel