Create Personal Repositories
These are very basic instructions on how to create personal repositories for your .deb files.
Table of Contents
- CD or DVD repository
- Local repository
- Network repository
- USB repository
- Create a local mirror of the Ubuntu repositories on DVD
- Obligatory Happy Ending
CD or DVD repository
Create it
- Create a temporary directory somewhere in your home directory.
- Copy your .deb files into that temporary directory.
- Open a terminal window in the temporary directory.
- Type this command to create a file containing detailed information about your packages:
- Use your favorite software to burn the contents of the temporary directory you created onto a CD or DVD.
- Make sure the CD or DVD is in the drive.
- Type this command in a terminal window to add the descriptions, dependencies, version numbers, etc. to the package manager:
- Delete the temporary directory.
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
There should now be a file named Packages.gz in the temporary directory.
sudo apt-cdrom add
Add it
In order for your repository to be used, the package manager needs to know it exists:
- Insert the CD or DVD.
- Open a terminal window.
- Open the sources.list file in a text editor:
- Kubuntu users type this command:
kdesudo kate /etc/apt/sources.list
- Ubuntu users type this command:
- Uncomment the line that starts with #deb cdrom (this should be near the top of the file) by removing the # from the beginning of the line.
- Example uncommented line:
deb cdrom:[Kubuntu 8.04 _Hardy Heron_ - Release i386 (20080423)]/ hardy main restricted
- Save the file.
- Close the text editor.
gksudo gedit /etc/apt/sources.list
Use it
- Type this command to refresh the list of available repositories:
- Use your package manager or apt-get commands normally.
sudo apt-get update
Remove it
Unless you plan on leaving the CD or DVD in the drive permanently, you’ll want to remove the CD or DVD drive from your sources.list file so you don’t get errors when refreshing the list of available repositories without the CD or DVD in the drive.
- Open the sources.list file in a text editor:
- Kubuntu users type this command:
kdesudo kate /etc/apt/sources.list
- Ubuntu users type this command:
- Comment the line that starts with deb cdrom by adding a # to the beginning of the line.
- Example commented line:
#deb cdrom:[Kubuntu 8.04 _Hardy Heron_ - Release i386 (20080423)]/ hardy main restricted
- Save the file.
- Close the text editor.
- Type this command to refresh the list of available repositories:
gksudo gedit /etc/apt/sources.list
sudo apt-get update
Local repository
Create it
- Create a directory somewhere in your home directory.
- Copy your .deb files into the directory you created.
- Open a terminal window in the directory you created.
- Type this command to create a file containing detailed information about your packages:
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
There should now be a file named Packages.gz in the directory you created.
Add it
In order for your repository to be used, the package manager needs to know it exists:
- Open the sources.list file in a text editor:
- Kubuntu users type this command:
kdesudo kate /etc/apt/sources.list
- Ubuntu users type this command:
- Find the line that starts with #deb cdrom or deb cdrom (this should be near the top of the file).
- Add this line directly below the cdrom line, replacing /myrepositorydirectory with the path to your repository directory:
- Save the file.
- Close the text editor.
gksudo gedit /etc/apt/sources.list
deb file:/myrepositorydirectory /
Use it
- Type this command to refresh the list of available repositories:
- Use your package manager or apt-get commands normally.
sudo apt-get update
Remove it
If you no longer wish to use the local repository, you’ll need to remove it from your sources.list file:
- Open the sources.list file in a text editor:
- Kubuntu users type this command:
kdesudo kate /etc/apt/sources.list
- Ubuntu users type this command:
- Delete the line you added in step 3 above.
- Save the file.
- Close the text editor.
- Type this command to refresh the list of available repositories:
gksudo gedit /etc/apt/sources.list
sudo apt-get update
You can delete the directory or move it to another location, but this is not required.
Network repository
Create it
This requires administrative access to a web server, an FTP server or an NFS share.
- On the remote computer:
- Copy your .deb files into the directory you’d like to share.
- Open a terminal window in the directory that has the .deb files in it.
- Type this command to create a file containing detailed information about the packages:
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
There should now be a file named Packages.gz in the directory with the .deb files.
Add it
In order for your repository to be used, the package manager needs to know it exists:
- On your computer:
- Open the sources.list file in a text editor:
- Kubuntu users type this command:
kdesudo kate /etc/apt/sources.list
- Ubuntu users type this command:
gksudo gedit /etc/apt/sources.list
- Open the sources.list file in a text editor:
- For a web server, replace mywebservername with the name or IP of the web server, and replace /myrepositorydirectory with the path to the repository directory:
deb https://mywebservername/myrepositorydirectory /
deb ftp://myftpserver/myrepositorydirectory /
deb file:/myrepositorydirectory /
Use it
- Verify that you can connect to the web server or FTP server or that you have the NFS share mounted.
- Type this command to refresh the list of available repositories:
- Use your package manager or apt-get commands normally.
sudo apt-get update
Remove it
If you no longer wish to use the local repository, you’ll need to remove it from your sources.list file:
- On your computer:
- Open the sources.list file in a text editor:
- Kubuntu users type this command:
kdesudo kate /etc/apt/sources.list
- Ubuntu users type this command:
gksudo gedit /etc/apt/sources.list
sudo apt-get update
You can delete the directory or move it to another location, but this is not required.
USB repository
Create it
- Insert the USB stick.
- Create a directory somewhere on the USB drive.
- Copy your .deb files into the directory you created.
- Open a terminal window in the directory you created.
- Type this command to create a file containing detailed information about your packages:
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
There should now be a file named Packages.gz in the directory you created.
Add it
In order for your repository to be used, the package manager needs to know it exists:
- Open the sources.list file in a text editor:
- Kubuntu users type this command:
kdesudo kate /etc/apt/sources.list
- Ubuntu users type this command:
- Find the line that starts with #deb cdrom or deb cdrom (this should be near the top of the file).
- Add this line directly below the cdrom line, replacing /myrepositorydirectory with the path to your USB repository directory:
- Save the file.
- Close the text editor.
gksudo gedit /etc/apt/sources.list
deb file:/myrepositorydirectory /
Use it
- Insert the USB stick.
- Type this command to refresh the list of available repositories:
- Use your package manager or apt-get commands normally.
sudo apt-get update
Remove it
If you no longer wish to use the USB repository, you’ll need to remove it from your sources.list file:
- Open the sources.list file in a text editor:
- Kubuntu users type this command:
kdesudo kate /etc/apt/sources.list
- Ubuntu users type this command:
- Delete the line you added in step 3 above.
- Save the file.
- Close the text editor.
- Type this command to refresh the list of available repositories:
gksudo gedit /etc/apt/sources.list
sudo apt-get update
You can delete the directory or move it to another location, but this is not required.
Create a local mirror of the Ubuntu repositories on DVD
Obligatory Happy Ending
And they all lived happily ever after. The end.

Comment: