软件包具有未满足的依赖关系 - 无法安装软件包

软件包具有未满足的依赖关系 - 无法安装软件包

我正在尝试使用以下命令安装乘客模块:

sudo 乘客安装 apache2 模块

我得到以下输出:

 * GNU C++ compiler... found at /usr/bin/g++
 * Curl development headers with SSL support... found
 * OpenSSL development headers... found
 * Zlib development headers... found
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 * RubyGems... found
 * Rake... found at /usr/bin/rake
 * rack... found
 * Apache 2... found at /usr/sbin/apache2
 * Apache 2 development headers... not found
 * Apache Portable Runtime (APR) development headers... not found
 * Apache Portable Runtime Utility (APU) development headers... not found

然后它要求我安装:

 * To install Apache 2 development headers:
   Please run apt-get install apache2-prefork-dev as root.

 * To install Apache Portable Runtime (APR) development headers:
   Please run apt-get install libapr1-dev as root.

 * To install Apache Portable Runtime Utility (APU) development headers:
   Please run apt-get install libaprutil1-dev as root.

但是当我跑步时:

sudo apt-get install apache2-prefork-dev libapr1-dev libaprutil1-dev 


Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
  apache2-prefork-dev: Depends: apache2.2-common (= 2.2.14-5ubuntu8.10) but 2.2.20-1ubuntu1 is to be installed
  libapr1-dev: Depends: libapr1 (= 1.3.8-1ubuntu0.3) but 1.4.5-1 is to be installed
  libaprutil1-dev: Depends: libpcre3-dev but it is not going to be installed
E: Broken packages

我安装了ruby1.8.7,rubygem1.8.24,rails3.2.9。

vim /etc/apt/sources.list

#############################################################
################### OFFICIAL UBUNTU REPOS ###################
#############################################################
###### Ubuntu Main Repos
deb http://fr.archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
deb-src http://fr.archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse

###### Ubuntu Update Repos
deb http://fr.archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ lucid-proposed main restricted universe multiverse
deb http://fr.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://fr.archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
deb-src http://fr.archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://fr.archive.ubuntu.com/ubuntu/ lucid-proposed main restricted universe multiverse
deb-src http://fr.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu lucid partner
deb-src http://archive.canonical.com/ubuntu lucid partner

vim /etc/apt/sources.list.d

" ============================================================================
" Netrw Directory Listing                                        (netrw v136)
"   /etc/apt/sources.list.d
"   Sorted by      name
"   Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$
"   Quick Help: <F1>:help  -:go up dir  D:delete  R:rename  s:sort-by  x:exec
" ============================================================================
../
mercurial-ppa-releases-lucid.list
mercurial-ppa-releases-lucid.list.save
.mercurial-ppa-releases-lucid.list.swp

答案1

你尝试过aptitude而不是 apt-get 吗?

我认为你还需要安装“build-essential”包,它需要编译源代码

答案2

乘客安装 apache2 模块用于手动下载和安装。使用 Passenger-install-apache2-module 进行安装是否有特定原因或要求?

“ubuntu”方式(好吧,使用发行版的原因:D)是使用以下内容

sudo apt-get install libapache2-mod-passenger

这应该会引入所有依赖项和大部分预编译的包。

它甚至还可以为 apache 启用乘客模式

ls -l /etc/apache2/mods-enabled
lrwxrwxrwx 1 root root 32 Dec 12 09:50 passenger.conf -> ../mods-available/passenger.conf
lrwxrwxrwx 1 root root 32 Dec 12 09:50 passenger.load -> ../mods-available/passenger.load

更多信息,如果您是 ubuntu 新手,对于 apache 相关软件包,它们通常以libapache2-,所以如果你这样做apt-get install libapache(按 Tab 键),会给你以下

# apt-get install libapache 
Display all 108 possibilities? (y or n)
libapache2-authcassimple-perl     libapache2-mod-proxy-html
libapache2-authcookie-perl        libapache2-mod-python
libapache2-authenntlm-perl        libapache2-mod-python-doc
libapache2-mod-apparmor           libapache2-mod-qos
libapache2-mod-apreq2             libapache2-mod-random
libapache2-mod-auth-cas           libapache2-mod-removeip
libapache2-mod-auth-kerb          libapache2-mod-rivet
libapache2-mod-auth-mysql         libapache2-mod-rivet-doc
libapache2-mod-authn-sasl         libapache2-mod-rpaf
libapache2-mod-auth-ntlm-winbind  libapache2-mod-ruby
libapache2-mod-authn-webid        libapache2-mod-ruwsgi
libapache2-mod-authn-yubikey      libapache2-mod-ruwsgi-dbg
libapache2-mod-authnz-external    libapache2-mod-scgi
libapache2-mod-auth-openid        libapache2-modsecurity
libapache2-mod-auth-pam           libapache2-mod-shib2
libapache2-mod-auth-pgsql         libapache2-mod-spamhaus
libapache2-mod-auth-plain         libapache2-mod-speedycgi
libapache2-mod-auth-radius        libapache2-mod-suphp
libapache2-mod-auth-sys-group     libapache2-mod-upload-progress
libapache2-mod-authz-unixgroup    libapache2-mod-uwsgi
libapache2-mod-axis2c             libapache2-mod-uwsgi-dbg
libapache2-mod-bw                 libapache2-mod-vhost-hash-alias
libapache2-mod-defensible         libapache2-mod-vhost-ldap
libapache2-mod-dnssd              libapache2-mod-wsgi
libapache2-mod-encoding           libapache2-mod-wsgi-py3
libapache2-mod-evasive            libapache2-mod-xsendfile
libapache2-mod-fastcgi            libapache2-reload-perl
libapache2-mod-fcgid              libapache2-request-perl
libapache2-mod-fcgid-dbg          libapache2-svn
libapache2-mod-geoip              libapache2-webauth
libapache2-mod-gnutls             libapache2-webkdc
libapache2-mod-jk                 libapache-admin-config-perl
libapache2-mod-layout             libapache-asp-perl
libapache2-mod-ldap-userdir       libapache-authenhook-perl
libapache2-mod-ldap-userdir-dbg   libapache-authznetldap-perl
libapache2-mod-lisp               libapache-dbilogger-perl
libapache2-mod-log-sql            libapache-dbi-perl
libapache2-mod-log-sql-dbi        libapache-db-perl
libapache2-mod-log-sql-mysql      libapache-gallery-perl
libapache2-mod-log-sql-ssl        libapache-htgroup-perl
libapache2-mod-macro              libapache-htpasswd-perl
libapache2-mod-mime-xattr         libapache-mime4j-java
libapache2-mod-mono               libapache-mime4j-java-doc
libapache2-mod-musicindex         libapache-mod-auth-kerb
libapache2-mod-neko               libapache-mod-jk-doc
libapache2-mod-nss                libapache-mod-security
libapache2-mod-ocamlnet           libapache-poi-java
libapache2-mod-parser3            libapache-poi-java-doc
libapache2-mod-passenger          libapache-pom-java
libapache2-mod-perl2              libapache-ruby1.8
libapache2-mod-perl2-dev          libapache-session-perl
libapache2-mod-perl2-doc          libapache-session-wrapper-perl
libapache2-mod-php5               libapache-sessionx-perl
libapache2-mod-php5filter         libapache-singleton-perl

答案3

首先,确保运行apt-get update, 以更新可安装的软件包版本列表。这不是您唯一的问题,但此错误可能是由于apt-get update最近没有运行而引起的。

您已经从向后移植安装了一些软件包。这些是更新版本的软件包,仅按需安装。对于 Apache 等多软件包软件,您通常需要匹配属于同一软件的所有软件包:2.2.14 或 2.2.20。反向移植软件包仅在明确请求时安装:apache2.2-common从常规发行版 (2.2.14) 中拉入,但系统上的某些内容需要来自反向移植 (2.2.20) 的 Apache 组件。

我认为这些错误没有apt-get提供足够的信息来弄清楚该怎么做。在这种情况下,我建议aptitude以交互方式运行并遵循其冲突解决建议之一或手动选择要安装的软件包版本。

相关内容