Current location - Quotes Website - Personality signature - How to install software under FreeBSD 8 is the most efficient?
How to install software under FreeBSD 8 is the most efficient?
The default download tool of FreeBSD is fetch, which is slow and difficult to use. There are some effective ways to install software under FreeBSD. Let us introduce them to you.

Introduction to FreeBSD

Port mechanism

First of all, the most distinctive software installation and upgrade mechanism under FreeBSD is ports, which is convenient and efficient. Let's start with the installation of the port suite, so that you can know every detail about the port in detail.

Recommended topic: the overall strategy of deployment and management of enterprise intranet development environment (FreeBSD+PHP)

I. Installation of Port Kit

① My FreeBSD 8.0-release is the minimum installation, so there is neither ports nor /usr/ports directory. If you choose to enable the port, you need to enter "sysinstall" under root to install it:

Enter sysinstall-> Select configuration-> Release->; Port, and then install.

② The default path of the port is /usr/ports. There are many folders and subfolders under the root directory of the port, forming a tree directory, which contains a large number of software under the port. For example, mail is a mail service software, games is a game, www stands for web service software and databases is a database software.

[root @ BSD 0 1/usr/ports]# CD www

[root @ BSD 0 1/usr/ports/www]# ls-d Apache *

Apache-contrib Apache 13 Apache 13-modssl+IPv6

Apache-Forrest Apache 13+IPv6 Apache 13-SSL

Apache-jserv Apache 13-modperl Apache 20

Apache-mode . El Apache 13-modssl Apache 22

If you need to install any software, just enter the current directory and "clean up the installation".

[root @ BSD 0 1 ~]# CD/usr/ports/www/Apache 22

[root @ bsd01/usr/ports/www/apache22] make the installation clean.

/usr/ports/distfiles is the folder where the software packages are stored. Ports will first check whether there is this software package in the /usr/ports/distfiles directory, and if not, it will automatically download and install it from the Internet.

Second, speed up port upgrading.

Ports downloads software packages from the Internet and installs them automatically. Where do you download them? First of all, we need to install axel instead of the default download tool fetch, which can speed up the installation of the port:

cd /usr/ports/ftp/axel

Carry out installation

Then, we need a source address management. Like the /etc/source.list file on ubuntu, freebsd uses the /etc/make.conf file, and we can modify its file to speed up the download.

# modify /et/make.conf

vi /etc/make.conf

# Add the following

FETCH_CMD=axel

Extraction before ARGS = -n 10 -a

After ARGS, select =

DISABLE _ SIZE = Yes

Primary site coverage? =\

. freebsd.org/${DIST_SUBDIR}/\

FTP://FTP . FreeBSD China . org/pub/FreeBSD/ports/distfiles/$ { DIST _ SUBDIR }/

Primary site coverage? =${ MASTER _ SITE _ BACKUP }

After this processing, the download speed of FreeBSD is obviously improved in the company's network environment, sometimes reaching 1M/s, which makes the software upgrade and installation very convenient. Hehe, I can finally get rid of fetch's turtle speed.

Third, update the port directory tree.

Because the tree directories of all ports are downloaded locally, even if FreeBSD has new software packages or adds new software, the local tree will not be updated. Therefore, we need to update the local directory tree every once in a while. Let me introduce a convenient and quick way to update ports in FreeBSD: using portsnap to update the port directory tree.

① Configure port snapshot:

To use portsnap, we must first set its configuration file, which is located at /etc/portsnap.conf:

[root @ BSD 0 1/usr/ports]# VI/etc/port snap . conf

keep

SERVERNAME = port snap . FreeBSD . org

Revised as:

SERVERNAME=portsnap.hshh.org

This is his update server. In addition, there are several relatively fast portsnap servers in China:

portsnap.hshh.org

portsnap2.hshh.org

Portsnap3.hshh.org (Netcom)

portsnap4.hshh.org

② First use of portsnap:

To use portsnap for the first time in FreeBSD, you must perform the following two steps:

[root@bsd0 1 ~]# port snapshot extraction

[root@bsd0 1 ~]# port snapshot excerpt

PortSnapFeth is the latest compressed package to obtain port snapshots from the Internet. I heard that this compressed package is updated every hour.

Portsnap extract creates this compressed package to /usr/ports. Even if you have manually installed the port before, it will be recreated.

(Note: these two steps can be used synthetically, and the instruction is [root @ bsd01~] # portsnap fetch extract).

(3) When updating with portsnap in the future, you only need to perform the following two steps:

[root@bsd0 1 ~]# port snapshot extraction

[root@bsd0 1 ~]# port snapshot update

Similarly, these two steps can also be combined: [root @ bsd01~] # portsnap fetch update.

It may take some time for portsnap to run the extract command for the first time, and it will be much faster when updating and using update in the future.