Generate ‘sources.list’ For Ubuntu Online With Repogen
by James • May 3, 2012 • Info, Tutorial

Hello guys! Today I have a quickie for you on getting your Ubuntu ‘sources.list’ configured correctly for the optimal configuration for the best package options to install in Ubuntu Linux. This tutorial is configured for the following distributions:
- Ubuntu 10.04 LTS Lucid Lynx
- Ubuntu 11.04 Natty Narwhal
- Ubuntu 11.10 Oneiric Ocelot
- Ubuntu 12.04 LTS Precise Pangolin
We will be modifying the ‘sources.list’ file, so if you are wondering what I’m talking about, I’ll explain briefly. If not skip to the bottom:
In Ubuntu, you can fetch and download programs from the Terminal, or from a package manager like Synaptic or the Ubuntu Software Center. Your available programs come from a list which says to the computer where it can and can’t get programs to download. This is where all the talk you hear about ‘universe’ and ‘multiverse’ in the software sources comes from.
If you would like to view your sources file, open a terminal, and type:
sudo nano /etc/apt/sources.list
This will bring up a big file, with readable text with some headings and what looks like URL’s. They should be colored, in the terminal, but this may not be the same in all installs, as I’m trying to be as helpful, but general as possible.
You will notice that some of these lines have a ## in front of them. This means that the particular URL after the ## will be ignored, or ‘commented out’.
If you would like to quickly enable a few of these, you may erase the ## and the space before the ‘deb’ and URL. The line should change color if you had colored text before. This means you did it correctly.
If you skipped the ‘sources.list’ description, resume here for Repogen!
Go to http://repogen.simplylinux.ch
Ok so now that we have brought everyone to the same page, Repogen lets you pick from popular software sources, and when you click generate, it generates a ‘sources.list’ ready for you to integrate into your install.
Go ahead and pick some software sources, and click generate. When you have done that, go to the next step.
Once you have your sources generated, there are two boxes at the bottom. Depending on what you picked, there will be text in the first big box, and there may or may not be text in the second box. Do not worry if there is no text in the second box, you will just finish before the rest of the tutorial.
Open a terminal, and issue this command to get root access to your ‘sources.list’ file. Remember, Linux is case-sensitive, so type exactly as I have here.
sudo nano /etc/apt/sources.list
This should bring you to a text file, which may or may not have colored text depending on your ubuntu version. You should delete everything in this file, and replace it with the contents of the first box you generated. Do not worry, nothing will go wrong, you are just scared because I used the word ‘delete’.
TIP: There is no ‘Select All’ option that I know of, so you may use ctrl+K to delete entire lines instead of holding down delete or backspace.
Paste everything into the file with the key combo SHIFT+INS which is the linux command line version of CTRL+V, or paste, in windows. Once you have pasted everything into the sources.list, be sure you press CTRL+X, then be sure the filename is ‘sources.list’ without the quotes, and exit. If you got any errors, saying that you may not save it at that location because of privileges, it means you are not root, and should go back to the terminal and be sure to type ‘sudo su’ then try again.
If all went well, and chances are, it did, you should be back at the regular command prompt. If you did not have anything in the second box I described earlier, you may skip the next step.
If you DID have something in the second box, these are like keys to the door of the software store, so copy and paste each line, one at a time and hit enter. It should fetch a key for you and store it in your keyring automatically.
If you get an error, you can usually find the command to retrieve the key by selecting the error, and pasting it into Google. That seems obnoxious of me, but that is a different tutorial all together.
Once you are done fetching all of your keys, you should type the following command to finish the process, which will update and upgrade your software list, and software titles you have currently. This could take a while, depending on your download speed, so you might want to grab a Snickers.
sudo apt-get update && sudo apt-get upgrade -y
If you have any questions, or if you have anything to add, I’d love to hear from you in the comments!


