ºìÁªLinuxÃÅ»§
Linux°ïÖú

Arch LinuxµÄÈí¼þ°ü¹ÜÀíÆ÷pacman

·¢²¼Ê±¼ä:2007-09-03 16:46:46À´Ô´:ºìÁª×÷Õß:augset
pacman ÊÇÒ»¸ö×·×Ù×ÅϵͳÉÏËùÓÐÒÑ°²×°Èí¼þµÄ°ü¹ÜÀíÆ÷¡£ËüÓÐ׿òµ¥µÄÒÀÀµÖ§³Ö£¬¶ÔËùÓеÄÈí¼þ°ü¶¼Ê¹Óñê×¼µÄ tar-gz ´æµµ¸ñʽ¡£Ò»Ð©ÆÕͨ×÷Òµ¸÷×ÔµÄÃüÁîÔÚÏÂÃæ»áÓÐÏàÓ¦µÄ½â˵¡£ÈçÐèµÃµ½ pacman ×îеÄÑ¡Ïî½âÊÍ£¬²éÔÄ man pacman¡£Õⲿ·Ö×ÝÀÀ½ö½öÊÇÈÃÄã³õ²½Á˽âÒ»ÏÂpacmanµ±Ç°µÄÄÜÁ¦¡£

µäÐÍ×÷Òµ£º

ʹÓðüÎļþ¼ÓÈëÒ»¸öеÄÈí¼þ°ü
ʹÓðüÎļþÉý¼¶Ò»¸öÈí¼þ°ü
жÔØÈí¼þ°ü
¸üÐÂÈí¼þ°üÁбí
Éý¼¶ÏµÍ³
´ÓÈí¼þ¿â¼ÓÈë/Éý¼¶Ò»¸öÈí¼þ°ü
ÁгöÒÑ°²×°µÄÈí¼þ°ü
²é¿´Ö¸¶¨Èí¼þ°üÊÇ·ñÒÑ°²×°
ÏÔʾָ¶¨Èí¼þ°üµÄÐÅÏ¢
ÏÔʾÈí¼þ°üËù°üº¬µÄÎļþÁбí
²éÕÒÖ¸¶¨ÎļþËùÊôµÄÈí¼þ°ü

ʹÓðüÎļþ¼ÓÈëÒ»¸öеÄÈí¼þ°ü

# pacman --add foo.pkg.tar.gz
# pacman -A foo.pkg.tar.gz

Õ⽫»áÔÚϵͳÉÏ°²×° foo.pkg.tar.gz Èí¼þ°ü¡£Èç¹û²»ÄÜÂú×ãÒÀÀµ¹Øϵ£¬pacman »áÍ˳ö²¢ÏÔʾ´íÎóºÍ±¨¸æËùȱÉÙµÄÒÀÀµ¹Øϵ£¬µ«²»»á³¢ÊÔ×Ô¶¯½â¾öÒÀÀµ¹Øϵ£¬Èç¹ûÄãÐèÒªÕ⹦ÄÜ£¬¿´¿´ --sync Ñ¡Ïî¡£

ʹÓðüÎļþÉý¼¶Ò»¸öÈí¼þ°ü

# pacman --upgrade foo.pkg.tar.gz
# pacman -U foo.pkg.tar.gz

±¾ÖÊÉÏÕâºÍ --add ÊÇÒ»ÑùµÄ£¬µ«Ëü»á»¹ÓÐÉý¼¶ÒÑ°²×°µÄÈí¼þ°ü¶ø²»ÐèÒª¶îÍâµÄ¿ªÏú¡£ÎÒ¸öÈ˺ÜÄÑÏëÏñÄã»áÄþÔ¸Óà --add ¶ø²»ÊÇ --upgrade¡£

жÔØÈí¼þ°ü

# pacman --remove foo
# pacman -R foo

Õâ»áжÔØÊôÓÚ foo µÄËùÓÐÎļþ£¬Òѱ༭¹ýµÄÅäÖÃÎļþ³ýÍâ¡£Ö»ÐèÌṩ°üÃû¾Í¿ÉÒÔÁË£¬ÎÞÐèʹÓà tar.gz µÄºó׺¡£

Èç¹ûÐèÒªÍêȫжÔØÒ»¸öÈí¼þ°ü£¬ÔÚÉÏÃæµÄÃüÁîÀï¼ÓÈë --nosave Ñ¡Ïî¾Í¿ÉÒÔÁË¡£

¸üÐÂÈí¼þ°üÁбí

# pacman --sync --refresh
# pacman -Sy

Õ⽫»á´Ó /etc/pacman.conf ÄÚ¶¨ÒåµÄÈí¼þ¿âÖÐÈ¡µÃеÄÖ÷Èí¼þ°üÁбíÒÔ¼°½«Ëü½âѹÌí¼ÓÖÁÊý¾Ý¿âÓò¡£ÔÚʹÓà --sysupgrade ֮ǰÄãÓ¦¸ÃʹÓÃËüÀ´È·±£ÄãµÃµ½µÄ¶¼ÊÇ×îеÄÈí¼þ°ü¡£È¡¾öÓÚÄã pacman.conf µÄÉ趨£¬Õâ¸öÃüÁî¿ÉÄÜÐèÒªÒ»¸ö¿ÉÓõÄÒòÌØÍøÁ´½ÓÀ´½ÓÈë»ùÓÚ FTP µÄÈí¼þ¿â¡£ËüºÍ Debian µÄ apt-get update ÃüÁîºÜÏàËÆ¡£

Éý¼¶ÏµÍ³

# pacman --sync --sysupgrade
# pacman -Su

Õâ¸öÃüÁî»á½«±¾µØµÄÈí¼þ°ü°æ±¾Óëͨ¹ý --refresh ÏÂÔصÄÖ÷Èí¼þ°üÁбíÄڵİ汾¶Ô±È£¬È»ºóÉý¼¶ÏµÍ³ÄÚËùÓйýʱµÄÈí¼þ°ü¡£Å¼¶øÔËÐÐÕâ¸öÃüÁî¿ÉÒÔÈÃÄãµÄϵͳ±£³ÖÔÚ×îеÄ״̬¡£×¢Ò⣺Õâ¸öÃüÁî²¢²»»á¸üÐÂÖ÷Èí¼þ°üÁÐ±í£¬ËùÒÔͨ³£½ÏΪ´ÏÃ÷µÄ×ö·¨ÊÇ°ÑËüÃÇÁªºÏÔÚÒ»Æð£º

# pacman --sync --refresh --sysupgrade
# pacman -Syu

ͨ¹ýÕâЩѡÏpacman ½«×Ô¶¯È¡µÃµ±Ç°µÄÖ÷Èí¼þ°üÁбíºÍ½øÐÐÈ«ÃæµÄϵͳÉý¼¶£¬ËùÓеÄÒÀÀµ¹Øϵ½«»á±»×Ô¶¯½â¾ö¡£Ä㽫ÏëÒª¾­³£µÄÔËÐÐÕâ¸ö¡£

´ÓÈí¼þ¿â¼ÓÈë/Éý¼¶Ò»¸öÈí¼þ°ü

# pacman --sync foo
# pacman -S foo

È¡µÃÒÔ¼°°²×° foo ²¢Âú×ãËüËùÓеÄÒÀÀµ¹Øϵ¡£ÔÚʹÓà sync Ñ¡ÏîÇ°£¬È·ÈÏÄãÒѾ­¸üÐÂÁËÈí¼þ°üÁÐ±í£¬ÓÖ»òÊÇÔÚ°²×°Ç°¼ÓÈëÁË --refresh »ò -y µÄÑ¡Ïî¡£²»Í¬ÓÚ --add£¬--sync µÄ°²×°ºÍÉý¼¶²¢Ã»Óв»Í¬¡£È¡¾öÓÚÄã pacman.conf µÄÉ趨£¬Õâ¸ö¹¦ÄÜÐèÒª¿ÉÓõÄÒòÌØÍøÁ´½Ó¡£

ÁгöÒÑ°²×°µÄÈí¼þ°ü

# pacman --query
# pacman -Q

ÏÔʾϵͳÄÚËùÓÐÒÑ°²×°Èí¼þ°üµÄÁÐ±í¡£

²é¿´Ö¸¶¨Èí¼þ°üÊÇ·ñÒÑ°²×°

# pacman --query foo
# pacman -Q foo

Äã¿ÉÒÔÊäÈëÐèÒª²éÕÒµÄÃû³Æ¶ø²»ÊÇÍêÕûµÄÈí¼þÃû¡£Èç¹û foo ÒÑ°²×°£¬ÄÇÕâ¸öÃüÁ»áÏÔʾËüµÄÃû³ÆÒÔ¼°°æ±¾

ÏÔʾָ¶¨Èí¼þ°üµÄÐÅÏ¢

# pacman --query --info foo
# pacman -Qi foo

ÏÔʾÒÑ°²×°Èí¼þ°ü foo µÄÐÅÏ¢£¨´óС¡¢°²×°ÈÕÆÚ¡¢´´½¨ÈÕÆÚ¡¢ÒÀÀµ¹Øϵ¡¢³åÍ»µÈ£©¡£ÏÔʾһ¸öδ°²×°µÄÈí¼þ°üµÄÐÅÏ¢£¬¿ÉÒÔ¼ÓÈë --file »òÊÇ -p Ñ¡Ï·Ö±ðÊÇ£º

# pacman --query --info --file foo.pkg.tar.gz
# pacman -Qip foo.pkg.tar.gz

ÏÔʾÈí¼þ°üËù°üº¬µÄÎļþÁбí

# pacman --query --list foo
# pacman -Ql foo

ÁгöÊôÓÚ foo Èí¼þ°üµÄËùÓÐÎļþ¡£

²éÕÒÖ¸¶¨ÎļþËùÊôµÄÈí¼þ°ü

# pacman --query --owns /path/to/file
# pacman -Qo /path/to/file

ÏÔʾÎļþͨ¹ýÍêÕû·¾¶×÷Ϊ²ÎÊýËùÒýÓõÄÈí¼þ°üÃû³ÆºÍ°æ±¾

ʹÓÃÈí¼þ¿â

Èí¼þ¿âÊÇÈí¼þ°ü¼°ÆäÐÅÏ¢µÄºÏ¼¯£¬Ëü¿ÉÒÔλÓÚ±¾µØĿ¼»òÊÇÔ¶¶ËµÄ FTP/HTTP ·þÎñÆ÷¡£Arch ϵͳĬÈϵÄÈí¼þ¿âÊÇ current£¬Ëü±£³Ö×Ŵ󲿷ÖÈí¼þµÄ×îа汾¡£

Ðí¶àÓû§Ñ¡Ôñ¼¤»î extra Èí¼þ¿â£¨°üº¬×Ÿü¶àÈí¼þ£¬²»ÊôÓÚ Arch ºËÐÄÈí¼þ¼¯²¿·Ö£©¡£Äã¿ÉÒÔÔÚ /etc/pacman.conf ½«Ëü¼¤»î£¨ÔÚ uncommenting µÄ²¿·Ö£©£¬Ä¬ÈÏÊǼ¤»îµÄ¡£

ÄãÒ²¿ÉÒÔ´´½¨¡¢Î¬»¤ÒÔ¼°Ê¹ÓÃÄã×Ô¼ºµÄÈí¼þ¿â£¬¾ßÌå²éÔÄ pacman manpage¡£

Èç¹ûÄã´Ó¹âÅÌ°²×°ºóÓÖ²»¿ÉÒÔ·ÃÎÊÒòÌØÍø£¬¶îÍâµÄÈí¼þ°ü¿ÉÄܾÍÐèÒª´Ó¹âÅÌÉÏ°²×°ÁË¡£Äã¿ÉÒÔÔÚ¹âÅÌÉÏÕÒ³öËüÃÇÈ»ºóʹÓà pacman -A packagename.pkg.tar.gz ½øÐа²×°£¬Ò²¿ÉÒÔÔÝʱÉèÖÃÒ»¸ö·ÃÎʹâÅ̵ÄÈí¼þ¿â¡£Ê¹Óà mount /mnt/cd ÃüÁ¹âÅ̹ÒÔØÖÁ /mnt/cd£¨¼ÙÉèÄãµÄ fstab ÒѾ­ÕýÈ·µÄÉèÖã©£¬È»ºóÔÚÄãµÄ /etc/pacman.conf ÄÚ¼ÓÈëÏÂÁУº

[cd]
Server = file:///mnt/cd/arch/pkg

È»ºóÄ㽫¿ÉÒÔ°²×°¶îÍâµÄÈí¼þ°üÀ´°ïÖúÄãÉèÖÃÒòÌØÍøÁ´½Ó¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ