Little Girl's Mostly Linux Blog

CreateRepository

Create Personal Repositories

This page was last updated on September 07, 2009.

These are very basic instructions on how to create personal repositories for your .deb files.

Table of Contents


CD or DVD repository


Create it

  1. Create a temporary directory somewhere in your home directory.
  2. Copy your .deb files into that temporary directory.
  3. Open a terminal window in the temporary directory.
  4. Type this command to create a file containing detailed information about your packages:
  5. dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz

    There should now be a file named Packages.gz in the temporary directory.

  6. Use your favorite software to burn the contents of the temporary directory you created onto a CD or DVD.
  7. Make sure the CD or DVD is in the drive.
  8. Type this command in a terminal window to add the descriptions, dependencies, version numbers, etc. to the package manager:
  9. sudo apt-cdrom add
  10. Delete the temporary directory.

Add it

In order for your repository to be used, the package manager needs to know it exists:

  1. Insert the CD or DVD.
  2. Open a terminal window.
  3. 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
  4. 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
  5. Save the file.
  6. Close the text editor.

Use it

  1. Type this command to refresh the list of available repositories:
  2. sudo apt-get update
  3. Use your package manager or apt-get commands normally.

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.

  1. 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
  2. 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
  3. Save the file.
  4. Close the text editor.
  5. Type this command to refresh the list of available repositories:
  6. sudo apt-get update


Local repository


Create it

  1. Create a directory somewhere in your home directory.
  2. Copy your .deb files into the directory you created.
  3. Open a terminal window in the directory you created.
  4. Type this command to create a file containing detailed information about your packages:
  5. 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:

  1. 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
  2. Find the line that starts with #deb cdrom or deb cdrom (this should be near the top of the file).
  3. Add this line directly below the cdrom line, replacing /myrepositorydirectory with the path to your repository directory:
  4. deb file:/myrepositorydirectory /
  5. Save the file.
  6. Close the text editor.

Use it

  1. Type this command to refresh the list of available repositories:
  2. sudo apt-get update
  3. Use your package manager or apt-get commands normally.

Remove it

If you no longer wish to use the local repository, you’ll need to remove it from your sources.list file:

  1. 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
  2. Delete the line you added in step 3 above.
  3. Save the file.
  4. Close the text editor.
  5. Type this command to refresh the list of available repositories:
  6. 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:

    1. Copy your .deb files into the directory you’d like to share.
    2. Open a terminal window in the directory that has the .deb files in it.
    3. Type this command to create a file containing detailed information about the packages:
    4. 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:

    1. 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
    2. Find the line that starts with #deb cdrom or deb cdrom (this should be near the top of the file).
    3. Add one of these lines directly below the cdrom line:

      • 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 http://mywebservername/myrepositorydirectory /
      • For an FTP server, replace myftpserver with the name or IP of the FTP server, and replace /myrepositorydirectory with the path to the repository directory:
      • deb ftp://myftpserver/myrepositorydirectory /
      • For an NFS share, replace /myrepositorydirectory with the path you use to access the repository directory from your computer:
      • deb file:/myrepositorydirectory /
    4. Save the file.
    5. Close the text editor.

Use it

  1. Verify that you can connect to the web server or FTP server or that you have the NFS share mounted.
  2. Type this command to refresh the list of available repositories:
  3. sudo apt-get update
  4. Use your package manager or apt-get commands normally.

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:
    1. 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
    2. Delete the line you added in step 3 above.
    3. Save the file.
    4. Close the text editor.
    5. Type this command to refresh the list of available repositories:
    6. sudo apt-get update
  • On the remote computer:
  • You can delete the directory or move it to another location, but this is not required.


USB repository


Create it

  1. Insert the USB stick.
  2. Create a directory somewhere on the USB drive.
  3. Copy your .deb files into the directory you created.
  4. Open a terminal window in the directory you created.
  5. Type this command to create a file containing detailed information about your packages:
  6. 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:

  1. 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
  2. Find the line that starts with #deb cdrom or deb cdrom (this should be near the top of the file).
  3. Add this line directly below the cdrom line, replacing /myrepositorydirectory with the path to your USB repository directory:
  4. deb file:/myrepositorydirectory /
  5. Save the file.
  6. Close the text editor.

Use it

  1. Insert the USB stick.
  2. Type this command to refresh the list of available repositories:
  3. sudo apt-get update
  4. Use your package manager or apt-get commands normally.

Remove it

If you no longer wish to use the USB repository, you’ll need to remove it from your sources.list file:

  1. 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
  2. Delete the line you added in step 3 above.
  3. Save the file.
  4. Close the text editor.
  5. Type this command to refresh the list of available repositories:
  6. 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.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Comment:

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: