ºìÁªLinuxÃÅ»§
Linux°ïÖú
µ±Ç°Î»ÖÃ: ºìÁªLinuxÃÅ»§ > Debian

Debian APTÇáËÉÉÏÊÖ

·¢²¼Ê±¼ä:2007-07-18 00:40:15À´Ô´:ºìÁª×÷Õß:Deaboot
¶àÄêÀ´£¬ÎÒÒ»Ö±ÔÚʹÓÃDebian GNU/Linux£¬Ê¹ÓÃËüµÄÔ­ÒòÖ÷ÒªÊÇÒòΪËüÓкܶࡢºÜ°ôµÄÈí¼þ£¬²¢ÇÒÕâÑùÈí¼þÒ×ÓÚ°²×°¡£

ÎÒ°²×°DebianÈí¼þÒ»°ã¶¼Ê¹ÓÃAPT£¬ÕâÊÇÒ»¸ö¹¦ÄÜÇ¿´óµÄÈí¼þ¹ÜÀí¹¤¾ß¡£Ê¹ÓÃËü¿ÉÒÔ´Ó¹âÅÌ¡¢FTP·þÎñÆ÷¡¢HTTP·þÎñÆ÷»òÕß±¾µØ»úÉÏ°²×°DebianÈí¼þ¡£¸üÈÃÎÒ¸ßÐ˵ÄÊÇ£¬Debian°ÑËùÓеÄÈí¼þ°ü¶¼·ÅÔÚÁË¿É×ÔÓÉ·ÃÎʵÄFTPºÍHTTP·þÎñÆ÷Ö®ÉÏ(http://www.debian.org/mirror/list)¡£ÕâÑù£¬Ö»ÐèÈÃAPTÖ¸ÏòÆäÖеÄÒ»¸ö·þÎñÆ÷£¬¾Í¿ÉÒÔ½øÐÐÈí¼þµÄ°²×°¡£

ͨ¹ý±¾ÎÄÄã¿ÉÒÔ¶ÔAPT¼°Æä»ù±¾µÄÃüÁîÓÐÒ»¸öÁ˽⣬²¢ÇÒ¿ÉÒÔʹÓÃËüÀ´°²×°ËùÐèÒªµÄÈí¼þ¡£´ËÍ⣬ÎÒ»¹ÏëÈöÁÕßÃÇÁ˽⵽ʹÓÃAPT½øÐÐÈí¼þµÄ°²×°ºÍ¹ÜÀíÊÇÒ»¼þ¶àôÇáËɵÄÊÂÇé¡£

¸ÅÊö
ÔÚAPTÖУ¬Ò»¸ö×îÖ÷ÒªµÄ¸ÅÄîÊÇ¡°Èí¼þ°ü(Package)¡±£¬DebianÌṩµÄÿһ¸öÓ¦ÓóÌÐò¶¼ÓÐÒ»¸öÓëÖ®¶ÔÓ¦µÄÈí¼þ°ü¡£Ò»¸öÈí¼þ°üÎļþͨ³£ÒÔ.debΪÀ©Õ¹Ãû£¬²¢ÇÒ°üº¬ÒÔÏÂÄÚÈÝ£º

Èí¼þÓ¦ÓóÌÐò
¶ÔÓ¦ÓóÌÐòµÄÃèÊö
Ó¦ÓóÌÐòµÄÒÀÀµÐÔÁбí
Ó¦ÓóÌÐòµÄ°²×°½Å±¾
Ó¦ÓóÌÐòµÄÓû§Îĵµ

ÔÚAPTÖУ¬ËùÓеIJÙ×÷¶¼ÊÇÕë¶ÔÈí¼þ°üµÄ¡£µ±ÏëÒª°²×°Ò»¸öÓ¦ÓóÌÐòʱ£¬Òª¸æËßËùÒª°²×°Ó¦ÓóÌÐòµÄÈí¼þ°ü¡£µ±ÒªÐ¶ÔØÓ¦ÓóÌÐòʱ£¬Ò²Òª¸æËßËùҪжÔØÓ¦ÓóÌÐòµÄÈí¼þ°üÃû³Æ¡£¼´Ê¹ÏëÒª»ñȡһЩÓйØÓ¦ÓóÌÐòµÄÐÅÏ¢£¬Ò²ÒªÍ¨¹ýÓ¦ÓóÌÐòµÄÈí¼þ°üÃû³ÆÀ´Í¨¹ýAPT»ñÈ¡¡£

ÁíÍâÒ»¸öÖØÒªµÄ¸ÅÄîÊÇPackage cache¡£Package cacheÊÇÒ»¸öDebian·¢ÐаæÖпÉÓÃÈí¼þ°üµÄÍêÕûÁÐ±í£¬´æ´¢ÓÚ±¾µØ»úÉÏ¡£Òò´Ë£¬±ØÐë¾­³£¶ÔÆä½øÐиüУ¬ºóÃæÎÒ»á½éÉÜÈçºÎÉý¼¶Package cache¡£

°²×°³õʼ»¯
ÔÚʹÓÃAPT֮ǰ£¬Ê×ÏÈÒª¸æËßËüµ½ÄÄÀïȥѰÕÒÈí¼þ°üÎļþ£¬Ö¸¶¨µÄÿһ¸öλÖö¼¿É×öÒ»¸öÈí¼þÔ´¡£Èí¼þÔ´¿ÉÒÔÊǹâÅÌ¡¢HTTP·þÎñÆ÷¡¢FTP·þÎñÆ÷»òÕßÊDZ¾µØÓ²ÅÌ¡£

APT»á°ÑÔ´Áбí´æÈë/etc/apt/sources.listÖУ¬ÏÂÃæÊÇÎÒµÄsources.listÎļþ£º

deb http://security.debian.org/ stable/updates main
deb http://http.us.debian.org/debian stable main contrib non-free
deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-6 (20020718)]/
unstable contrib main non-US/contrib non-US/main
deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-7 (20020718)]/
unstable contrib main non-US/contrib non-US/main
deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-5 (20020718)]/
unstable contrib main non-US/contrib non-US/main
deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-4 (20020718)]/
unstable contrib main non-US/contrib non-US/main
deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-3 (20020718)]/
unstable contrib main non-US/contrib non-US/main
deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-2 (20020718)]/
unstable contrib main non-US/contrib non-US/main
deb cdrom:[Debian GNU/Linux 3.0 r0 _Woody_ - Official i386 Binary-1 (20020718)]/
unstable contrib main non-US/contrib non-US/main

ÔÚsources.listÖÐÌí¼ÓÒ»¸öHTTP¡¢FTPºÍ±¾µØÎĵµ·Ç³£¼òµ¥£¬¿ÉÒÔʹÓñ༭Æ÷Ö±½ÓÌí¼Ó¼´¿É(Õ¾µãÁбí¿É´Óhttp://www.debian.org/mirror/list´¦»ñÈ¡)¡£ÒªÌí¼Ó¹âÇýÔòʹÓÃÒÔÏÂÃüÁ

$apt-cdrom add

¸üб¾µØPackage cache
Package cacheÐèÒª×Ô¼º¸ºÔð¸üС£Ã¿Ò»´Î°²×°»òÕßÉý¼¶Èí¼þÇ°£¬¶¼Ó¦¸Ã¶ÔPackage cache½øÐиüУ¬ÕâÑù¿ÉÒÔ±£Ö¤ÓµÓÐËùÒª°²×°Èí¼þµÄ×îÐÂÐÅÏ¢¡£

ÔËÐÐÒÔÏÂÃüÁî¿ÉÒÔ¸üÐÂPackage cache£º

$apt-get update

²é¿´¿ÉÓõÄÈí¼þ°ü
apt-cache¹¦ÄÜÔÊÐíÔÚ±¾µØÈí¼þ°üÖвéÕÒ¿ÉÓõÄÈí¼þ°ü¡£±ÈÈ磬Èç¹ûÏëÔÚ»úÆ÷ÉÏ°²×°Apache·þÎñÆ÷£¬ÄÇô¿ÉÒÔʹÓÃÒÔÏÂÃüÁîÀ´²éÕÒApacheÈí¼þ°ü£º

$ apt-cache search apache

ÔÚÎÒ»úÆ÷ÉÏ£¬Õâ¸öÃüÁî·µ»ØÁË119¸öÈí¼þ°ü¡£µ±È»£¬²¢²»Óò鿴ÿһ¸öÈí¼þ°ü£¬¿ÉÒÔʹÓÃgrep½øÐйýÂË£º

$ apt-cache search apache | grep "^apache"

¸ÃÃüÁî²úÉúÈçϵÄÊä³ö½á¹û£º
apache-doc - Apache web server docs
apache-dev - Apache web server development kit
apache-ssl - Versatile, high-performance HTTP server with SSL support
apache-common - Support files for all Apache web servers
apache - Versatile, high-performance HTTP server
apache-perl - Versatile, high-performance HTTP server with added Perl support

²é¿´Èí¼þ°üµÄÐÅÏ¢
ÕÒµ½Èí¼þ°üºó£¬Èç¹ûÒª²é¿´¸ÃÈí¼þ°üµÄÓйØÐÅÏ¢£¬¿ÉÒÔʹÓÃÒÔϵÄÃüÁ

$ apt-cache show packagename

±ÈÈ磬ÏëÒª²é¿´ApacheÈí¼þ°üµÄÐÅÏ¢¿ÉÒÔʹÓÃÒÔϵÄÃüÁ

$ apt-cache show apache

ÕâÑù½«·µ»ØÒÔϵÄÐÅÏ¢£º
Package: apache
Priority: optional
Section: web
Installed-Size: 748
Maintainer: Matthew Wilcox <willy@debian.org>
Architecture: i386
Version: 1.3.26-0woody1
Replaces: apache-modules
Provides: httpd
.......
Task: web-server

°²×°Èí¼þ°ü
Èí¼þ°ü°²×°Ê¹ÓõÄÊÇapt-get¹¤¾ß£¬ÏÂÃæÊǾßÌå¸ñʽ£º

$ apt-get install Èí¼þ°üÃû³Æ

ʹÓÃÏÂÃæµÄÃüÁ¿ÉÒÔ°²×°Apache Web·þÎñÆ÷£º

$ apt-get install apache

ɾ³ýÈí¼þ
ʹÓÃÏÂÃæµÄÃüÁî¿ÉÒÔºÜÈÝÒ×µØɾ³ýϵͳÀïµÄÈí¼þ£º

$ apt-get remove Èí¼þ°üÃû³Æ

±ÈÈ磬Èç¹ûÏëҪɾ³ýϵͳÀïµÄApache·þÎñÆ÷£¬Ö»ÐèʹÓÃÏÂÊöµÄÃüÁ

$ apt-get remove apache

±£³Öϵͳ¸üÐÂ
¾­³£Ê¹ÓÃ×îÐÂÎȶ¨°æµÄÈí¼þÊDZ£Ö¤ÏµÍ³°²È«µÄÖØÒª¾Ù´ë¡£Ê¹ÓÃAPT£¬Ö»Ðè¼òµ¥²Ù×÷Á½²½¾Í¿ÉÒÔÍê³ÉÕâÏ×÷£º

$ apt-get update
$ apt-get upgrade

ÉÏÃæµÚÒ»¸öÃüÁîÊǸüб¾µØµÄPackage cache£¬µÚ¶þ¸öÃüÁîÊǸüлúÆ÷ÉÏ°²×°µÄËùÓÐÈí¼þ°ü(Èç¹ûÓÐа汾µÄ»°)¡£

µ½´ËΪֹ£¬ÃèÊöÁËAPTµÄ»ù±¾Ó÷¨¡£ÏÖÔÚÒѾ­¿ÉÒÔʹÓÃDebianÀ´Íê³ÉÈí¼þµÄ°²×°ºÍɾ³ý¹¤×÷¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. . ÓÚ 2007-07-22 11:47:43·¢±í:

    debianÊǺܺÃÓõÄ.