Chinaunix首页 | 论坛 | 博客
  • 博客访问: 828464
  • 博文数量: 330
  • 博客积分: 9641
  • 博客等级: 中将
  • 技术积分: 3181
  • 用 户 组: 普通用户
  • 注册时间: 2007-01-19 14:41
文章分类

全部博文(330)

文章存档

2012年(17)

2011年(135)

2010年(85)

2009年(57)

2008年(36)

我的朋友

分类: BSD

2009-04-05 18:20:36

PKG
Warning: Before installing any application, you should check for security issues related to your application.
    You can also install ports-mgmt/portaudit which will automatically check all installed applications for known vulnerabilities; a check will be also performed before any port build. Meanwhile, you can use the command portaudit -F -a after you have installed some packages.


Package Search:
If you know the exact name of the port, but just need to find out which category it is in, you can use the whereis(1) command. Simply type whereis file, where file is the program you want to install.
# whereis lsof
lsof: /usr/ports/sysutils/lsof
This tells us that lsof (a system utility) can be found in the /usr/ports/sysutils/lsof directory.

Additionally, you can use a simple echo(1) statement to find where a port exists in the ports tree. For example:
echo /usr/ports/*/*lsof*
/usr/ports/sysutils/lsof
Note that this will return any matched files downloaded into the /usr/ports/distfiles directory.

# cd /usr/ports
# make search name=lsof
# make search key=string
In both of these cases, the search string is case-insensitive(没有大小写区分).


Package Operation:
# pkg_add lsof-4.56.4.tgz

# pkg_add -r lsof
This will cause the utility to automatically determine the correct object format and release and then fetch and install the package from an FTP site.

Note: pkg_add(1) will download the latest version of your application if you are using FreeBSD-CURRENT or FreeBSD-STABLE. If you run a -RELEASE version, it will grab the version of the package that was built with your release.

pkg_info(1) is a utility that lists and describes the various packages installed.
pkg_version(1) is a utility that summarizes the versions of all installed packages. It compares the package version to the current version found in the ports tree.
=     The version of the installed package matches the one found in the local ports tree.
<     The installed version is older than the one available in the ports tree.
>     The installed version is newer than the one found in the local ports tree. (The local ports tree is probably out of date.)
?     The installed package cannot be found in the ports index. (This can happen, for instance, if an installed port is removed from the Ports Collection or renamed.)
*     There are multiple versions of the package.
!     The installed package exists in the index but for some reason, pkg_version was unable to compare the version number of the installed package with the corresponding entry in the index.

# pkg_delete xchat-1.7.1
# pkg_delete xchat\*

All package information is stored within the /var/db/pkg directory. The installed file list and descriptions of each package can be found within files in this directory.


pkg_add -r 直接拿pkg包安装
pkg_add -rK pkgname时,只在当前目录里保存 pkgname.tbz这个包(not set $PKGDIR),而依赖包统统不保存($PKGDIR设置,则保存在此目录下面).

`make deinstall' 会移除该 port,并且不会叁照其相依/相关的 ports。
`pkg_delete' 在移除该 port 前,会叁照其相依/相关的 ports,并且 `pkg_delete'有支援 wild card

PORT
A security vulnerabilities check can be automatically done by portaudit before any new application installation. This tool can be found in the Ports Collection (ports-mgmt/portaudit). Consider running portaudit -F before installing a new port, to fetch the current vulnerabilities database.

# cd /usr/ports/sysutils/lsof

# make
# make install
# make clean
or
# make install clean

Some shells keep a cache of the commands that are available in the directories listed in the PATH environment variable, to speed up lookup operations for the executable file of these commands. If you are using one of these shells, you might have to use the rehash command after installing a port, before the newly installed commands can be used. This command will work for shells like tcsh. Use the hash -r command for shells like sh.

# make fetch
Replace fetch with fetch-recursive if you want to fetch all the dependencies of a port too.

Users may need to acquire the tarballs from a site other than the MASTER_SITES (the location where files are downloaded from). You can override the MASTER_SITES option with the following command:
# cd /usr/ports/directory
# make MASTER_SITE_OVERRIDE= \
ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/ fetch
In this example we change the MASTER_SITES option to ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/.

Overriding the Default Ports Directories
WRKDIRPREFIX and PREFIX variables

Reconfiguring Ports
There are many ways to do this. One option is to go into the directory containing the port and type make config, which will simply present the menu again with the same options selected. Another option is to use make showconfig, which will show you all the configuration options for the port. Yet another option is to execute make rmconfig which will remove all selected options and allow you to start over.

阅读(892) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~