FreeBSD安装应用程序

时间:2020-01-09 10:40:16  来源:igfitidea点击:

问题描述:如何在FreeBSD操作系统下安装应用程序?

解决方法:与其他任何开源操作系统一样,FreeBSD附带了丰富的应用程序集。
您需要使用以下方法安装所有第三方应用程序:

  • "端口集合",用于从源代码安装软件包
  • "二进制软件包",用于安装预构建的二进制软件包

FreeBSD使用pkg_add命令安装应用程序(二进制方法)

您需要使用pkg_add命令来安装软件包发行版。
如果您的软件包文件名为foo-1.2.tgz,请执行:

# pkg_add foo-1.2.tgz

您可以使用互联网安装软件包,即使用远程获取功能。
这将确定适当的objformat并释放,然后获取并安装该软件包。

# pkg_add -r -v {package-name}
# pkg_add -r -v bash
# pkg_add -r -v mysql-server

查看已安装的软件包

使用pkg_info命令:

# pkg_info

输出示例:

bash-3.2.25         The GNU Project's Bourne Again SHell
cvsup-without-gui-16.1h_3 General network file distribution system optimized for CVS 
db41-4.1.25_4       The Berkeley DB package, revision 4.1
gettext-0.16.1_3    GNU gettext package
libiconv-1.11_1     A character set conversion library
mysql-client-5.1.22 Multithreaded SQL database (client)
nagios-statd-3.12   Daemon/client to check remote host information for Nagios
net-snmp-5.3.1_7    An extendable SNMP implementation
perl-5.8.8_1        Practical Extraction and Report Language
portupgrade-2.4.3_2,2 FreeBSD ports/packages administration and management tool s
python25-2.5.1_1    An interpreted object-oriented programming language
rsnapshot-1.3.0     Filesystem snapshot utility based on rsync(1)
rsync-2.6.9_2       A network file distribution/synchronization utility
ruby-1.8.6.111_1,1  An object-oriented interpreted scripting language
ruby18-bdb-0.6.2    Ruby interface to Sleepycat's Berkeley DB revision 2 or lat

您可以通过输入以下命令来获取详细的软件包信息:$pkg_info {package-name}

# pkg_info rsync-2.6.9_2

输出:

Information for rsync-2.6.9_2:

Comment:
A network file distribution/synchronization utility

Required by:
rsnapshot-1.3.0

Description:
rsync is a replacement for rcp that has many more features.

rsync uses the "rsync algorithm" which provides a very fast method for
bringing remote files into sync. It does this by sending just the
differences in the files across the link, without requiring that both
sets of files are present at one of the ends of the link beforehand.
This makes rsync a good remote file distribution/synchronization utility
in a dialup PPP/SLIP environment.

Note, requires rsync on the destination machine.

There is a Computer Science Technical Report on the rsync algorithm is
included in the distribution, and is available as
ftp://samba.anu.edu.au/pub/rsync/tech_report.ps

WWW: http://rsync.samba.org/

FreeBSD使用端口安装应用程序(源方法)

/usr/ports目录已安装FreBSD ports集合。
在安装新软件之前,请务必更新FreeBSD端口集合:

# portsnap fetch
# portsnap update

在安装任何应用程序之前,您需要了解所需的内容以及该应用程序的名称。
使用wheris命令查找/usr/ports目录下的确切位置。
例如,找出bash包的位置,请执行:

# whereis bash

输出:

/usr/ports/shells/bash

要安装bash,请执行:

# cd /usr/ports/shells/bash
# make install clean