How do I add a apt-get repository without editing /etc/apt/sources.list?
Solution 1:
You can place files in /etc/apt/sources.list.d
. This is described in the man page for sources.list
(type man sources.list
). The man page says:
Older SOURCES.LIST.D
The /etc/apt/sources.list.d directory provides a way to add sources.list entries in separate files. The format is the same as for the regular sources.list file. File names need to end with .list and may only contain letters (a-z and A-Z), digits (0-9), underscore (_), hyphen (-) and period (.) characters. Otherwise they will be silently ignored.
UPDATE:
2016 SOURCES.LIST.D
The /etc/apt/sources.list.d directory provides a way to add sources.list entries in separate files. Two different file formats are allowed as described in the next two sections. Filenames need to have either the extension .list or .sources depending on the contained format. The filenames may only contain letters (a-z and A-Z), digits (0-9), underscore (_), hyphen (-) and period (.) characters. Otherwise APT will print a notice that it has ignored a file, unless that file matches a pattern in the Dir::Ignore-Files-Silently configuration list - in which case it will be silently ignored.
Solution 2:
You could try:
add-apt-repository <REPOSITORY LINE>
The repository line would just be what you would append to the sources.list or a PPA repository. Check out the manpage here, or execute:
man add-apt-repository
Solution 3:
I (thought that I) needed to add a ppa repo to a crunchbang, (debian) install:
(N.B. "raring" is the ubuntu version that matched the version of debian that I was using) so I did:
sudo su -
# you can call the file anything that you want, but it has to end with .list to be a valid for apt-get
echo 'deb http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu/ raring main'>> /etc/apt/sources.list.d/boot-repair.list
# get the keys for that repo so that apt can verify the signed .deb files
wget http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu/dists/raring/Release.gpg
apt-key add Release.gpg
#gpg --search-keys 60D8DA0B
apt-get update
Most of this is explained on the boot-repair page, (though in the end testdisk and then Gparted were what I actually needed to restore a lost partition and a corrupted MBR.) This probably isn't The Debian way (TM) but it worked for me.
Some debian repos are the "old style" and then you only need a line like:
deb http://repo.alexx.net/apt/ /
# the trailing slash needs to be there
add-apt-repository is good if you have it, but that seems to be more ubuntu.