今天一个朋友说,帮我装台Freebsd+postfix+extmail吧。我纠结了下,说,好吧。不过自从玩ubuntu之后,Freebsd的很多东西都忘掉了。哈哈,不如就借这个机会捡回来好了。

登上去一看,发现朋友说的干净的Freebsd,果然够干净!ports都没有装。。

其实安装ports也简单,前提是你在internet上面啦。

使用 portsnap 安装

使用portsnap不需要事先安装 ports tree,并且能够在任何时候恢复到已知的最新状态(即使手工对ports tree进行了修改)。

下载或更新 portsnap 快照的方法是 portsnap fetch;

首次安装,或希望将 ports tree 恢复到快照的样子,应使用 portsnap extract;

之后更新系统中的 ports tree,则可以通过 portsnap update 来完成。

对于服务器而言,推荐在 crontab 中增加在每天3点执行 portsnap cron,以减少使用时所需要的下载时间。

首次下载 portsnap 快照时,需要下载一个大约50MB的快照基础文件。在中国大陆,由于网络状况的原因,这可能需要较长时间。可以考虑用 portsnap fetch -s portsnap.cn.freebsd.org 做首次下载;之后的下载,还是推荐使用正常的 portsnap fetch。

可以使用下面步骤完成上述情况

a>.首先设置一个比较快的portsnap服务器,如果系统默认的地址访问速度也很快,可以不修改

#vi /etc/portsnap.conf

设置SERVERNAME=portsnap.cn.freebsd.org ,你可以设置相对速度快点的服务器的地址

b>.执行下面命令

#portsnap fetch extract    这里直接下载ports并且解压

这样就完成了下载ports系统以及解压到/usr下面了

c>.设置最快的ports镜像

用ports安装软件的时候,如果没有设置相对来说最快的ports服务器地址,那就会默认的 ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/,这个地址对于很多地方来说是很慢的。

修改 /etc/make.conf 加入以下代码

MASTER_SITE_OVERRIDE=\
ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}\
 

如果有最快的地址,可以加到上面去,下载就会快了。

安装完后一用make install 就出下面的错误就出下面的错误:

# make install

On FreeBSD before 6.2 ports system unfortunately can not set default X11BASE by itself so please help it a bit by setting X11BASE=${LOCALBASE} in make.conf. On FreeBSD before 6.2 ports system unfortunately can not set default X11BASE by itself so please help it a bit by setting X11BASE=${LOCALBASE} in make.conf.

On the other hand, if you do wish to use non-default X11BASE, please set variable USE_NONDEFAULT_X11BASE. On the other hand, if you do wish to use non-default X11BASE, please set variable USE_NONDEFAULT_X11BASE.

*** Error code 1

*** Error code 1

这个其实可以很容易解决,在 /etc/make.conf 里面加入 X11BASE=${LOCALBASE} 就可以了喂。

 


转载于:https://blog.51cto.com/lemon12911/440264