How to re-create the repositories in /etc/apt folder in Ubuntu 18.04

I accidentally deleted all the files in the folder /etc/apt which contains sources.list.

Now I am not able to install any software via terminal; I get this error every time:

Package has no installation candidate

How can I fix this? Thank you in advance :-)


You can create sources.list in /etc/apt directory.

sudo touch /etc/apt/sources.list

Open file with nano.

sudo nano /etc/apt/sources.list

Copy following content in file.

#------------------------------------------------------------------------------#
#                            OFFICIAL UBUNTU REPOS                             #
#------------------------------------------------------------------------------#


###### Ubuntu Main Repos
deb http://in.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse 

###### Ubuntu Update Repos
deb http://in.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse 
deb http://in.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse 

Save it and You will be able to run

sudo apt update

and install any packages.