Error installing apache2

0

When executing the command sudo apt-get install apache2 the following error is returned:

Os pacotes a seguir têm dependências não satisfeitas:
apache2 : Depende: apache2-bin (= 2.4.7-1ubuntu4.9) mas não vai ser instalado
E: Não foi possível corrigir problemas, você tem pacotes mantidos (hold) estragados.

How to solve the problem?

I have tried the following commands to repair broken packages and nothing has resulted:

sudo apt-get clean && sudo apt-get update
dpkg --configure -a
sudo apt-get install -f

The version of Ubuntu is 14.04 LTS.

Follow the /etc/apt/sources.list file:

deb http://pt.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty main restricted
deb http://pt.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb http://pt.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty universe
deb http://pt.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb http://pt.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://pt.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb http://pt.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://pt.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
deb http://extras.ubuntu.com/ubuntu trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main
    
asked by anonymous 17.02.2016 / 14:48

1 answer

0

Open the terminal and enter the following commands:

  • Rename the current sources.list (or remove):

    sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
    
  • Open the software-properties-gtk program:

    sudo software-properties-gtk
    

This was to restart sources.list as in the askubuntu response, then select the options as in the image:

OnlyinDownloadfromOther...andlookfortherepositoryofyourcountry(IusuallyusethesameAmerican),thiswillgenerateanewsources.list.

Nowrunthefollowingcommands:

sudoapt-getupdatesudoapt-getupgradesudoapt-getautoremovesudoapt-getautoclean

Maybesome"important" things will be uninstalled, but you can reinstall again.

Then try to run the:

sudo apt-get install apache2

If it fails again try doing the process again, instead of using the rename command do the following:

sudo apt-get clean
sudo mv /var/lib/apt/lists /var/lib/apt/lists.old
sudo rm -rf /var/lib/apt/lists/

Then open software-properties-gtk and follow the same steps as above.

    
17.02.2016 / 19:25