FreeBSD--如何最有效率的安装软件

摘要:
如何从<在Freebsd下效率最高;https://www.cnblogs.com/apexchu/p/4131821.html&gt ; FreeBSD的默认下载工具是fetchFetchftp://ftp.gnu.org/gnu/gettext/Gettext-0.17.tar.gz首先,FreeBSD下最具特色的软件安装和升级机制是端口,这既方便又高效。

Freebsd 下如何最有效率的安装软件

 

From <https://www.cnblogs.com/apexchu/p/4131821.html>

FreeBSD的默认下载工具是fetch

Fetch ftp://ftp.gnu.org/gnu/gettext/Gettext-0.17.tar.gz

 

Ports机制

首先,FreeBSD下最有特色的软件安装和升级机制就是ports,既方便又高效。下面我们从ports套件的安装开始讲起,让你细致的了解有关ports的每一个细节

一、ports套件的安装

①我的FreeBSD 8.0-release是最小化安装,所以既没有ports,也没有/usr/ports目录。选择启用ports的话,需要在root下输入"sysinstall"来安装它:

输入sysinstall --> 选择Configure --> Distributions --> ports,然后安装即可。

②ports的默认路径是/usr/ports。这个ports的根目录下面有很多的文件夹及子文件夹,组成一个树状目录,包含大量ports下的软件。比如mail是邮件服务软件,games是游戏,www代表web服务软件,databases则是数据库软件。

[root@bsd01 /usr/ports]# cd www
[root@bsd01 /usr/ports/www]# ls -d apache*
apache-contrib apache13 apache13-modssl+ipv6
apache-forrest apache13+ipv6 apache13-ssl
apache-jserv apache13-modperl apache20
apache-mode.el apache13-modssl apache22

如果你需要安装什么软件,只要进入当前目录,然后“make install clean”即可。

[root@bsd01 ~]# cd /usr/ports/www/apache22
[root@bsd01 /usr/ports/www/apache22] make install clean

/usr/ports/distfiles是存放软件包的文件夹。ports会先检查/usr/ports/distfiles目录内有没有这个软件包,如果没有它就会自动从网上下载安装。

二、加速ports的升级速度

ports从网上下载软件包自动安装,那么从那里下载呢?首先,我们需要安装axel来取代默认的下载工具fetch,这样可以提高ports的安装速度:

cd /usr/ports/ftp/axel
make install

然后,我们需要一个源地址管理。跟ubuntu上的/etc/source.list文件一样,freebsd用的文件是/etc/make.conf,我们可以修改其文件,达到加速下载的目的。

#修改 /et/make.conf
vi /etc/make.conf
#加入以下内容
FETCH_CMD=axel
FETCH_BEFORE_ARGS= -n 10 -a
FETCH_AFTER_ARGS=
DISABLE_SIZE=yes
MASTER_SITE_OVERRIDE?=
http://ports.hshh.org/$%7bDIST_SUBDIR%7d/
http://ports.cn.freebsd.org/$%7bDIST_SUBDIR%7d/
ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/distfiles/$%7BDIST_SUBDIR%7D/
MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP}      

这样处理后,在公司的网络环境下,FreeBSD的下载速度明显提高了,有时居然能达到1M/s,这样升级及安装软件方便极了;呵呵,终于可以摆脱fetch的龟速了。

三、更新ports目录树

既然ports的树目录全部下载到本地,那么即使FreeBSD有新的软件包或者添置了新的软件,本地目录树也不会更新。所以,我们每隔一段时间需要更新本地目录树。我来介绍一种在FreeBSD中方便、快捷的更新ports的方法:使用portsnap来更新ports目录树。

①配置portsnap:

我们使用portsnap,首先要设置一下它的配置文件,位于/etc/portsnap.conf:

[root@bsd01 /usr/ports]# vi /etc/portsnap.conf

SERVERNAME=portsnap.freebsd.org

修改成:

SERVERNAME=portsnap.hshh.org

这个是他的更新服务器。另外还有几个国内比较快的portsnap服务器:

portsnap.hshh.org

portsnap2.hshh.org

portsnap3.hshh.org (网通)

portsnap4.hshh.org

②首次使用portsnap:

在你的FreeBSD首次使用portsnap必须执行下面2步:

[root@bsd01 ~]# portsnap fetch
[root@bsd01 ~]# portsnap extract

portsnap fecth是从网上获取portsnap快照的最新压缩包,听闻这个压缩包官方没小时更新一次。

portsnap extract 则是把这个压缩包创立到/usr/ports。哪怕你以前已经手工安装了ports,他也会重新创立一次。

(注:这2步可以合成使用,指令为 [root@bsd01 ~]# portsnap fetch extract)

③以后使用portsnap更新,只需要执行下面2步:

[root@bsd01 ~]# portsnap fetch
[root@bsd01 ~]# portsnap update

同样,这2步可以合成使用:[root@bsd01 ~]# portsnap fetch update

portsnap第一次运行extract命令时,可能需要一段时间,以后更新使用update的时候,速度就快很多了。

 

From <https://www.cnblogs.com/apexchu/p/4131821.html>

 

Pkg 用法

Usage: pkg [-v] [-d] [-l] [-N] [-j <jail name or id>|-c <chroot path>|-r <rootdir>] [-C <configuration file>] [-R <repo config dir>] [-o var=value] [-4|-6] <command> [<args>]

Global options supported:

        -d             Increment debug level

        -j             Execute pkg(8) inside a jail(8)

        -r             Execute pkg(8) using relocating installation to <rootdir>

        -c             Execute pkg(8) inside a chroot(8)

        -C             Use the specified configuration file

        -R             Directory to search for individual repository configurations

        -l             List available commands and exit

        -v             Display pkg(8) version

        -N             Test if pkg(8) is activated and avoid auto-activation

        -o             Override configuration option from the command line

        -4             Only use IPv4

        -6             Only use IPv6

 

Commands supported:

        add            Compatibility interface to install a package

        alias          List the command line aliases

        annotate       Add, modify or delete tag-value style annotations on packages

        audit          Reports vulnerable packages

        autoremove     Removes orphan packages

        backup         Backs-up and restores the local package database

        check          Checks for missing dependencies and database consistency

        clean          Cleans old packages from the cache

        config         Display the value of the configuration options

        convert        Convert database from/to pkgng

        create         Creates software package distributions

        delete         Deletes packages from the database and the system

        fetch          Fetches packages from a remote repository

        help           Displays help information

        info           Displays information about installed packages

        install        Installs packages from remote package repositories and local archives

        lock           Locks package against modifications or deletion

        plugins        Manages plugins and displays information about plugins

        query          Queries information about installed packages

        register       Registers a package into the local database

        remove         Deletes packages from the database and the system

        repo           Creates a package repository catalogue

        rquery         Queries information in repository catalogues

        search         Performs a search of package repository catalogues

        set            Modifies information about packages in the local database

        ssh            Package server (to be used via ssh)

        shell          Opens a debug shell

        shlib          Displays which packages link against a specific shared library

        stats          Displays package database statistics

        unlock         Unlocks a package, allowing modification or deletion

        update         Updates package repository catalogues

        updating       Displays UPDATING information for a package

        upgrade        Performs upgrades of packaged software distributions

        version        Displays the versions of installed packages

        which          Displays which package installed a specific file

 

Commands provided by plugins:

 

For more information on the different commands see 'pkg help <command>'.

 

pkginstall -- install packages from remote package repositories or local
     archives


OPTIONS
     The following options are supported by pkg        install:

-A, --automatic
                Mark the installed packages as automatic. Will        be automati-
                cally removed if no other packages depend on them. For        more
                information please refer to pkg-autoremove(8).

-C, --case-sensitive
                Make the standard or the regular expression (-x) matching
                against        pkg-name case sensitive.

-f, --force
                Force the reinstallation of the        package        if already installed.

-g, --glob
                Treat the package names        as shell glob patterns.

-I, --no-install-scripts
                If any installation scripts (pre-install or post-install)
                exist for a given package, do not execute them.         When a        pack-
                age is updated,        deinstallation scripts (pre-deinstall or post-
                deinstall) are not run either.

-i, --case-insensitive
                Make the standard or the regular expression (-x) matching
                against        pkg-name case insensitive. This is the        default,
                unless modified        by setting CASE_SENSITIVE_MATCH        to true        in
                pkg.conf.

-M, --ignore-missing
                Force the installation of the package with missing dependen-
                cies.

-n, --dry-run
                Dry-run        mode. The list        of changes to packages is always
                printed, but no        changes        are actually made.

-F, --fetch-only
                Do not perform actual installation of packages,        merely fetch
                packages that should be        upgraded and detect possible con-
                flicts.

-q, --quiet
                Force quiet output, except when        -n is used, where pkginstall
                will always show packages to be        installed, upgraded or
                deleted.

-R, --recursive
                When used with -f, reinstalls any packages that        require        the
                given package.

-r        reponame, --repositoryreponame
                Install        packages from only the named repository, irrespective
                of the configured ``active'' status from repo.conf.

-U, --no-repo-update
                Suppress the automatic update of the local copy        of the reposi-
                tory catalogue from remote. Automatic repository catalogue
                updates        are only attempted when        the effective UID of the
                process        has write access to the        package        database. Otherwise
                they are silently ignored.

-x, --regex
                Treat the package names        as regular expressions according to
                the "modern" or        "extended" syntax of re_format(7).

-y, --yes        Assume yes when        asked for confirmation before package instal-
                lation.

 

From <https://www.freebsd.org/cgi/man.cgi?query=pkg-install>

 

 

 

免责声明:文章转载自《FreeBSD--如何最有效率的安装软件》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇apache中怎么配置网站的默认首页【转】使用NodeJS将文件或图像上传到服务器下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

功能点方法

功能点分析是一种从用户视角度量软件开发的标准方法。 功能点分析的目的 功能点分析是基于原始需求,通过确定提供给用户的软件的功能数量来度量软件规模。了解了这一点,可知功能点分析的目的是: 度量用户所要求和接受的功能 度量不依赖于实施技术的软件开发和维护的规模(意见:度量软件开发和维护的规模而且不依赖于实现技术) 除了达到以上的目的外,功能点计数过程还应...

adb命令(笔记)

1、adb shell su     进入root管理员权限(前提是手机已root) 2、chmod 可以修改文件夹的权限:   $ adb shell   $ su   # chmod -R 777  /data/data/com.tencent.mm/ MicroMsg       -R或者–recursive参数:递归处理,将指定目录下的所有文件及子...

大家是怎么做APP接口的版本控制的?欢迎进来看看我的方案。升级版的Versioning

背景 APP不同于网站,网站程序一发版,所有用户看到的都是最新的页面、调用最新的接口,没有新老版本一说。APP一旦下载到用户手机上,用户不更新你拿他一点办法都没有,但是随着业务的调整,同一个接口的请求参数和输出JSON有变化的话,就需要考虑老版本的兼容问题了。 举个例子:某APP的1.0.0版,服务端用户信息接口(api/User/UserInfo)输出的...

如何测试APP是否兼容IPv6

从2016年6月苹果公司要求APP兼容IPv6,很多APP在审核的时候因为这个原因被拒,这里介绍了一种利用两个iPhone手机和一台 OS X10.11以上的mac( IPv6 DNS64/NAT64 网络,这项功能是 OS X 10.11 新加的功能) 第一步:通过数据线连接iphone和mac 第二步:打开iphone的个人热点并选择仅蓝牙和USB...

intellij idea for mac 2018 破解版

下载地址:https://pan.baidu.com/s/1DNo3CvkI7EMy6Mt0hdzTpg 1、在本站下载好mac文件包,打开dmg镜像文件,将“IntelliJ IDEA”拖入到“Applications”应用文件夹中进行安装; 2、等待软件安装完成后先不要运行软件,回到之前打开的dmg镜像界面,打开“Crack”文件夹,将文件夹目录下的...

Arch/GentooLinux开发环境构建与常用软件一览

编辑器 Emacs Arch Linux yay -S clang emacs Gentoo Linux sudo emerge --ask clang emacs visual-studio-code Gentoo Linuxsudo emerge --ask app-editors/visual-studio-code sublim...