我刚刚安装了这些软件包来构建我自己的云,但总是出现安装中止错误:
rqie@rqie-VirtualBox:~$ sudo apt-get install apache2 php5 php5-json php5-gd php5-sqlite curl libcurl3 libcurl3-dev php5-curl php5-common php-xml-parser
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'php5-common' instead of 'php5-json'
Note, selecting 'libcurl4-openssl-dev' instead of 'libcurl3-dev'
php-xml-parser is already the newest version.
apache2 is already the newest version.
curl is already the newest version.
libcurl3 is already the newest version.
libcurl4-openssl-dev is already the newest version.
php5 is already the newest version.
php5-common is already the newest version.
php5-curl is already the newest version.
php5-gd is already the newest version.
php5-sqlite is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 16 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up qmail (1.06-4) ...
hostname -f 命令返回:$1
Your system needs to have a fully qualified domain name (fqdn) in
order to install the var-qmail packages.
Installation aborted.
dpkg: error processing qmail (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of qmail-run:
qmail-run depends on qmail (>= 1.06-2.1); however:
Package qmail is not configured yet.
dpkg: error processing qmail-run (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
qmail
qmail-run
E: Sub-process /usr/bin/dpkg returned an error code (1)
有人能帮助我吗?非常感谢
答案1
从您问题中显示的日志来看,您显然在安装软件包时遇到了问题。但问题不在于您要求安装的软件包:apache2 php5 php5-json php5-gd php5-sqlite curl libcurl3 libcurl3-dev php5-curl php5-common php-xml-parser
。查看包含的行is already the newest version
。所有这些软件包都已安装。
这个错误是之前尝试安装 qmail 时留下的,由于主机名不是完全限定名称而未能成功。如前所述,host.domain.tld
通过修改/etc/hosts
和来设置主机名/etc/hostname
。您至少应该有/etc/hosts
一行内容:
<your ip> <hostname.domain.tld> <hostname>
如果您的计算机具有动态 IP 地址,请使用127.0.0.1
。<your ip>
或者使用您收到的静态 IP。
因此,您已经可以尝试使用 Apache 和 PHP,除非主机名问题导致 Apache 无法正常工作。
答案2
您的系统需要有一个完全限定域名 (fqdn) 才能安装 qmail 软件包。您可能没有设置域名,只在 /etc/hosts 中设置了本地主机名。此外,计算机使用保留的网络地址(通常为 127.0.0.1)与自身通信。实际上,这是通过内核完成的,但它仍然使用网络进程。有关 fdqn 的更多信息这里。
首先您应该使用以下命令停止邮件服务:
~$ service qmail stop
或者:
~$ /etc/init.d/qmail stop
接下来完全删除 qmail pkg:
~ $ sudo apt-get purge qmail
编辑 /etc/hosts
~ $ sudo nano /etc/hosts
找到以下行:
127.0.0.1 hostname
改成:
127.0.0.1 --fqdn www.yourdomain.com hostname
接下来重新安装 qmail 包并记住您在 hosts 中设置的域名。
下次重启时检查:
hostname
hostname -f
这应该可以确认你的更改。