Hanya download …

Ada kalanya kita pengin hanya mendownload “packages” di Debian tanpa perlu menginstallnya. Ada beberapa cara menurut pengalaman saya pribadi dari berbagai sumber di internet tentunya 🙂
Cara yang menurut saya paling mudah 🙂

$ aptitude download links
Get:1 http://ftp.hk.debian.org/debian/ stable/main links amd64 2.3~pre1-1 [548 kB]
Fetched 548 kB in 41s (13.2 kB/s)

dan sayangnya, dengan menggunakan apt-get walaupun menggunakan opsi –download-only, belum bisa dengan user biasa (saya baca-baca mulai apt versi 0.8.11 ke atas, download apt-get bisa dengan user biasa ) 🙂

$ apt-get -d install links
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

dan harus menjalankannya dengan su/sudo

$ sudo apt-get -d install links
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
links
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 548 kB of archives.
After this operation, 1,413 kB of additional disk space will be used.
Get:1 http://ftp.hk.debian.org/debian/ stable/main links amd64 2.3~pre1-1 [548 kB]
Fetched 548 kB in 41s (13.1 kB/s)
Download complete and in download only mode

Berbeda dengan aptitude yang mendownload hasilnya di “current working directory”, apt-get akan menyimpannya di directory cache apt, /var/cache/apt/archives.
Tapi apt menyediakan opsi dengan dir::cache::archives=/ke/path/tempat/menyimpan, yang akan menyimpan hasil download di direktori yang kita inginkan

$ sudo apt-get -o dir::cache::archives="~/Downloads/elinks" -d -y install elinks
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
elinks-doc
The following NEW packages will be installed:
elinks
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 606 kB of archives.
After this operation, 1,483 kB of additional disk space will be used.
Get:1 http://ftp.hk.debian.org/debian/ stable/main elinks amd64 0.12~pre5-2 [606 kB]
Fetched 606 kB in 40s (15.1 kB/s)
Download complete and in download only mode

Tapi sayang sekali kenapa masih juga belum bisa menggunakan user biasa, alias menggunakan sudo/su untuk mendapatkan root akses.
Selain itu bisa juga dengan memanfaatkan opsi –print-uris dari apt-get dan menggunakannya bersama wget untuk mendownloadnya.
Misalnya,

$ apt-get install -y --print-uris elinks
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
elinks-data libfsplib0 liblua50 liblualib50 libmozjs2d libruby1.8 libtre5
Suggested packages:
elinks-doc tre-agrep
The following NEW packages will be installed:
elinks elinks-data libfsplib0 liblua50 liblualib50 libmozjs2d libruby1.8 libtre5
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,883 kB of archives.
After this operation, 12.8 MB of additional disk space will be used.
'http://security.debian.org/pool/updates/main/i/iceweasel/libmozjs2d_1.9.1.16-11_amd64.deb' libmozjs2d_1.9.1.16-11_amd64.deb 435234 MD5Sum:9738ee541b51d6b839a767655bf48f0e
'http://ftp.hk.debian.org/debian/pool/main/f/fsplib/libfsplib0_0.11-1_amd64.deb' libfsplib0_0.11-1_amd64.deb 14288 MD5Sum:52aebdbabf2cccb0424731fc06f6bb3b
'http://ftp.hk.debian.org/debian/pool/main/l/lua50/liblua50_5.0.3-4_amd64.deb' liblua50_5.0.3-4_amd64.deb 53758 MD5Sum:713d1f4554116fcef171a97bab93eb53
'http://ftp.hk.debian.org/debian/pool/main/l/lua50/liblualib50_5.0.3-4_amd64.deb' liblualib50_5.0.3-4_amd64.deb 37996 MD5Sum:ecd7175e9846c81240b87d4b0f50fd56
'http://ftp.hk.debian.org/debian/pool/main/r/ruby1.8/libruby1.8_1.8.7.302-2squeeze1_amd64.deb' libruby1.8_1.8.7.302-2squeeze1_amd64.deb 2061274 MD5Sum:372c167815f0033762ca3e7a9d841bb9
'http://ftp.hk.debian.org/debian/pool/main/t/tre/libtre5_0.8.0-2_amd64.deb' libtre5_0.8.0-2_amd64.deb 61536 MD5Sum:bdd00b586f3974fb2e59d3ba9c81ff9f
'http://ftp.hk.debian.org/debian/pool/main/e/elinks/elinks-data_0.12~pre5-2_all.deb' elinks-data_0.12~pre5-2_all.deb 613308 MD5Sum:e2e10259edf5ac6ddd0352c9cae1ca60
'http://ftp.hk.debian.org/debian/pool/main/e/elinks/elinks_0.12~pre5-2_amd64.deb' elinks_0.12~pre5-2_amd64.deb 606014 MD5Sum:0201539810334f13167c765f18761ce5

Output perintah tersebut mengandung URI lengkap dari file yang akan didownload, beserta MD5 sum-nya, dan dengan menggunakan cut, bisa didapatkan sebuah path uri ke file yang akan didownload

$apt-get install -y --reinstall --print-uris -qq elinks | cut -d"'" -f2
http://security.debian.org/pool/updates/main/i/iceweasel/libmozjs2d_1.9.1.16-11_amd64.deb
http://ftp.hk.debian.org/debian/pool/main/f/fsplib/libfsplib0_0.11-1_amd64.deb
http://ftp.hk.debian.org/debian/pool/main/l/lua50/liblua50_5.0.3-4_amd64.deb
http://ftp.hk.debian.org/debian/pool/main/l/lua50/liblualib50_5.0.3-4_amd64.deb
http://ftp.hk.debian.org/debian/pool/main/r/ruby1.8/libruby1.8_1.8.7.302-2squeeze1_amd64.deb
http://ftp.hk.debian.org/debian/pool/main/t/tre/libtre5_0.8.0-2_amd64.deb
http://ftp.hk.debian.org/debian/pool/main/e/elinks/elinks-data_0.12~pre5-2_all.deb
http://ftp.hk.debian.org/debian/pool/main/e/elinks/elinks_0.12~pre5-2_amd64.deb

dan dengan menggabungkannya dengan wget kita bisa mendownload paket yang dimaksud tanpa user root

~$ wget $(apt-get install -y --reinstall --print-uris -qq elinks | cut -d"'" -f2)
--2011-12-05 09:22:28-- http://security.debian.org/pool/updates/main/i/iceweasel/libmozjs2d_1.9.1.16-11_amd64.deb
Resolving security.debian.org... 128.101.240.212, 149.20.20.6, 195.20.242.89, ...
Connecting to security.debian.org|128.101.240.212|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 435234 (425K) [application/x-debian-package]
Saving to: “libmozjs2d_1.9.1.16-11_amd64.deb”
100%[============================================================================>] 435,234 14.8K/s in 29s

2011-12-05 09:22:59 (14.9 KB/s) - “libmozjs2d_1.9.1.16-11_amd64.deb” saved [435234/435234]

--2011-12-05 09:22:59-- http://ftp.hk.debian.org/debian/pool/main/f/fsplib/libfsplib0_0.11-1_amd64.deb
Resolving ftp.hk.debian.org... 202.134.73.139
Connecting to ftp.hk.debian.org|202.134.73.139|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14288 (14K) [application/x-debian-package]
Saving to: “libfsplib0_0.11-1_amd64.deb”

100%[======================================================================================>] 14,288 24.5K/s in 0.6s

2011-12-05 09:23:05 (24.5 KB/s) - “libfsplib0_0.11-1_amd64.deb” saved [14288/14288]

--2011-12-05 09:23:05-- http://ftp.hk.debian.org/debian/pool/main/l/lua50/liblua50_5.0.3-4_amd64.deb
Reusing existing connection to ftp.hk.debian.org:80.
HTTP request sent, awaiting response... 200 OK
Length: 53758 (52K) [application/x-debian-package]
Saving to: “liblua50_5.0.3-4_amd64.deb”

100%[======================================================================================>] 53,758 15.7K/s in 3.3s

2011-12-05 09:23:09 (15.7 KB/s) - “liblua50_5.0.3-4_amd64.deb” saved [53758/53758]

--2011-12-05 09:23:09-- http://ftp.hk.debian.org/debian/pool/main/l/lua50/liblualib50_5.0.3-4_amd64.deb
Reusing existing connection to ftp.hk.debian.org:80.
HTTP request sent, awaiting response... 200 OK
Length: 37996 (37K) [application/x-debian-package]
Saving to: “liblualib50_5.0.3-4_amd64.deb”

100%[=======================================================================================>] 37,996 15.8K/s in 2.3s

2011-12-05 09:23:12 (15.8 KB/s) - “liblualib50_5.0.3-4_amd64.deb” saved [37996/37996]

--2011-12-05 09:23:12-- http://ftp.hk.debian.org/debian/pool/main/r/ruby1.8/libruby1.8_1.8.7.302-2squeeze1_amd64.deb
Reusing existing connection to ftp.hk.debian.org:80.
HTTP request sent, awaiting response... 200 OK
Length: 2061274 (2.0M) [application/x-debian-package]
Saving to: “libruby1.8_1.8.7.302-2squeeze1_amd64.deb”

100%[=============================================================================================>] 2,061,274 8.12K/s in 2m 25s

2011-12-05 09:25:37 (13.9 KB/s) - “libruby1.8_1.8.7.302-2squeeze1_amd64.deb” saved [2061274/2061274]

--2011-12-05 09:25:37-- http://ftp.hk.debian.org/debian/pool/main/t/tre/libtre5_0.8.0-2_amd64.deb
Reusing existing connection to ftp.hk.debian.org:80.
HTTP request sent, awaiting response... No data received.
Retrying.

--2011-12-05 09:25:39-- (try: 2) http://ftp.hk.debian.org/debian/pool/main/t/tre/libtre5_0.8.0-2_amd64.deb
Connecting to ftp.hk.debian.org|202.134.73.139|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 61536 (60K) [application/x-debian-package]
Saving to: “libtre5_0.8.0-2_amd64.deb”

100%[==================================================================================================>] 61,536 7.78K/s in 7.4s

2011-12-05 09:25:49 (8.11 KB/s) - “libtre5_0.8.0-2_amd64.deb” saved [61536/61536]

--2011-12-05 09:25:49-- http://ftp.hk.debian.org/debian/pool/main/e/elinks/elinks-data_0.12~pre5-2_all.deb
Reusing existing connection to ftp.hk.debian.org:80.
HTTP request sent, awaiting response... 200 OK
Length: 613308 (599K) [application/x-debian-package]
Saving to: “elinks-data_0.12~pre5-2_all.deb”

100%[===========================================================================================>] 613,308 14.4K/s in 50s

2011-12-05 09:26:40 (12.0 KB/s) - “elinks-data_0.12~pre5-2_all.deb” saved [613308/613308]

--2011-12-05 09:26:40-- http://ftp.hk.debian.org/debian/pool/main/e/elinks/elinks_0.12~pre5-2_amd64.deb
Reusing existing connection to ftp.hk.debian.org:80.
HTTP request sent, awaiting response... No data received.
Retrying.

--2011-12-05 09:26:41-- (try: 2) http://ftp.hk.debian.org/debian/pool/main/e/elinks/elinks_0.12~pre5-2_amd64.deb
Connecting to ftp.hk.debian.org|202.134.73.139|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 606014 (592K) [application/x-debian-package]
Saving to: “elinks_0.12~pre5-2_amd64.deb”

100%[===============================================================================================>] 606,014 14.8K/s in 41s

2011-12-05 09:27:24 (14.6 KB/s) - “elinks_0.12~pre5-2_amd64.deb” saved [606014/606014]

FINISHED --2011-12-05 09:27:24--
Downloaded: 8 files, 3.7M in 4m 38s (13.7 KB/s)


Semoga bermanfaat 🙂

Referensi
1. http://linux.die.net/man/8/apt-get
2. http://askubuntu.com/questions/30482/is-there-an-apt-command-to-download-a-deb-file-from-the-repositories-to-the-curr

Advertisements

Leave a Reply

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

%d bloggers like this: