个人工具

“UbuntuHelp:AptGet/Offline/PrintUris”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第7行: 第7行:
 
* --print-uris :  instead of fetching the files to install, their URIs (links to download them) are printed. Each URI will have the path, the destination file name, the size and the expected md5 hash. Note that the file name to write to will not always match the file name on the remote site! This also works with the source and update commands. When used with the update command the MD5 and size are not included, and it is up to the user to decompress any compressed files. Configuration Item: APT::Get::Print-URIs.  
 
* --print-uris :  instead of fetching the files to install, their URIs (links to download them) are printed. Each URI will have the path, the destination file name, the size and the expected md5 hash. Note that the file name to write to will not always match the file name on the remote site! This also works with the source and update commands. When used with the update command the MD5 and size are not included, and it is up to the user to decompress any compressed files. Configuration Item: APT::Get::Print-URIs.  
 
* --yes or -y :  automatically '''yes''' to prompts; assume "yes" as answer to all prompts and run non-interactively.
 
* --yes or -y :  automatically '''yes''' to prompts; assume "yes" as answer to all prompts and run non-interactively.
* -qq : quiet. It implies -y .  
+
* -qq : quiet. It implies -y #  
 
===== Links to a package =====
 
===== Links to a package =====
 
To get the URIs (links) of all the files needed to install a package (i.e. ExamplePackage), use:  
 
To get the URIs (links) of all the files needed to install a package (i.e. ExamplePackage), use:  
第15行: 第15行:
 
You can also give more than one package name.
 
You can also give more than one package name.
 
myurilist.htm can be stored in a USB flash drive, to be used in a computer with Internet connection to click in the URIS (links) and download the packages.
 
myurilist.htm can be stored in a USB flash drive, to be used in a computer with Internet connection to click in the URIS (links) and download the packages.
You can use [[UbuntuHelp:grep|grep]] and cut to extract the URIs from the output
+
You can use [[grep]] and cut to extract the URIs from the output
 
<pre><nowiki>
 
<pre><nowiki>
 
apt-get --print-uris --yes install ExamplePackage | grep ^\' | cut -d\' -f2 > packageuri.htm
 
apt-get --print-uris --yes install ExamplePackage | grep ^\' | cut -d\' -f2 > packageuri.htm
第34行: 第34行:
 
</nowiki></pre>
 
</nowiki></pre>
 
===== Dowloading  =====
 
===== Dowloading  =====
You can click in the links in the htm file or download the files using [http://en.wikipedia.org/wiki/Wget Wget].
+
You can click in the links in the htm file or download the files using [[http://en.wikipedia.org/wiki/Wget|Wget]].
 
<pre><nowiki>
 
<pre><nowiki>
 
wget --input-file myurilist.htm  
 
wget --input-file myurilist.htm  
第41行: 第41行:
 
You can install the dowloaded packages manually (clicking in the files in Nautilus, that employs Gdebi) or automatically in a terminal:  
 
You can install the dowloaded packages manually (clicking in the files in Nautilus, that employs Gdebi) or automatically in a terminal:  
 
<pre><nowiki>
 
<pre><nowiki>
apt-get -o dir::cache::archives="/disc" dist-upgrade
+
apt-get -o dir::cache::archives="/disc" dist-upgrade
 
</nowiki></pre>
 
</nowiki></pre>
 
/disc is the place where you have the downloaded packages (i.e. the removable media, as a USB keydrive).
 
/disc is the place where you have the downloaded packages (i.e. the removable media, as a USB keydrive).
 
=== See also ===
 
=== See also ===
*[[UbuntuHelp:Synaptic/Offline|Synaptic/Offline]]
+
*[[Synaptic/Offline]]
 
----
 
----
 
[[category:CategoryOffline]] [[category:CategoryPackageManagement]]
 
[[category:CategoryOffline]] [[category:CategoryPackageManagement]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2010年5月19日 (三) 16:46的版本

--print-uris

apt-get --print-uris --yes
  • --print-uris : instead of fetching the files to install, their URIs (links to download them) are printed. Each URI will have the path, the destination file name, the size and the expected md5 hash. Note that the file name to write to will not always match the file name on the remote site! This also works with the source and update commands. When used with the update command the MD5 and size are not included, and it is up to the user to decompress any compressed files. Configuration Item: APT::Get::Print-URIs.
  • --yes or -y : automatically yes to prompts; assume "yes" as answer to all prompts and run non-interactively.
  • -qq : quiet. It implies -y #
Links to a package

To get the URIs (links) of all the files needed to install a package (i.e. ExamplePackage), use:

apt-get --print-uris --yes install ExamplePackage > packageuri.htm

You can also give more than one package name. myurilist.htm can be stored in a USB flash drive, to be used in a computer with Internet connection to click in the URIS (links) and download the packages. You can use grep and cut to extract the URIs from the output

apt-get --print-uris --yes install ExamplePackage | grep ^\' | cut -d\' -f2 > packageuri.htm
Links to update the package index
apt-get --print-uris update > myupdateurilist.htm

When you have downloaded the new index, store it in /var/lib/apt/lists (after save a backup copy of it in /var/lib/apt/lists.old ).

Links to fix broken packages
apt-get --fix-broken > mybrokenpackagesurilist.htm
Links to update distribution

Recommended

apt-get dist-upgrade > mydisturilist.htm
Dowloading

You can click in the links in the htm file or download the files using [[1]].

wget --input-file myurilist.htm 
Installation in the local machine

You can install the dowloaded packages manually (clicking in the files in Nautilus, that employs Gdebi) or automatically in a terminal:

apt-get -o dir::cache::archives="/disc" dist-upgrade

/disc is the place where you have the downloaded packages (i.e. the removable media, as a USB keydrive).

See also