Offline Synaptic Installation/Repository Updates

Offline Synaptic Installation/Repository Updates

Goal: To allow users with fresh installations of Ubuntu that don’t have internet access with that machine to install software from the Ubuntu repositories. I’ve never seen a tutorial or tip like this, so I hope it will meet some hitherto unmet needs.

Skill level: Basic. I’ve tried to make this pretty simple. I recommend you copy/paste all code given in this tutorial rather than type it out, to make sure no typos occur.
If you have any questions at all leave a comment at the bottom of the page. I’ll try and keep this updated and provide support.

About: This tutorial is especially aimed at users with a fresh installation of Ubuntu 11.10 on their computer but with no internet connection available to that computer. If you can get your computer online, by all means skip this tutorial and install your software the easy way.

Many people still don’t have internet access at home, and many of those people own desktop computers, which aren’t very portable to local wifi hotspots or internet cafés. That’s where these instructions will be handy.

This tutorial assumes you have access to a second computer running Ubuntu with an internet connection. We’ll refer to this as your “online” PC, and your first machine as the “offline” one.
Since the easiest and most common tool for offline software installation, Synaptic Package Manager, doesn’t come bundled with Ubuntu any more (as of 11.10) this tutorial will guide you through installing Synaptic first.

IMPORTANT: Before you do anything else, you first need to know whether your offline Ubuntu installation uses 32 or 64 bit architecture. To find this out, open a terminal by typing

Control+Alt+t

When the terminal is open, copy/paste the following code at the prompt:

Code:

uname –m

This will give an output of either x86_64 (64 bit) or i686 – i386 (32 bit). The packages are different for 64 and 32 bit, but the whole basic procedure will remain the same. Just remember throughout this tutorial which your system uses.

Now to install Synaptic!

1. On the online computer: Make a new folder in your home folder called “synaptic” (no quotes, obviously).

2.If your offline system is 32 bit, open a text editor and paste the code below into it-

This is a complete download script for Synaptic, with all dependencies. Save this file as synapt.sh in the folder “synaptic” that you just created.

3. Open a terminal (Control+Alt+t again) and copy/paste the following code at the prompt.

Code:

chmod +x synaptic/synapt.sh

Then run

Code:

./synapt.sh

All the required packages for Synaptic will be downloaded into the “synaptic” folder. They’ll all have a .deb file extension.

4. Use a flash drive to copy the folder to the offline computer’s home. Open a terminal and type

Code:

sudo dpkg –iR synaptic

Enter your password at the prompt. This will install Synaptic on your offline computer. The first step is done!

STEP 2: Update Repositories

Almost all the software available for Ubuntu is stored on Canonical servers. These software groups are called repositories. In the software installation process Synaptic simply sends a message to these servers telling them which packages to download, and then installs it for you. You did the process manually yourself when you installed Synaptic in the previous step.

Before downloading anything from a repository, Synaptic needs to know exactly what is in the repository in the first place. Each repository contains a compressed text file with a long list of all software packages available in that repository. Synaptic looks at that info and relays that to you in the program. Since our offline Synaptic can’t query a server, we need to download those lists of packages, copy them onto the offline computer, and tell Synaptic to look on the computer itself for the info. Follow this part very closely.

NOTE: This step is for users of Ubuntu 11.10 Oneiric Ocelot. I’ll try and keep this page updated for later versions. The same procedures will still apply no matter what version of Ubuntu you have; the only difference will be the name of the version.

This is where the repositories for all Ubuntu versions from Hardy Heron to Oneiric Ocelot are kept. If you’re running Oneiric (as this tutorial assumes you are) select “oneiric”.
This will take you to another page, where you’ll select “main/”.
On the next page, select “binary-i386/” if your computer is 32 bit, or “binary-amd64/”.
On the next page, select “Packages.gz”.
This will download a compressed text file with the list of all available software in the Main Ubuntu repository. Save the compressed file (don’t uncompress it!) to its own folder on your flash drive. Since you’ll be downloading 4 of these compressed files (all having the same name) saving them in individual folders will help keep them sorted out.
Go back to

This command makes a number of new folders in your home folder. It’s important that you don’t delete or edit these folders in any way in the future.

3. Copy each Packages.gz file to its corresponding folder in home- i.e., the file you got from Main goes in dists/oneiric/main/binary-i386, the file from Multiverse goes in dists/oneiric/multiverse/binary-i386, etc. Again, don’t uncompress any of these files!

4. Once these are all copied over, open a terminal and type

Code:

synaptic

To open Synaptic Package Manager. In Synaptic, click Settings>Repositories.
This will bring up the repository dialog box. Select the “Other Software” tab.

Select “Add…”.
What you’ll be doing is telling Synaptic where it can look to find software information other than the online repositories.
In the Add Repository dialog, type the following

Code:

deb file:/home/your_user_name oneiric main

Obviously, change your_user_name to your user name. Note that after your user name there’s a space, the name of the Ubuntu version (oneiric), space, and then the repository name (main, multiverse, universe, restricted).

Click Add Source and you’re done. Repeat this process, substituting the name of each repository for “main”. When you’re done you’ll have added four new repositories. It should look like this.

Synaptic will automatically add four other “Source Code” repositories. In my experience with offline package managing these don’t serve any purpose and generate confusing error messages, so go ahead and remove each one that has “Source Code” appended to the end of the name.
When you’re done with that, close out of the Repositories dialog and click the large “Reload” button in the upper left.

The reloading process WILL give you an error message, simply because it wasn’t able to contact the Ubuntu servers. Scroll down to the bottom of the error log. If you don’t see any errors about your recently added repositories, the update was successful!

You’re all set to install software now! For info on how to get started with that, see my other tutorial on how to install software offline using Synaptic.

NOTE: There is one hitch with this type of offline installation and updating. Any download script you produce with this will have instructions to download from your /home/ repository, rather than the real ones. Here's a sample:

If you're not in the US and can figure out your nearest repository, great! Otherwise, the US one will work, albeit more slowly, and if you want me to find your nearest repository, post the request on this thread. Good luck!