- 论坛徽章:
- 0
|
At first, synonyms: update vs. upgrade
Update - mainly refer to fix some bugs found in a program and complete some sime-finished function of a program.
Upgrade - mainly refer to raise a program into a higher level or make a big improvement.
Linux Questions and Answers by IBM From IBM DeveloperWorks
P37
Q. Can you summarize the differences between symbolic and hard links and differentiate between using links and simply duplicating a file?
Sure. If you merely copy a file from one directory to another, you have doubled the disk space used by the file, and editing one file doesn’t affect the other (because they are in no way connected to one another). This is fine if it is what you intended (so that you can keep a pristine original while modifying another copy, or if you made a backup copy for safekeeping.) If you copy a directory instead of a file, you also copy the entire directory’s contents, which can result in a lot of disk space used. A file or directory copy can be put anywhere on any disk, either directly attached to the system or on a network or Internet/Intranet drive somewhere else entirely. Because the original and the copy are unconnected, deleting one has no effect on the other.
On the other hand, if you create a symbolic link it takes only a few bytes of space and can be located on any mounted device that you can type in a path for. If you delete, rename or move the original, you break the link (although recreating the original in the same place will restore the link). Using the link to access the file or directory, any changes you make to the file or to the directory contents will affect the original files/directories, because those are what you are actually touching.
Alternatively, if you create a hard link instead, no additional disk space is used, however the link can only be created on the same physical hard disk (but multiple partitions on that disk), not on other local or remote devices). Moving or renaming the original file won’t hurt the link; it will reflect the change. When you “delete” the original file, you are actually deleting only the original hard link (the directory name). So, as long as at least one other hard link exists, the file is still accessible. Hard links can be created for files but not for directories. Because the permissions indicate that a hard link is a physical file, any software that tries to access these files will think it is accessing the original files (which, in fact, it is—through the link).
apt-howto.en.pdf From Debian Website
P13
3.3 Removing packages
If you no longer want to use a package, you can remove it from your system using APT. To do this just type: apt-get remove package. For example:
# apt-get remove gnome-panel
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
gnome-applets gnome-panel gnome-panel-data gnome-session
0 packages upgraded, 0 newly installed, 4 to remove and 1 not upgraded.
Need to get 0B of archives. After unpacking 14.6MB will be freed.
Do you want to continue? [Y/n]
As you can see in the above example, APT also takes care of removing packages which depend on the package you have asked to remove. There is no way to remove a package using APT without also removing those packages that depend on it.
Running apt-get as above will cause the packages to be removed but their configuration files, if any, will remain intact on the system. For a complete removal of the package, run:
# apt-get --purge remove gnome-panel
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
gnome-applets* gnome-panel* gnome-panel-data* gnome-session*
0 packages upgraded, 0 newly installed, 4 to remove and 1 not upgraded.
Need to get 0B of archives. After unpacking 14.6MB will be freed.
Do you want to continue? [Y/n]
Note the ’*’ after the names. This indicates that the configuration files for each of these packages will also be removed.
Just as in the case of the install method, you can use a symbol with remove to invert the meaning for a particular package. In the case of removing, if you add a ’+’ right after the package name, the package will be installed instead of being removed.
# apt-get --purge remove gnome-panel nautilus+
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
bonobo libmedusa0 libnautilus0 nautilus
The following packages will be REMOVED:
gnome-applets* gnome-panel* gnome-panel-data* gnome-session*
The following NEW packages will be installed:
bonobo libmedusa0 libnautilus0 nautilus
0 packages upgraded, 4 newly installed, 4 to remove and 1 not upgraded.
Need to get 8329kB of archives. After unpacking 2594kB will be used.
Do you want to continue? [Y/n]
Note that apt-get lists the extra packages which will be installed (that is, the packages whose installation is needed for the proper functioning of the package whose installation has been requested), those which will be removed, and those which will be installed (including the extra packages again).
P17
3.6 Removing unused package files: apt-get clean and autoclean
When you install a package APT retrieves the needed files from the hosts listed in /etc/apt/sources.list, stores them in a local repository (/var/cache/apt/archives/), and then proceeds with installation, see ‘Installing packages’ on page 7.
In time the local repository can grow and occupy a lot of disk space. Fortunately, APT provides tools for managing its local repository: apt-get’s clean and autoclean methods.
apt-get clean removes everything except lock files from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. Thus, if you need to reinstall a package APT should retrieve it again.
apt-get autoclean removes only package files that can no longer be downloaded.
The following example show how apt-get autoclean works:
# ls /var/cache/apt/archives/logrotate* /var/cache/apt/archives/gpm*
logrotate_3.5.9-7_i386.deb
logrotate_3.5.9-8_i386.deb
gpm_1.19.6-11_i386.deb
In /var/cache/apt/archives there are two files for the package logrotate and one for the package gpm.
P18
3.7 Using APT with dselect
dselect is a program that helps users select Debian packages for installation. It’s considered somewhat complicated and rather boring, but with practice you can get the hang of its consolebased ncurses interface.
One feature of dselect is that it knows how to make use of the capacity Debian packages have for “recommending” and “suggesting” other packages for installation. To use the program, run ‘dselect’ as root. Choose ’apt’ as your access method. This isn’t truly necessary, but if you’re not using a CD ROM and you want to download packages from the Internet, it’s the best way to use dselect.
To gain a better understanding of dselect’s usage, read the dselect documentation found on the Debian page
http://www.debian.org/doc/ddp
.
After making your selections with dselect, use:
# apt-get -u dselect-upgrade
as in the example below:
# apt-get -u dselect-upgrade
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
lbxproxy
The following NEW packages will be installed:
bonobo console-tools-libs cpp-3.0 enscript expat fingerd gcc-3.0
gcc-3.0-base icepref klogd libdigest-md5-perl libfnlib0 libft-perl
libgc5-dev libgcc300 libhtml-clean-perl libltdl0-dev libsasl-modules
libstdc++3.0 metamail nethack proftpd-doc psfontmgr python-newt talk tidy
util-linux-locales vacation xbill xplanet-images
The following packages will be upgraded
debian-policy
1 packages upgraded, 30 newly installed, 1 to remove and 0 not upgraded.
Need to get 7140kB of archives. After unpacking 16.3MB will be used.
Do you want to continue? [Y/n]
Compare with what we see when running apt-get dist-upgrade on the same system:
# apt-get -u dist-upgrade
Reading Package Lists... Done
Building Dependency Tree... Done
Calculating Upgrade... Done
The following packages will be upgraded
debian-policy
1 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 421kB of archives. After unpacking 25.6kB will be freed.
Do you want to continue? [Y/n]
Note that many of the packages from above are being installed because other packages “suggested” or “recommended” them. Others are being installed or removed (in the case of lbxproxy, for example) per the choices we made while navigating through dselect’s package listing. Dselect can be a powerful tool when used in conjunction with APT.
P27
5.1 Discovering package names
For example, suppose that you want to reminisce about the good old days of the Atari 2600. You want to use APT to install an Atari emulator, and then download some games. You can do:
# apt-cache search atari
atari-fdisk-cross - Partition editor for Atari (running on non-Atari)
circuslinux - The clowns are trying to pop balloons to score points!
madbomber - A Kaboom! clone
tcs - Character set translator.
atari800 - Atari emulator for svgalib/X/curses
stella - Atari 2600 Emulator for X windows
xmess-x - X binaries for Multi-Emulator Super System
We find several packages related to what we’re looking for, together with brief descriptions.
To get more information about a specific package, I can then use:
# apt-cache show stella
Package: stella
Priority: extra
Section: non-free/otherosfs
Installed-Size: 830
Maintainer: Tom Lear
Architecture: i386
Version: 1.1-2
Depends: libc6 (>= 2.1), libstdc++2.10, xlib6g (>= 3.3.5-1)
Filename: dists/potato/non-free/binary-i386/otherosfs/stella_1.1-2.deb
Size: 483430
MD5sum: 11b3e86a41a60fa1c4b334dd96c1d4b5
Description: Atari 2600 Emulator for X windows
Stella is a portable emulator of the old Atari 2600 video-game console
written in C++. You can play most Atari 2600 games with it. The latest
news, code and binaries for Stella can be found at:
http://www4.ncsu.edu/~bwmott/2600
In this output you have many details about the package that you want (or don’t want) to install, together with the full description of the package.
P34
6.2 Packages needed for compiling a source package
Normally, specific headers and shared libraries need to be present in order for a source package to be compiled. All source packages have a field in their control files called ’Build-Depends:’ that indicates which additional packages are needed for the package to be built from source.
APT has a simple way of downloading these packages. Just run apt-get build-dep package, where ‘package’ is the name of the package you’re going to build. For example:
# apt-get build-dep gmc
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
comerr-dev e2fslibs-dev gdk-imlib-dev imlib-progs libgnome-dev libgnorba-dev
libgpmg1-dev
0 packages upgraded, 7 newly installed, 0 to remove and 1 not upgraded.
Need to get 1069kB of archives. After unpacking 3514kB will be used.
Do you want to continue? [Y/n]
The packages that will be installed are the packages needed in order for gmc to be built correctly. It’s important to note that this command doesn’t look for the source package of the program to be compiled. You will therefore need to run apt-get source separately to get it.
If all you want is checking what packages are needed to build a given package, there’s a variant of the apt-cache show command (see ‘Getting information about packages.’ on page 23, which will show, among other information, the Build-Depends line that lists those packages.
# apt-cache showsrc package
P35
7.1 Common errors
Errors will always happen, many of them caused by users not paying attention. The following is a list of some of the most frequently reported errors and how to deal with them.
If you receive a message that looks like the one below when trying to run apt-get install package. . .
Reading Package Lists... Done
Building Dependency Tree... Done
W: Couldn’t stat source package list ’http://people.debian.org unstable/ Packages’ W: You may want to run apt-get update to correct these missing files
E: Couldn’t find package penguineyes
you forgot to run apt-get update after your last change to the /etc/apt/sources.list file.
If the error looked like:
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?
when trying any apt-get method other than source, you don’t have root permission, that is, you’re running as a normal user.
There’s an error similar to the above which happens when you run two copies of apt-get at the same time, or even if you try to run apt-get while a dpkg process is active. The only method that can be used simultaneously with others is the source method.
If an installation breaks in the middle of the process and you find that it’s no longer possible to install or remove packages, try running these two commands:
# apt-get -f install
# dpkg --configure –a
And then try again. It may be necessary to run the second of the above commands more than
once. This is an important lesson for those adventurers who use ‘unstable’.
If you receive the error “E: Dynamic MMap ran out of room” when running apt-get update, add the following line to /etc/apt/apt.conf:
APT::Cache-Limit 10000000;
Chapter 8
What distributions support APT?
Here are the names of some of the distributions that use APT:
Debian GNU/Linux (http://www.debian.org) - it was for this distribution that APT was developed
Conectiva (http://www.conectiva.com.br) - this was the first distribution to port APT for use with rpm
Libranet (http://www.libranet.com)
Mandrake (http://www.mandrake.com)
PLD (http://www.pld.org.pl)
Vine (http://www.vinelinux.org)
APT4RPM (http://apt4rpm.sf.net)
Alt Linux (http://www.altlinux.ru/)
Red Hat (http://www.redhat.com/)
Sun Solaris (http://www.sun.com/)
SuSE (http://www.suse.de/)
Yellow Dog Linux (http://www.yellowdoglinux.com/)
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/5756/showart_108567.html |
|