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

ʹÓÃyum¸üкìÆìLinux

·¢²¼Ê±¼ä:2007-10-01 21:36:08À´Ô´:ºìÁª×÷Õß:XLooking
×î½üÕÒµ½¼¸¸öеÄÈí¼þ°ü£¬¾õµÃͦºÃÓã¬Ò²¸Õ±àÒë³Érpm°ü£¬Ï£ÍûÔÚËùÓÐʹÓõ½µÄ»úÆ÷Éϲ¿Ê𡣺óÀ´·¢ÏÖ£¬ÐèҪÿһ̨»úÆ÷È¥°²×°Ò»±é£¬¼´Ê¹¿ÉÒÔÔ¶³Ì°²×°£¬ÕâÒ²ÊÇͦÂé·³µÄ¡£¾ö¶¨²Î¿¼RedhatµÄÉý¼¶»úÖÆ£¬°ÑyumҲǨÒƵ½ºìÆìÉÏÀ´¡£Ëµ×ö¾Í×ö£¬Ð§¹û»¹ÊDz»´íµÄ¡£

Ò»¡¢Ô­Àí
yumÊÇÒ»¸öÓÃÓÚ¹ÜÀírpm°üµÄºǫ́³ÌÐò£¬ÓÃpythonд³É£¬¿ÉÒԷdz£·½±ãµÄ½â¾örpmµÄÒÀÀµ¹Øϵ¡£ÔÚ½¨Á¢ºÃyum·þÎñÆ÷ºó£¬yum¿Í»§¶Ë¿ÉÒÔͨ¹ýhttp¡¢ftp·½Ê½»ñµÃÈí¼þ°ü£¬²¢Ê¹Ó÷½±ãµÄÃüÁîÖ±½Ó¹ÜÀí¡¢¸üÐÂËùÓеÄrpm°ü£¬ÉõÖÁ°üÀ¨kernelµÄ¸üС£ËüÒ²¿ÉÒÔÀí½âΪºìÆì»·¾³ÏµÄapt¹ÜÀí¹¤¾ß¡£

ÒªÔÚºìÆìÉϲ¿Êðyum·þÎñ£¬Ê×ÏÈÐèÒªµÄ¾ÍÊǹ滮Èí¼þ°üµÄĿ¼´ÎÐò£º

ÒýÓÃ
1¡¢ÎÒ×¼±¸Òª¶ÔºìÆì·þÎñÆ÷DCºÍ×ÀÃæDTÌṩ·þÎñ£»
2¡¢Éæ¼°µÄƽ̨£¬·þÎñÆ÷¶Ôi386¡¢x86_64ƽ̨£¬×ÀÃæÖ»ÓÐi386ƽ̨£»
3¡¢Ìṩϵͳ±¾ÉíµÄÉý¼¶³ÌÐò°ü£¬¹Ù·½ÌṩµÄÉý¼¶°ü£¬×Ô¼º±àÒëµÄÈí¼þ°ü£¬ÒÔ¼°´ÓÆäËû;¾¶»ñµÃ¡¢¾­¹ý²âÊÔµÄÈí¼þ°üËĴ󲿷ÖÌṩ¸üÐÂÉý¼¶¡£

Ŀ¼¼Ü¹¹ÈçÏ£º

¶þ¡¢²¿Êðyum·þÎñÆ÷
ϵͳƽ̨£º
·þÎñ¶Ë£ººìÆìDC Server 5.0 for x86
¿Í»§¶Ë£ººìÆìDC Server 5.0 for x86ºÍDT 5.0 for x86

1¡¢×¼±¸
ÐèҪΪyumÌṩpython»·¾³£¬¿ÉÒÔ´Óϵͳ¹âÅÌ»ñµÃ£º

ÒýÓÃ
libxml2-2.6.16-6.i386.rpm
libxml2-python-2.6.16-6.i386.rpm
elfutils-0.97-5.i386.rpm
rpm-python-4.3.3-9_nonptl.1AX.i386.rpm
python-urlgrabber-2.9.6-2.noarch.rpm

ʹÓÃrpm -ivh°ÑÉÏÊöµÄ°ü¶¼°²×°µ½ÏµÍ³ÖС£
аæµÄyumʹÓÃxml¸ñʽµÄÊý¾ÝÎļþÀ´·ÖÎöºÍ»ñµÃrpmÐÅÏ¢£¬¿ÉÒÔʹÓÃcreaterepo¹¤¾ßʵÏÖ

°²×°£º
rpm -ivh createrepo-0.4.4-1.noarch.rpm

2¡¢¿½±´
osĿ¼ÊÇÓÃÓÚ´æ·ÅϵͳԭÀ´´øµÄËùÓÐÈí¼þ°üµÄ£¬ÔòÎÒÃÇÕâÑù×ö£º

mount -t iso9660 -o loop /iso/redflag-dc5.0-release-disc1.iso /mnt/cdrom
cp /mnt/cdrom/* ./os/i386/
umount /mnt/cdrom
mount -t iso9660 -o loop /iso/redflag-dc5.0-release-disc2.iso /mnt/cdrom
cp /mnt/cdrom/* ./os/i386/

3¡¢Éú³ÉyumÓõÄrepodataĿ¼
ÔËÐУº
createrepo /yum/dc/5.0/os/i386

ÔËÐк󣬻á×Ô¶¯ÔÚi386Ŀ¼ÏÂÉú³ÉrepodataĿ¼£¬ÀïÃæ´æ·ÅÓжÔÓ¦RPMµÄÒÀÀµÐÅÏ¢¹©ºóÐøyumʹÓá£

ÕâÀïÖ»ÊÇÑÝʾÁËosĿ¼£¬Í¬ÑùµÄ£¬ÆäËûĿ¼Ҳ´æ·ÅÉ϶ÔÓ¦µÄÎļþ£¬²¢ÓÃÉÏÊöÃüÁîÉú³ÉrepodataĿ¼¡£½ñºóÈôÓиüУ¬ÐèÖØÐÂÔËÐÐcreaterepoÃüÁÒÔ¸üÐÂÊý¾Ý¿â

4¡¢×¼±¸ftp·þÎñ
yumÊÇͨ¹ýhttp»òftp»ñµÃrpm°üµÄ£¬ËùÒÔÎÒÃÇÐèÒªÉèÖÃhttp»òftp·þÎñ£¬²¢°ÑÉÏÊöµÄyumĿ¼µÄ¸ùĿ¼×÷ΪftpµÄ¸ùĿ¼¼´¿É¡£ÀàËÆÌṩÕâÑùµÄ¹Øϵ£º

ÒýÓÃ
ftp://ip/dc/5.0/os/i386

Èý¡¢²¿Êðyum¿Í»§¶Ë
ÎÒʹÓõÄÊÇÒ»¸öÓÃ×îС»¯°²×°µÄºìÆìDC Server×÷Ϊ¿Í»§¶Ë¡£ÒªÊ¹ÓÃyum·þÎñ£¬±ØÐëÏȽâ¾öyumµÄÒÀÀµ¹Øϵ¡£

1¡¢×¼±¸
ÏÂÃæÊÇÐèҪʹÓõÄÈí¼þ°ü£¬Çë´Óϵͳ¹âÅÌ¡¢rpmfind»òcentos»ñµÃ£ºµØÖ·

rpm -ivh libxml2-2.6.16-6.i386.rpm
rpm -ivh libxml2-python-2.6.16-6.i386.rpm
rpm -ivh python-elementtree-1.2.6-4.i386.rpm
rpm -ivh sqlite-3.2.2-1.i386.rpm
rpm -ivh python-sqlite-1.1.6-1.i386.rpm
rpm -ivh python-urlgrabber-2.9.6-2.noarch.rpm
rpm -ivh elfutils-0.97-5.i386.rpm
rpm -ivh rpm-4.3.3-9_nonptl.i386.rpm
rpm -ivh rpm-python-4.3.3-9_nonptl.1AX.i386.rpm

2¡¢°²×°
ÎÒʹÓõÄÊÇ×Ô¼º±àÒëµÄ2.6.1-1°æ±¾£¬¿ÉÒÔ´ÓÏÂÃæµÄµØÖ·»ñµÃ¡£ÄãÒ²¿ÉÒÔʹÓÃcentosÌṩµÄ2.4.2-2°æ±¾¡£
ÏÂÔصØÖ·£º
rpm -ivh yum-2.6.1-1.noarch.rpm

3¡¢ÅäÖÃ
yum¿Í»§¶ËµÄÅäÖ÷dz£¼òµ¥£¬Ö»ÓÐÒ»¸öÅäÖÃÎļþ£º/etc/yum.conf£¬ÈçÏ£º

ÒýÓÃ
[main]
cachedir=/var/cache/yum
keepcache=1
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redflag-release
tolerant=1
exactarch=1
obsoletes=1

# ÕâÀï±íʾ£¬Äã¿ÉÒÔ°ÑÅäÖÃÎļþ·ÅÔÚ/etc/yum.repos.dĿ¼ÖУ¬ÓÃ.repoÎļþÃû# ½áβ¼´¿É¡£
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
[base]
name=Red Flag Linux $releasever - $basearch - Base
# ÏÂÃæÊÇ»ñµÃrpmµÄhttp»òftpµØÖ·£¨yumerÊÇÓû§ÃûºÍÃÜÂ룩
baseurl=ftp://yumer:yumer@192.168.228.153/dc/$releasever/os/$basearch/

[updates]
name=Red Flag Linux $releasever - Updates
baseurl=ftp://yumer:yumer@192.168.228.153/dc/$releasever/updates/$basearch/

[extras]
name=Red Flag Linux $releasever - Extras
baseurl=ftp://yumer:yumer@192.168.228.153/dc/$releasever/extras/$basearch/

[addons]
name=Red Flag Linux $releasever - Addons
baseurl=ftp://yumer:yumer@192.168.228.153/dc/$releasever/addons/$basearch/

¡ù×¢ÊÍ£ºÅäÖÃÎļþÖпÉÒÔʹÓü¸¸ö±äÁ¿£¬ÆäËûµÄÇë²Î¿¼man yum.conf¡£
$releasever£½distroverpkg¶¨ÒåµÄ¶ÔÓ¦/etc/redflag-releaseµÄ°æ±¾£»
$arch=pythonÖÐos.unameµÄ¶¨Ò壻
$basearch=°Ñ$arch½µ¼¶µ½×î»ù´¡µÄ¼Ü¹¹£¬ÀýÈçi686»á±íʾΪi386
4¡¢Ê¹ÓÃ
ÉÏÃæÒѾ­°ÑyumÅäÖÃÍ꣬ʹÓ÷½·¨ÊÇ£º

# yum <¸üÐÂÏîÄ¿> <Ì×¼þÃû³Æ>

²ÎÊý˵Ã÷£º
options£ºÕâÀï½öÁгö³£¼ûµÄ²ÎÊý¶øÒÑ¡£
-y Èç¹û yum ÔÚ¹¤×÷¹ý³ÌÖÐÐèҪʹÓÃÕßÏìÓ¦£¬Õâ¸ö²ÎÊý¿ÉÒÔÖ±½Ó»Ø´ð yes
¸üÐÂÏîÄ¿£º¸üеĶ¯×÷Óе×ϼ¸¸ö£º
install £º°²×°Ä³¸öÌ×¼þ£¬ºóÃæÐèÒª½ÓÌ×¼þÃû³Æ£»
update £ºÕâ¾ÍÊÇÉý¼¶À²£¡Èç¹û update ºóÃæ½ÓÌ×¼þÃû³Æ£¬±íʾֻҪ yum Éý¼¶¸ÃÌ×¼þ¶øÒÑ
Èç¹û update ºóÃæ²»½ÓÌ×¼þÃû³Æ£¬±íʾ yum Õë¶ÔÄ¿Ç°¸ÃÖ÷»úËùÓÐÒѾ­°²×°µÄÌ×¼þ½øÐÐÉý¼¶µÄ¶¯×÷£¡ÕâÊÇ×ʹÓõÄÏîÄ¿ÁË¡£
list £ºÁгöÄ¿Ç°ÔÚ yum server ÉÏÃæÓÐµÄ RPM Ì×¼þ£»
info £ºÄ³¸öÌ×¼þµÄÄÚÈÝ£¬ÀàËÆ rpm -qi packages µÄÄÚÈÝ¡£
clean £º½«Òѽ«ÏÂÔص½±¾»úµÄ packages »ò headers ÒƳý¡£
remove £ºÒƳýÒѾ­°²×°ÔÚÎÒÃÇϵͳµÄij¸öÌ×¼þ£¡

ÀýÈ磺


°²×°ËùÓкÍmysqlÓйصÄÌ×¼þ
yum install *mysql*
¼ì²éÊÇ·ñÓиüеÄÌ×¼þ
yum check-update
¼ì²éËùÓÐÌṩphpµÄÌ×¼þ£¬²¢ÏÔʾ¼ò½éÐÅÏ¢
yum search php
ÏÔʾÒѾ­°²×°µÄÌ×¼þ
yum list installed
ÒƳýwgetÌ×¼þ
yum remove wget




ËÄ¡¢ÆäËû
1¡¢Ïà¹ØÎļþ

ÒýÓÃ
/etc/cron.daily/yum.cron
ÿÈÕ½øÐÐyum¼°ÆäËûÈí¼þ°ü¶¨Ê±Éý¼¶
/etc/init.d/yum
yum·þÎñÆô¶¯Îļþ

2¡¢¸üÐÂÌ×¼þ
·þÎñ¶Ë£º°ÑеÄÌ×¼þ·ÅÈë¶ÔÓ¦µÄĿ¼£¬È»ºóÔËÐÐcreaterepo¸üÐÂXMLÊý¾Ý¿â¼´¿É£»
¿Í»§¶Ë£ºyum»á¶¨Ê±µÄÇé¿öcacheÎļþ£¬µ«ÓÐʱºòÎÒÃÇÂíÉϾÍÒª¸üÐÂÐèÒªµÄÌ×¼þ£¬¿ÉÒÔÕâÑù×ö£º

yum clean all
yum update mirrordir

3¡¢ÀûÓÃÆäËûÌ×¼þ¸üÐÂ
ÎÒÃÇÔÚÈÕ³£µÄ¹ÜÀíÖУ¬Ò²¿ÉÒÔÀûÓÃÆäËûµÄ·¢ÐаæÌṩµÄ¾µÏñÀ´½øÐжîÍâµÄ¸üС£ÀýÈ磬ÎÒ³£ÓÃcentos¾µÏñÀ´¸üв¿·ÖÎҵŤ¾ß°ü£º
ÔÚ/etc/yum.confÎļþÖÐÔö¼Ó£º

ÒýÓÃ
[centos-update]
name=CentOS-$releasever - Update
baseurl=http://mirror.be10.com/centos/4.3/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.be10.com/centos/RPM-GPG-KEY-centos4

ÆäÖв»Ò»ÑùµÄµØ·½¾ÍÊÇ£¬centos×öÁËÇ©Ãû£¬ËùÒÔ£¬ÐèÒª¼ÓÉÏgpgcheckºÍgpgkey£¬½ÓÏÂÀ´ÎҾͿÉÒÔ½øÐиüУº

yum clean all
yum install mysql

¿ÉÒÔ¿´µ½£¬mysql»áʹÓÃcentosÌṩµÄ4.1.20-1°æ±¾£¬¶ø²»»áʹÓÃϵͳ×Ô´øµÄ4.1.10a-2¡£

µ«Ç§ÍòҪעÒâÇø·Ö¿ÉʹÓõÄÌ×¼þ£¬²¢²»ÊÇËùÓÐcentosµÄÌ×¼þ¶¼ÊʺϺìÆìʹÓõġ£Èô²»ÖªµÀÈçºÎÇø·Ö£¬½¨Ò黹ÊÇʹÓùٷ½µÄSP²¹¶¡°ü°É¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 2 ÌõÆÀÂÛ

  1. jack200788 ÓÚ 2010-06-12 16:47:58·¢±í:

    :0)1:0w5ty(1:0wpoi2

  2. zpsevenstar ÓÚ 2007-10-02 17:16:09·¢±í:

    :0L :0L :0L :0L