我最初在安装服务器时安装了 LAMP 包。我花了很长时间才让 Web 服务器工作,然后我发现 PHP 没有作为包的一部分安装,这很奇怪,因为它应该是。我还尝试安装 SSH 服务器,以便可以使用 Putty 登录。每当我尝试安装任何东西时,我都会得到以下信息:-
jim@Unseen:~$ sudo apt-get -f install php libapache2-mod-php php-mcrypt php-mysq
l
Reading package lists... Done
Building dependency tree
Reading state information... Done
libapache2-mod-php is already the newest version (1:7.0+35ubuntu6.1).
php-mysql is already the newest version (1:7.0+35ubuntu6.1).
The following additional packages will be installed:
libmcrypt4 php7.0 php7.0-mcrypt
Suggested packages:
libmcrypt-dev mcrypt
The following NEW packages will be installed
libmcrypt4 php php-mcrypt php7.0 php7.0-mcrypt
0 to upgrade, 5 to newly install, 0 to remove and 0 not to upgrade.
Need to get 0 B/83.5 kB of archives.
After this operation, 326 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
E: Waited for /usr/sbin/dpkg-preconfigure --apt || true but it wasn't there
E: Failure running script /usr/sbin/dpkg-preconfigure --apt || true
我试过apt-get clean。我试过标准的apt-get。我已经运行了 apt-get update。我尝试的任何方法似乎都不起作用。任何人都可以提出任何建议来帮助我。我是 ubuntu 的新手,对此感到非常沮丧。提前致谢
编辑:
尽管我的服务器是 16.04.4,但我尝试了在引用 14.0* 的类似帖子中建议的修复:-
sudo sh -c "echo 'DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};' >> /etc/apt/apt.conf.d/70debconf"
这不起作用,并报告 70debconf 不存在。
编辑 2
我按照建议更正了命令字符串:-
sudo sh -c "echo 'DPkg::Pre-Install-Pkgs {\"/usr/sbin/dpkg-preconf
igure --apt || true\";};' >> /etc/apt/apt.conf.d/70debconf"
它返回了一个没有消息的提示,所以我认为它有效
然后我运行以下命令: -
sudo apt-get install openssh-server
并返回与以前完全相同:-
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ncurses-term openssh-sftp-server python3-requests python3-urllib3
ssh-import-id
Suggested packages:
ssh-askpass rssh molly-guard monkeysphere python3-ndg-httpsclient
python3-openssl python3-pyasn1
The following NEW packages will be installed
ncurses-term openssh-server openssh-sftp-server python3-requests
python3-urllib3 ssh-import-id
0 to upgrade, 6 to newly install, 0 to remove and 0 not to upgrade.
Need to get 0 B/746 kB of archives.
After this operation, 5,652 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
E: Waited for /usr/sbin/dpkg-preconfigure --apt || true but it wasn't there
E: Failure running script /usr/sbin/dpkg-preconfigure --apt || true
编辑 3
在一些极好的帮助后,我想到了一个想法。在这些问题开始之前,我安装了 Webmin 作为从桌面远程访问服务器的快捷方式。我尝试通过 webmin 安装 Openssh-server,令我惊讶的是它成功了。所以结论看起来 webmin 以某种方式干扰了服务器上的本机功能。我确信这不应该发生,我想知道我是否应该报告它。
初始答案有问题,内部双引号需要转义
我可以确认 /etc/apt/apt.conf.d/70debconf 在我的 Ubuntu 16.04 和 Ubuntu 17.10 机器上都存在。我的 Ubuntu 16.04 盒子上这个文件的内容是