无法在Ubuntu 14.04

时间:2015-11-03 14:51:11

标签: apache2 ubuntu-14.04

我无法在Ubuntu 14.04上安装apache2。

执行

sudo apt-get install apache2收到以下错误: -

The following packages have unmet dependencies:
 apache2 : Depends: apache2-bin (= 2.4.7-1ubuntu4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

正如link中所提到的,我尝试过apt-get upgrade -f

也是dpkg --get-selections | grep -i ^apache2

的输出
apache2                     deinstall
apache2-doc                 install
apache2-utils                   install
apache2.2-common                deinstall

apt-mark unhold apache2-bin的输出 apache2-bin was already not hold

apt-cache depends apache2

的输出
apache2
  Depends: lsb-base
  Depends: procps
    procps:i386
  Depends: perl
  Depends: mime-support
  Depends: apache2-bin
  Depends: apache2-data
  Suggests: <www-browser>
    arora
    dillo
    dwb
    lynx-cur:i386
    lynx-cur
    netsurf
    netsurf-fb
    netsurf-gtk
    uzbl
    chimera2
    chromium-browser
    elinks
    epiphany-browser
    firefox
    google-chrome-beta
    google-chrome-stable
    google-chrome-unstable
    konqueror
    links
    links2
    midori
    netrik
    rekonq
    surf
    w3m:i386
    w3m
    xemacs21-mule
    xemacs21-mule-canna-wnn
    xemacs21-nomule
 Suggests: apache2-doc
 |Suggests: apache2-suexec-pristine
  Suggests: apache2-suexec-custom
  Suggests: ufw
  Suggests: apache2-utils
    apache2-utils:i386
  Recommends: ssl-cert
  Conflicts: apache2.2-common
  Conflicts: <apache2.2-common:i386>
  Replaces: apache2.2-common
  Replaces: <apache2.2-common:i386>
  Conflicts: apache2:i386

apt-cache policy apache2 apache2-bin

的输出
apache2:
  Installed: (none)
  Candidate: 2.4.7-1ubuntu4
  Version table:
     2.4.16-4+deb.sury.org~precise+4 0
        100 /var/lib/dpkg/status
     2.4.7-1ubuntu4 0
        500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
apache2-bin:
  Installed: (none)
  Candidate: 2.4.7-1ubuntu4
  Version table:
     2.4.7-1ubuntu4 0
        500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

sudo aptitude -f install apache2

的输出
The following NEW packages will be installed:
  apache2 apache2-bin{a} apache2-data{a} libaprutil1-dbd-sqlite3{ab} libaprutil1-ldap{ab} 
0 packages upgraded, 5 newly installed, 0 to remove and 1 not upgraded.
Need to get 1,106 kB of archives. After unpacking 4,703 kB will be used.
The following packages have unmet dependencies:
 libaprutil1-dbd-sqlite3 : Depends: libaprutil1 (= 1.5.3-1) but 1.5.4-1+deb.sury.org~precise+1 is installed.
 libaprutil1-ldap : Depends: libaprutil1 (= 1.5.3-1) but 1.5.4-1+deb.sury.org~precise+1 is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     apache2 [Not Installed]                            
2)     apache2-bin [Not Installed]                        
3)     libaprutil1-dbd-sqlite3 [Not Installed]            
4)     libaprutil1-ldap [Not Installed]                   



Accept this solution? [Y/n/q/?] Y
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

有人可以帮助解决问题吗?

6 个答案:

答案 0 :(得分:13)

使用以前用于升级PHP5的自定义PPA将Ubuntu 12.04.x升级到14.04.x时,我遇到了类似的问题。

我追查问题,发现有问题的包是libaprutil1。

我尝试以下操作并解决了我的问题

$result = add_role(
    'basic_contributor',
    __( 'Basic Contributor' ),
    array(
        'read'         => true,  // true allows this capability
        'edit_posts'   => true,
        'delete_posts' => false, // Use false to explicitly deny
    )
);
if ( null !== $result ) {
    echo 'Yay! New role created!';
}
else {
    echo 'Oh... the basic_contributor role already exists.';
}

希望它有所帮助!

答案 1 :(得分:2)

我有同样的问题,我用这个命令解决了它

sudo apt-get -f autoremove
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

再试一次:

sudo apt-get install apache2

答案 2 :(得分:1)

嘿,几个月前我遇到了同样的问题! 试试这个:

var ss =  SpreadsheetApp.getActiveSpreadsheet();
var st1 = ss.getSheetByName("Sheet1"); 
var myst = ss.getSheetByName("mysheet");

var SRange = st1.getRange('H27').getValues();
var SData = myst.getRange('AZ49').setValues(SRange);

之后,您可以尝试再次安装。

我希望这会有所帮助: - )

答案 3 :(得分:0)

当被问及时,请不要接受给定的解决方案,以便旁边的aptitude提供一个替代方案,它将安装apache-bin,这是错误显示的未满足的依赖关系。

答案 4 :(得分:0)

我最近解决了这个问题。

----------------issue-----------------------
The following packages have unmet dependencies:
apache2 : Depends: apache2-bin (= 2.4.7-1ubuntu4) but 2.4.29-1ubuntu4.1 is to be installed
E: Unable to correct problems, you have held broken packages.
-------------------------------------------------------------------

首先,从ubuntu中删除apache2-bin,

sudo apt-get --purge remove apache2-bin 

现在安装apache-bin2

sudo apt install apache2

答案 5 :(得分:0)

当您的系统具有与所需版本不同的依赖项时,就会发生这种情况。 就我而言,我删除了依赖项,然后安装了。

sudo apt-get purge apache2-bin

然后:

sudo apt-get install apache2