ubuntu - 由于无法制作备份链接,Nginx 无法安装

标签 ubuntu nginx vagrant

我正在尝试在原始 ubuntu 机器上简单地安装 nginx。我使用 vagrant 并向 ubuntu/trusty64 发出“vagrant up”,然后尝试安装 nginx。它给出了这个错误:
安装新版本前无法制作“./usr/share/nginx/html/index.html”的备份链接:Operation not pe

这是完整的输出:


vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0
  libjpeg-turbo8 libjpeg8 libtiff5 libvpx1 libxpm4 libxslt1.1 nginx-common
  nginx-core
Suggested packages:
  libgd-tools fcgiwrap nginx-doc
The following NEW packages will be installed:
  fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0
  libjpeg-turbo8 libjpeg8 libtiff5 libvpx1 libxpm4 libxslt1.1 nginx
  nginx-common nginx-core
0 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2,704 kB of archives.
After this operation, 9,056 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package fonts-dejavu-core.
(Reading database ... 59966 files and directories currently installed.)
Preparing to unpack .../fonts-dejavu-core_2.34-1ubuntu1_all.deb ...
Unpacking fonts-dejavu-core (2.34-1ubuntu1) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../fontconfig-config_2.11.0-0ubuntu4.1_all.deb ...
Unpacking fontconfig-config (2.11.0-0ubuntu4.1) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../libfontconfig1_2.11.0-0ubuntu4.1_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.11.0-0ubuntu4.1) ...
Selecting previously unselected package libjpeg-turbo8:amd64.
Preparing to unpack .../libjpeg-turbo8_1.3.0-0ubuntu2_amd64.deb ...
Unpacking libjpeg-turbo8:amd64 (1.3.0-0ubuntu2) ...
Selecting previously unselected package libjpeg8:amd64.
Preparing to unpack .../libjpeg8_8c-2ubuntu8_amd64.deb ...
Unpacking libjpeg8:amd64 (8c-2ubuntu8) ...
Selecting previously unselected package libjbig0:amd64.
Preparing to unpack .../libjbig0_2.0-2ubuntu4.1_amd64.deb ...
Unpacking libjbig0:amd64 (2.0-2ubuntu4.1) ...
Selecting previously unselected package libtiff5:amd64.
Preparing to unpack .../libtiff5_4.0.3-7ubuntu0.3_amd64.deb ...
Unpacking libtiff5:amd64 (4.0.3-7ubuntu0.3) ...
Selecting previously unselected package libvpx1:amd64.
Preparing to unpack .../libvpx1_1.3.0-2_amd64.deb ...
Unpacking libvpx1:amd64 (1.3.0-2) ...
Selecting previously unselected package libxpm4:amd64.
Preparing to unpack .../libxpm4_1%3a3.5.10-1_amd64.deb ...
Unpacking libxpm4:amd64 (1:3.5.10-1) ...
Selecting previously unselected package libgd3:amd64.
Preparing to unpack .../libgd3_2.1.0-3_amd64.deb ...
Unpacking libgd3:amd64 (2.1.0-3) ...
Selecting previously unselected package libxslt1.1:amd64.
Preparing to unpack .../libxslt1.1_1.1.28-2build1_amd64.deb ...
Unpacking libxslt1.1:amd64 (1.1.28-2build1) ...
Preparing to unpack .../nginx-common_1.4.6-1ubuntu3.2_all.deb ...
Unpacking nginx-common (1.4.6-1ubuntu3.2) ...
dpkg: error processing archive /var/cache/apt/archives/nginx-common_1.4.6-1ubuntu3.2_all.deb (--unpack):
 unable to make backup link of `./usr/share/nginx/html/index.html' before installing new version: Operation not permitted
Selecting previously unselected package nginx-core.
Preparing to unpack .../nginx-core_1.4.6-1ubuntu3.2_amd64.deb ...
Unpacking nginx-core (1.4.6-1ubuntu3.2) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.4.6-1ubuntu3.2_all.deb ...
Unpacking nginx (1.4.6-1ubuntu3.2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/nginx-common_1.4.6-1ubuntu3.2_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

有任何想法吗?

最佳答案

我有同样的问题......
关键是错误中的这一行 -
unable to make backup link of './usr/share/nginx/html/index.html'
您可能将 Vagrant 共享目录设置为 /usr/share/nginx/html那里可能有文件? Vagrant 先设置共享目录,并以 root 身份完成。由于权限问题,安装程序可能在备份此内容时遇到问题。

我通过以下方式修复了它:

  • 关闭 Vagrant
  • 注释掉 Vagrant 文件中的共享目录行
  • 重启 Vagrant
  • 安装 nginx
  • 关闭 Vagrant
  • 取消注释 Vagrant 文件
  • 中的 share 行
  • 重启 Vagrant
  • 关于ubuntu - 由于无法制作备份链接,Nginx 无法安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29810335/

    相关文章:

    c# - web api .net 核心获取 nginx connect() 失败 (111 : Connection refused)

    java - 尝试使用 CommandBox 启动服务器时出现 "GTK+ 2.x symbols detected."错误

    ruby - 为什么安装ruby1.9.2后我的ruby版本在ubuntu上还是老版本?

    express - 使用 aws elastic beantalk 将非 www 重定向到 www

    javascript - 允许远程服务器访问本地主机上的 API 服务器

    vagrant - Chef solo - Vagrant 构建错误

    linux - 如何在 ubuntu 14.04 中安装 Node Linux 二进制文件 (.tar.xz)

    node.js - URL 中的尾部斜线是什么?

    python - 如何在 Windows 10 上使用 ubuntu 设置 vagrant 作为开发服务器?

    ubuntu - 使用 vagrant、hhvm 和 Ubuntu 14.04 安装 Composer