把ports安装在home中,并安装nodejs

总结

因为我在Sakura租用的FreeBSD服务器上,在我的home目录下安装了ports,并且使用它来安装了nodejs,所以这是我的备忘录。

環境FreeBSD 9.1-RELEASE-p15 amd64プラン さくらのレンタルサーバ スタンダード

做法-

环境变量

export MYBASE='usr'

export LOCALBASE=${HOME}/${MYBASE}/local
export PORTSDIR=${HOME}/${MYBASE}/ports

export PREFIX=${LOCALBASE}
export PKG_DBDIR=${LOCALBASE}/var/db/pkg
export PORT_DBDIR=${LOCALBASE}/var/db/pkg
export DISTDIR=${LOCALBASE}/tmp/dist
export WRKDIRPREFIX=${LOCALBASE}/tmp/work
export PKGTOOLS_CONF=${LOCALBASE}/etc/pkgtools.conf

export DEPENDS_TARGET='install clean'
export INSTALL_AS_USER=yes

export LDCONFIG="/sbin/ldconfig -f ${LOCALBASE}/var/run/ld-elf.so.hints -i -R ${LOCALBASE}/etc/ld-elf.so.conf"
export LD_LIBRARY_PATH=${LOCALBASE}/lib
export LD_RUN_PATH=${LOCALBASE}/lib
export PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin
export MANPATH_MAP=${LOCALBASE}/man
export SRCCONF=${LOCALBASE}/etc/src.conf
export MAKE_JOBS_UNSAFE=yes

将端口和索引带来

mkdir -p ${LOCALBASE}/{etc,lib,tmp/dist,tmp/work,var/db/pkg}
cd ${HOME}/${MYBASE}
fetch ftp://ftp.jp.freebsd.org/pub/FreeBSD/ports/ports/ports.tar.gz
tar xzf ports.tar.gz
cd ${PORTSDIR}
fetch http://www.FreeBSD.org/ports/INDEX-9.bz2
bunzip2 INDEX-9.bz2

创建ld-elf.so.conf

ldconfig -r | awk '/search/ {print $3}' | tr ":" "\n" > ${LOCALBASE}/etc/ld-elf.so.conf
echo ${LOCALBASE}/lib >> ${LOCALBASE}/etc/ld-elf.so.conf

编写Python代码

cd ${PORTSDIR}/lang/python
make install

因为这样的话无法构建Node.js,所以进行了解决方法。

mkdir -p ${HOME}${HOME}
ln -sf ${HOME}/usr ${HOME}${HOME}/usr

安装Node.js和npm。

cd ${PORTSDIR}/www/node
make install

cd ${PORTSDIR}/www/npm
make install

请参考。

欧津峰的FreeBSD备忘录

广告
将在 10 秒后关闭
bannerAds