How can I update Ubuntu offline without using Synaptic or Keryx?
Solution 1:
As far as I know, you can't download updates for a Oneiric (11.10) system using Ubuntu Natty (11.04). You must have a working Ubuntu 11.10 system.
An sketch about the process we are following:
- First we'll install a Virtual machine in OP's Natty (11.04) system.
- We'll install Ubuntu 11.10 in that virtual machine
- We'll setup virtual machine to have a common shared folder between the host OS (11.04) and the guest OS (11.10)
- We will generate a download script of packages which are required to upgrade that system (guest OS i.e Ubuntu 11.10).
- We'll transfer the download script to the host OS using shared folder set up in step 3.
- In host OS, we'll download all the required packages with the help of download script we get in step 5.
- We'll transfer all the downloaded .deb files in the Offline system, that is actual Ubuntu 11.10 system in his friend's PC.
- We'll create a local repository in his friend's PC with those packages.
- We'll upgrade OP's friends Ubuntu with the help of local repository created in step 8.
1. Getting a working Oneiric system
There are two ways to have a working Oneiric system.
-
By Doing an actual installation
You have to install Ubuntu Oneiric (11.10) on the computer with Internet connection. Though it is also possible from a live system running from USB or CD, I recommend installing. You can get help for installing Ubuntu from these links:
How do I install Ubuntu?
Help with Ubuntu installation.
-
Installing Oneiric in a VirtualBox Virtual Machine
-
To install VirtualBox in Ubuntu 11.04 Natty Narwhal, run these commands in a terminal:
sudo apt-get update sudo apt-get install virtualbox
-
Then install Oneiric in the virtual machine.
- How to install Ubuntu on VirtualBox?
-
Set up a shared folder in the virtual machine.
You need to install VirtualBox Guest Additions to enable shared folder feature. Run this command in the virtual machine to install that:
sudo apt-get install virtualbox-guest-additions
If you need help enabling the shared folders feature in the VirtualBox, check this link:
- Chapter 4: Shared Folders
-
2. Grab the .deb files required for updates
Please Note these specific points:
It is recommended not to update the virtual system during installation or afterwards before installing Synaptic. Cause, those updates might be deleted from cache and without those updates, you can't successfully generate package download script.
Don't run
sudo apt-get clean
orsudo apt-get autoclean
, because those commands removes .deb files from cache.
Then boot to the Oneiric system that has an Internet connection (either from the installed system or in VirtualBox) and follow this procedure:
-
Install Synaptic Package Manager. Run these commands in a terminal for this: (Note, You must connect the virtual machine to the Internet, without Internet access the machine cannot update the package list)
sudo apt-get update sudo apt-get install synaptic
You may also want to download the packages required for the
ubuntu-restricted-extras
package. To do so, Run this command additionally with the previous two commandssudo apt-get install -d ubuntu-restricted-extras
This command will not install the packages, it only downloads them with all dependencies in
/var/cache/apt/archives
folder. Then open Synaptic Package Manager. Push the button Mark All Upgrades.
When asked if you want to Mark additional required chanages, press the Mark button.
Then going to File --> Generate package download script, save the script as a file. Let it be
update-downloader.sh
in a folder namedUpdates
. We assume theUpdates
folder is in your home directory, i.e., in/home/username
. Then close Synaptic.-
Now download the .deb files.
Go to the Updates folder, where you saved
update-downloader.sh
.-
While you are still in the Terminal and have
cd
'd to the Updates folder you created earlier, run this command:cp /var/cache/apt/archives/*.deb .
That copies the downloaded .deb files which are used for installing Synaptic Package Manager and the files downloaded for the
ubuntu-restricted-extras
package. -
Then run this command
sh ./update-downloader.sh
to download all the .deb files required to update in the current folder (i.e., in theUpdates
folder.Or
Alternatively, you can transfer the
Updates
folder with the few .deb files you just copied from/var/cache/apt/archives
with theupdate-downloader.sh
script in it to the host OS via VirtualBox's shared folder feature.Then in the host Ubuntu system, open a terminal and run the below command by going to the Updates folder you just copied from the guest OS using shared folder feature, where
update-downloader.sh
file resides:sh ./update-downloader.sh
If you downloaded the .deb files in the virtual machine, in this step, transfer the Updates folder with those files using Virtual Box's shared folder feature. (This step is only required if you downloaded the files in virtual machine)
After you get the Updates folder with all .deb files in your host PC (i.e., in your Natty system) copy that folder with all files on a USB flash drive. You may also want to burn a DVD with those packages, though I am not recommending that.
Transfer the
Updates
folder using your USB drive (or CD/DVD, if you burned them) to your friend's PC.
3. Use the .deb files to create a local repository
Copy the whole folder named Updates
to the Internet-less computer. Put that folder in a directory. Let say, you have put the Updates folder in the home directory. Create a new directory in your home folder with name offline
, and move the Updates
folder into the offline
folder. Now, the directory structure looks like this
+ home +- username +- offline +- Updates (contains the .deb files)
-
Now open a terminal and go to the
offline
folder. Once in theoffline
folder, run this command to generate the necessary package index file:apt-ftparchive packages . > Packages
It will create a file with name
Packages
. -
Now open
/etc/apt/sources.list
file with root power. In a terminal do thisgksu gedit /etc/apt/sources.list
-
Then press an Enter while your cursor is at the beginning of the file. This will create a new blank line at the top. Write this line as the first line in the file
deb file:/home/username/offline /
Then save the file with Ctrl+S and exit gedit, the text editor.
Remember to use the exact folder / path names for the offline folder, and replace
username
with login name of the user.Also, if you are sure, your friend cannot use other repository sources, you may want to disable all other repositories by placing a
#
mark before each line in the/etc/apt/sources.list
file. (This is not actually required, but recommended).Note that it is generally required to put a local repository at the top of the file, to give it a higher preference then other repository sources. (But in this particular case, you might be able to get away with not doing this, since your friend can't even connect to the Internet to access any of the other configured repositories.)
4. Do the update without accessing the Internet!
Run
sudo apt-get update
in the terminal to make the package manager recognize your local update directory.-
Then do this command to upgrade the offline system:
sudo apt-get upgrade --allow-unauthenticated
Done! You have upgraded your system without Internet access.
Some Notes:
1. Don't want to write allow-unauthenticated option every time?
If you want to use this local repository to install packages time to time, but feel bored to always use that allow-unauthenticated
option, do this.
Create a file named 99mysettings
in /etc/apt/apt.conf.d
with gedit and add the line in that file and save.
APT::Get::AllowUnauthenticated "true";
To open a file named 99mysettins in that directory with root power use this command in a terminal
gksu gedit /etc/apt/apt.conf.d/99mysettings
2. Note about allow-unauthenticated option:
You might wonder why I have provided the --allow-unauthenticated
option. This is used because your local update repository is not authentic to the system. But it will not harm, because you downloaded those packages from an authentic official Ubuntu repository.
3. I want to have a trusted repository instead:
Check this awesome and epic post in Ubuntu forums about creating a trusted local repository. If you create a trusted repository, you don't have to provide --allow-unauthenticated
option anymore.
Recommendation: I would recommend you not to use PPA repositories, unless you really trust them. In particular, don't use experimental repositories, because they may introduce dependency problems in the system, which is often referred by Unix geek as dependency hell. This can be harder to fix when you do not have an Internet connection.
Solution 2:
You can use Keryx without installing it. I regularly use keryx 0.92.4.1 instead of version 1.
The reason I chose the older version was, if my memory serves me well, that v0.92x would let you install additional packages, while v1 would only let you update. I never managed to get it to install (automatically) any package for me, anyway, so the following might be applicable for version 1 as well.
This is how I use it:
- Extract keryx to your
home
directory in the computer without internet (let's call it computer w/o internet). -
Run:
python keryx/source/keryx.py
Create a new project. By default, the computer's name is the project's name. You can change that before clicking on "New project". In this example, I call it "chompituga".
It will ask you to "download the latest package lists". You have no internet, so click no.
After a short while you'll have a list of all packages, with those installed appropriately marked. You can close the program now.
-
Now copy the folder
keryx/projects/chompituga
to a usb. It contains the following:chompituga.keryx debian.conf installcache.sh lists/ packages/ sources/
Now in the computer with internet access (let's call it computer w/ internet): extract keryx to the
home
directory.Copy your project folder (in this example,
chompituga
) and all its contents from the USB to thekeryx/projects/
folder on the computer w/ internet.-
Run keryx:
python keryx/source/keryx.py
-
This time, open the project, called "chompituga" in this example (see figure).
It will ask to download the latest package lists, this time click yes. After a while, it will indicate that the package lists have been updated. You can see the list of packages in the main window and the ones that have a newer version will be differently marked.
Now it is possible to download updated packages with the menu Project|Get Updates, the button "Get Updates", or the combination Ctrl+U.
It is also possible to install new packages (it should take care of dependencies) by selecting the desired packages and then the menu Project|Download package.
Packages are downloaded to the
keryx/packages/chompituga/packages/
folder. You take the contents of that folder back with you to the computer w/o internet.-
Back at the computer w/o internet, copy the downloaded packages somewhere and, in that folder simply do:
sudo dpkg -i *.deb
Make sure to install kernel updates ("linux-header", "linux-image" or other "linux-something" packages) separately -- maybe after other updates.
-
Sometimes, it seems necessary to install with the option
--force-depends
. I do it, just in case, when I see very very many packages to update.sudo dpkg -i --force-depends *.deb
Once finished installing updates, run keryx again (step 2); open the project (step 10) and, from the menu Project|Update Status, update the list of installed packages. This will require your user password twice. Make sure to do this only in the computer w/o internet.
Now all you have to do is to repeat steps 6 to 18 every time you want to update your computer w/o internet.
I'm sorry this answer is long. I can assure you that the procedure is rather simple and straightforward.
Notes: It doesn't matter if the computers have different versions/flavours of Ubuntu. I haven't tested keryx with distros other than *buntu.
Solution 3:
There is another way to achieve this:
First upgrade:
First Boot up old Ubuntu version (11.04) in your computer which has Internet connection using either Live CD or USB.
Then open a terminal and run
sudo apt-get update
to update the list of packages available online. (Please note that, this command won't update the system, it only update package list).-
Then run the following command in a terminal to generate a list of url's of package files needed for upgrade.
sudo apt-get upgrade --print-uris -y | grep -o "http:.*deb'" | grep -o .*.deb > list
_If the repository is an ftp archive instead of an http archive, replace
http
withftp
_. The above command will create a list of url's of packages need to be downloaded. -
Then save the
list
file, so that you can use it later. Now boot your regular Ubuntu, connect to the internet and place thelist
file somewhere and run it withwget
to download all files. I suggest you to create a folder and place the file there, Then go to the specified folder in terminal and use the below command to download all.wget -c -i list
Copy the whole folder in your friend's computer, login to Ubuntu, open a terminal and going to the folder using
cd
usesudo dpkg -i *.deb
to install all updates.
Later upgrades:
If you need to upgrade your friend's Ubuntu again, copy the file status
from /var/lib/dpkg/
folder in your PC and then again boot Ubuntu 11.04 again. Then follow these process:
Open terminal and type
gksu nautilus
.Copy the
status
file which you have copied and paste it in/var/lib/dpkg
folder to replace the original one.Then follow step 2 to 5 from the First upgrade section