Using Proxy
Verified on Ubuntu Server 12.04, 2013-6-8.
-
Start a goagent server at 10.21.3.31;
-
Login in as root, modify any cn.archive... to us.archive... in /etc/apt/sources.list;
-
Use proxy temporarily:
export http_proxy=http://10.21.3.31:8087
; Use it permament: add the following line to your /etc/apt/apt.conf(substitute your details for address and port):Acquire::http::Proxy "http://10.21.3.31:8087"
;
Now you can use apt-get
or wget
to install something.
Download & Install
RPM-based
Download from a internet-connected host
Get rpm files from cache /var/cache/yum, or use 3rd-party tool yumdownloader:
# yum install yum-utils
# yumdownloader --resolve subversion
Note you can add "--urls" to only list download urls instead of downloading RPMs, it can be used as "dry-run" mode; If yumdownloader can't resolve dependencies properly, see yumdownloader downloads only i686 resolved rpms for solutions.
Instll on a isolated host
# rpm -ivh <package-name>.rpm
Debian-based
aptitude
Notice that 32bit and 64bit of some packages are uncompatible.
So you want to download 64bit packages on a 32bit machine,
you have to vagrant up
a 64bit VM,
download deb files and save them in shared folder.
Download
Download package and all its dependencies with aptitude:
`sudo aptitude --download-only install <package-name>`
This will download deb files to /var/cache/apt/archives.
Copy the package and all its dependencies to a folder then run sudo dpkg -i *.deb
.
If you are not sure about which is the related packages,
use sudo aptitude clean
to remove all existing .deb files before download.
Verified by sudo aptitude --download-only install subversion
on vagrant box precise64.
sudo apt-get download <package-name>
will download deb files to current directory,
since it does not resolve dependencies. So it's not very useful.
Install
`sudo dpkg -i *.deb`
Ref:
-
http://stackoverflow.com/questions/13756800/how-to-download-all-dependencies-and-packages-to-directory
-
http://stackoverflow.com/questions/4419268/how-do-i-download-a-package-from-apt-get-without-installing-it
apt-offline
Installation
`sudo aptitude install apt-offline`
Usage
-
Specify what to install on the offline-machine:
sudo apt-offline set --update --upgrade --install-packages subversion openjdk-6-jre ant -- apt-offline.sig
; -
Downlaod data on a internet-connected machine:
apt-offline get --bundle mypack.zip -t 5 apt-offline.sig
, where mypack is the downloaded archive and "-t 5" means "download with 5 threads"; -
Copy mypack.zip to the offline-machine and extract it:
sudo apt-offline install mypack.zip
; -
Install it with
sudo dpkg -i <packages>.deb
.