Http://www.bchuan.com/archives/645.html
1. Install the ports System
There are three ways to install the ports system:
1. Install the ports system when installing the system through the installation disk
This is the simplest method, but it also has shortcomings. Because the ports system is always updated at any time. Therefore, the ports system you installed on the installation CD is definitely not the latest.
2. Use portsnap to install/synchronize the ports System
This is the recommended method.
To use portsnap, you do not need to install the ports tree in advance and can restore it to the latest known State at any time (even if you have manually modified the ports tree ).
Using portsnap is divided into two steps: downloading a compressed portsnap snapshot and updating an existing system. The method for downloading or updating a portsnap snapshot is portsnap fetch. If you first install portsnap or want to restore the ports tree to the snapshot, you should use portsnapextract. Then, update the ports tree in the system, you can use portsnap update. For servers, it is recommended to add portsnap cron at three o'clock every day in crontab to reduce the download time required for use.
When you download a portsnap snapshot for the first time, you need to download a basic snapshot file of about 50 MB. In mainland China, this may take a long time due to network conditions. You can use portsnap fetch-s portsnap.cn.freebsd.org for the first download. We recommend that you use normal portsnap fetch for subsequent downloads.
Follow these steps to complete the preceding steps:
A> first, set up a fast portsnap server. If your access speed is fast by default, you can leave it unchanged.
# Vi/etc/portsnap. conf
Set servername = portsnap.cn.freebsd.org. You can set the server address that is faster than you.
B>. Run the following command:
# Portsnap fetch extract download ports and decompress
This completes the download of the ports system and decompress it to/usr.
C>. Set the fastest ports Image
When installing software with ports, if you do not set the fastest port server address relative to you, the default hosts.
Modify/etc/make. conf and add the followingCode
Master_site_override = \
Ftp://ftp.freebsdchina.org/pub/freebsd/ports/distfiles/?#dist_subdir= }\
Ftp://ftp.tw.freebsd.org/pub/freebsd/ports/distfiles/?#dist_subdir}
If you have the fastest address, you can add it to download the block.
3. Use csup/CVSup to install/synchronize the ports System
This method is no longer recommended.
Whether or not you have installed the ports system beforehand, you can use csup/CVSup (csup is recommended, which is included in the basic system) to install/synchronize the latest ports system. Copy/usr/share/examples/CVSup/ports-supfile to a place (for example,/home/user/tmp/ports-supfile ), modify the server to be connected ). Finally, run the following command to install/synchronize data:
Csup-L 2/home/user/tmp/ports-supfile
Directory structure of the ports tree
Assume that your ports tree is installed in the default location/usr/ports.
File:
/Usr/ports/Changes # records of ports developers and maintainers.
/Usr/ports/Copyright # copyright of the ports tree.
/Usr/ports/gids # group names that may be used by ports.
/Usr/ports/index-xxx # summary of each port
/Usr/ports/knobs # environment variables and explanations required for port compilation.
/Usr/ports/legal # protocol restrictions for some ports.
/Usr/ports/moved # The port list to be moved/deleted.
/Usr/ports/makefile # BSD makefile of the ports tree.
/Usr/ports/readme
/Usr/ports/UIDs # user names that may be used by ports.
/Usr/ports/updating # update records and suggestions for the ports tree.
Directory:
/Usr/ports/mK # makefile set required for compiling the port.
/Usr/ports/templates # Some templates.
/Usr/ports/tools # some tools.
Apart from the above files and directories, all other directories are ports. The directory structure of a port:
/Usr/ports/category/Name
For example, Firefox is classified on www. Therefore, the position of Firefox in the ports tree is:
/Usr/ports/www/Firefox
Ii. Use the ports System
1 Query
For example, if you want to know whether Pidgin is included in ports, you can:
$ CD/usr/Ports
$ Make search key = pidgin
You can also use
$ CD/usr/Ports
$ Make search name = pidgin
For more examples in/usr/ports/readme, see.
2 Installation
Very simple. For example, if you want to install Firefox, use it as the root user:
# Cd/usr/ports/www/Firefox
# Make install clean
3 uninstall
To uninstall Firefox:
# Cd/usr/ports/www/Firefox
# Make deinstall clean
4. Upgrade
To Upgrade Firefox:
# Cd/usr/ports/www/Firefox
# Make deinstall reinstall clean