How can I fix apt-get update and installation errors?

Solution 1:

-5 - No address associated with hostname

This error occurs mainly because of invalid or misspelled host name inside /etc/apt/sources.list file.So try the below commands,

sudo rm /etc/apt/sources.list
sudo cp /etc/apt/sources.list.save /etc/apt/sources.list
sudo apt-get update

Note: Before running the above commands please check for /etc/apt/sources.list.save file.If the file was not present then run,

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo touch /etc/apt/sources.list
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"

And also enable other software repositories in Software and Updates.Finally run,

sudo apt-get update

Install vim-gnome package by running,

sudo apt-get install vim-gnome