°»½Å¿¡ Portsnap¸¦ »ç¿ëÇÏ¿© FreeBSD´Â ³ª¹« ¼öÁýÀ» ÇâÇÑ´Ù
Portsnap´Â ¾ÈÀüÇÏ°Ô »ç¿ëÇϱâ CVSup º¸´Ù´Â ½¬¿î FreeBSD Ç×±¸ ³ª¹«¸¦ ¹èºÎÇÏ°í »õ·Ó°Ô Çϱ⸦ À§ÇÑ ¼±Åà ü°èÀÌ´Ù. Portsnap´Â FreeBSD 6.0¿¡¼ óÀ½À¸·Î Æ÷ÇԵǾú´Ù. CVSup °°ÀÌ, Portsnap´Â »õ·Ó°Ô ÇϱâÀÇ Àâ¾Æ´ç±â±â ¸ðÇüÀ» ÀÌ¿ëÇÑ´Ù: Æ÷ÀåÇÏ°í ¼¸íµÈ Ç×±¸ ³ª¹«´Â ÆÄÀÏÀ» ´Þ¸° portsnap¿¡ ÀÇÇÏ¿© »ç¿ëÀÚ¿¡ ÀÇÇÏ¿© ¼öµ¿À¸·Î ¿ä±¸Çϰųª °»½ÅÀ» ÀÚµ¿À¸·Î ´Ù¿î·ÎµåÇÏ´Â cron ÀÏÀ» ¼³Ä¡Çϱâ À§ÇÏ¿© Ŭ¶óÀÌ¾ðÆ®¸¦ Á¤»óÀûÀ¸·Î ¼öµ¿ÀûÀ¸·Î ±â´Ù¸®´Â À¥ ¼¹ö¿¡ µÐ´Ù.
FreeBSD ´õ ¿À·¡µÈ ü°è¿¡, Portsnap´Â ÀÚµ¿À¸·Î Æ÷ÇÔµÇÁö ¾Ê´Â´Ù, ±×·¯³ª sysutils/portsnap Ç×±¸¿¡¼ ¸í·ÉÀ» »ç¿ëÇØ¼ ¼³Ä¡µÉ ¼ö ÀÖ´Ù:
# pkg_add - r portsnap
Portsnap´Â /usr/ports¿¡ ù°·Î °¡Á®¿À°í ºÎÀü½ÂÀ¸·Î /var/db/portsnap/¿¡¼ (/usr/local/portsnap/¿¡¼ Portsnap°¡ FreeBSD¿¡¼ ¼³Ä¡µÇ´Â °æ¿ì¿¡ ¼öÁýÀ» ÇâÇÑ´Ù) ÀúÀåµÈ FreeBSD Ç×±¸ ³ª¹«ÀÇ ¾ÐÂø±â ½º³ÀÀ» »õ·Ó°Ô Çϰí, ±× ÈÄ¿¡ ´ÜÁö uncompressed »ì¾ÆÀÖ´Â Ç×±¸ ³ª¹«¸¦ ÃßÃâÇÏ°í »õ·Ó°Ô ÇÑ´Ù.
PortsnapÀÇ Çൿ ±×¸®°í °¡µ¿Àº /etc¿¡¼ ÀÖ´Â ±¸¼º ÆÄÀÏ portsnap.conf¿¡ ÀÇÇØ ÅëÁ¦µÈ´Ù (/usr/local/etc/¿¡¼ ½Å¼±ÇÏ°Ô ¼³Ä¡µÉ ¶§ Portsnap°¡ FreeBSD¿¡¼ ¼³Ä¡µÇ´Â °æ¿ì¿¡ ¼öÁý ¹× ±¸¼º ÆÄÀÏÀ» ÀÚµ¿À¸·Î »ý¼ºµÇÁö ¾Ê´Â´Ù ÇâÇÑ´Ù, ´ë½Å ´ç½ÅÀº portsnap.conf.sample ÀÇ Á¤´çÇÑ »çº»À» portsnap.conf·Î ±×°Í ã¾Æ³¾ °ÍÀÌ´Ù). ÀϹÝÀûÀ¸·Î, °úÅ ±¸¼º ÆÄÀÏÀº ÇÑ´Ù ±×°ÍÀÇ ÀÏÀ».
Ä¿¸Çµå ¶óÀο¡, µÚ¿¡ ¿À´Â ¼±ÅñÇÀº ´ëºÎºÐÀÇ ½Ã°£¿¡ ±¸¼º ÆÄÀÏ ÀÚü¿¡¼ »ç¿ëµÇ´Â ÇÊ¿ä, ¾î¶² Çü¼ºµÉ ¼ö ÀÖ´õ¶óµµ, Áö¿øµÈ´Ù:
- d workdir: »óÁ¡ ÀÛ¾÷ ÆÄÀÏ (¿¹¸¦µé¸é. workdir¿¡¼ ´Ù¿î·ÎµåµÈ °»½Å). (°úÅÂ: ±¸¼º ÆÄÀÏ¿¡¼ ÁÖ¾îÁö´Â /var/db/portsnap, ¶Ç´Â)
- conffile f: conffile¿¡¼¿¡¼ À±°ûÀ» ÀÐÀ¸½Ê½Ã¿À. (°úÅÂ: /etc/portsnap.conf)
- I: °»½Å ¸í·ÉÀ» À§ÇØ, Ç×±¸ ³ª¹«ÀÇ °»½Å »öÀÎ ÆÄÀÏ, ±×·¯³ª ³ª¸ÓÁö ¾Æ´Õ´Ï´Ù.
- k ¿¼è: ÁÖ¾îÁø SHA256 À½½ÄÀ» °¡Áø °ø¿ë ۰¡ ¿¹»óÇϽʽÿÀ. (°úÅÂ: ±¸¼º ÆÄÀÏ¿¡¼ °¡Ä¡¸¦ ÀÐÀ¸½Ê½Ã¿À)
- p portsdir: uncompressed ½º³ÀÀ» ÃßÃâÇϰųª »õ·Ó°Ô ÇÒ °æ¿ì, ÀüȹøÈ£ºÎ portsdir¸¦ À§¿¡ ¿î¿µÇÒ. (°úÅÂ: ±¸¼º ÆÄÀÏ¿¡¼ ÁÖ¾îÁö´Â /usr/ports/, ¶Ç´Â.)
- s ¼¹ö : ¼úÃ¥Àº ÁöÁ¤µÈ ¼¹ö ¶Ç´Â ¼¹ö ¼ö¿µÀå¿¡¼ ½ÅûÇÑ´Ù. (°úÅÂ: ±¸¼º ÆÄÀÏ¿¡¼ ÁÖ¾îÁö´Â portsnap.FreeBSD.org, ¶Ç´Â.)
°æ·Î: ÃßÃâ¹° ¸í·ÉÀ» À§ÇØ, °æ·Î ¸Ç¸ÕÀú Ç×±¸ ³ª¹«ÀÇ ºÎºÐ¿¡¼¸¸¼¸¸ ¿î¿µÇϽʽÿÀ. (¿¹¸¦µé¸é. portsnap sysutils ¶Ç´Â Ç×±¸´Â sysutils/portsman, sysutils/portsnap, sysutils/portupgrade, µîµîÀ» ÃßÃâÇÒ °ÍÀÔ´Ï´Ù)
Portsnap Ä¿¸Çµå ¶óÀÎÀ» À§ÇÑ Á¾°üÀº:
portsnap [- I] [- d workdir] [- conffile f] [- k ¿¼è] [- p portsdir] [- s ¼¹ö] ¸í·É¡¦ [°æ·Î]
PortsnapÀÇ »ç¿ë¹ý
- Á¸ÀçÇÏ¸é °æ¿ì¿¡ ºó ÀüȹøÈ£ºÎ /usr/ports¸¦ âÁ¶ÇϽʽÿÀ.
# mkdir /usr/ports
-
/var/db/portsnap·Î Ç×±¸ ¼öÁý °¡Á®¿À°í ´Ù¿î·ÎµåÇϽʽÿÀ (¶Ç´Â ±¸¼º ÆÄÀÏ¿¡¼ ÁöÁ¤µÇ´Â ´Ù¸¥ ¾î¶² À§Ä¡)ÀÇ ¾ÐÃà ½º³ÀÀ». Internet connection needed at this stage) and update the existing snapshot.
# portsnap fetch
- If you are running Portsnap for the first time (even if a ports tree has already been created or populated, to let Portsnap establishes a baseline from which portsnap can determine which parts of the ports tree need to be updated) or /usr/ports hasn¡¯t been populated, extract the snapshot and replaces the existing files and directories, and establishes Portsnap-maintained ports tree into /usr/ports:
# portsnap extract
This step can be skipped if you¡¯re only updating the ports tree.
- If you already have a populated /usr/ports and you are just updating, run the following command instead:
# portsnap update
Note: For updating of FreeBSD Ports Tree, step 1 and 3 can be combined into single command: portsnap fetch update (not support in older version of Portsnap).
Running Portsnap as Cron Job
portsnap fetch will not be able to execute from a cron job to avoid burden of sudden surge of downloading request to Portsnap servers. Instead, a special portsnap cron command exists, which waits and sleeps for a random duration up to 3600 seconds before fetching updates, as if the fetch command is specified.
To run portsnap automatically with cron job, just add the line into /etc/crontab (the line set the time to 3 AM everyday, you can choose your own timing):
0 3 * * * root /usr/sbin/portsnap cron
This will ensure that the FreeBSD snapshot of ports collection is always up-to-date and can be quickly extracted into /usr/ports.
Note: Running portsnap update from cron is not recommended as it may cause problem if installing or updating of a port happens at the time the cron job runs. Portsnap will updates or removes files which are being used by the port build. However, running portsnap -I update to update the ports Index files is possible, and can be used together with portversion to identify installed software which is out of date.
To update ports compressed snapshot and the INDEX files in /usr/ports/, and send an email if any installed ports are out of date, use the following line in /etc/crontab:
0 3 * * * root portsnap -I cron update && pkg_version -vIL=
Note: Older version of portsnap does not support listing multiple commands (e.g., cron update) in the same invocation of portsnap. If the line above fails, try replacing portsnap -I cron update with portsnap cron && portsnap -I update.
IMPORTANT: This is a machine translated page which is provided "as is" without warranty. Machine translation may be difficult to understand. Please refer to original English article whenever possible.
Share and contribute or get technical support and help at My Digital Life Forums.
Related Articles
- Update FreeBSD Ports Collection to Latest Version with Security Update with Portmanager and Portaudit
- Searching for Application in FreeBSD¡¯s Ports Collection
- Easy Way to Upgrade FreeBSD¡¯s Ports
- Update FreeBSD Ports Collection Up to Date and Latest
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 4
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 3
- Portdowngrade - Downgrade to Previous Version of FreeBSD¡¯s Ports
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 1
- FreeBSD 6.0 on VMware Server Time and Clock Slow Down
- Checking Free Disk Space on FreeBSD Server




























February 9th, 2008 18:04
[...] at My Digital Life, there is an excellent tutorial on using portsnap. It covers not only the basics, but all the rest as [...]