Sakura共用サーバにportsをインストール

sakura共用サーバの容量が3Gにアップしたので、portsを入れられるか試してみた。

ports treeの取得。

portsnapで更新するため、portsディレクトリを作って、そこにportsnap.confを書く。

% mkdir ~/usr/ports
% mkdir -p ~/usr/local/var/db/portsnap
% mkdir -p ~/usr/ports/distfiles
% vi ~/usr/ports/portsnap.conf

portsnap.confの内容はこんな感じ。homeのところは適宜変更を。

# Default directory where compressed snapshots are stored.
WORKDIR=/home/(ここを変えて)/usr/local/var/db/portsnap

# Default location of the ports tree (target for "update" and  "extract").
PORTSDIR=/home/(ここを変えて)/usr/ports

# Server or server pool from which to fetch updates.  You can change
# this to point at a specific server if you want, but in most cases
# using a "nearby" server won't provide a measurable improvement in
# performance.
SERVERNAME=portsnap.FreeBSD.org

# Trusted keyprint.  Changing this is a Bad Idea unless you've received
# a PGP-signed email from <security-officer@FreeBSD.org> telling you to
# change it and explaining why.
KEYPRINT=9b5feee6d69f170e3dd0a2c8e469ddbd64f13f978f2f3aede40c98633216c330

# Example of ignoring parts of the ports tree.  If you know that you
# absolutely will not need certain parts of the tree, this will save
# some bandwidth and disk space.  See the manual page for more details.
#
# WARNING: Working with an incomplete ports tree is not supported and
# can cause problems due to missing dependencies.  If you have REFUSE
# directives and experience problems, remove them and update your tree
# before asking for help on the mailing lists.
#
REFUSE arabic chinese french german hebrew hungarian
REFUSE korean polish portuguese russian ukrainian vietnamese
REFUSE x11 x11-clocks x11-drivers x11-fm x11-fonts x11-servers x11-themes x11-toolkits x11-wm
REFUSE palm cad astro

あとはportsnapでこのコンフィグファイルを指定すればおーけー。

% portsnap -f ~/usr/ports/portsnap.conf fetch extract update

展開後で402Mほど。

インストール

全部homeのusr/localというディレクトリ以下にインストールすることにする。

参考:

まずはディレクトリを作る

% mkdir -p ~/usr/local
% cd ~/usr/local
% mkdir -p bin sbin etc lib tmp/dist tmp/work var/db/pkg var/db/ports var/run

さらに、以下の設定.zshrcにする。(chshで/usr/local/bin/zshに変えている場合)

export INSTALL_AS_USER=yes
export PREFIX=${HOME}/usr/local
export LOCALBASE=${HOME}/usr/local
export PKG_DBDIR=${LOCALBASE}/var/db/pkg
export PKG_TMPDIR=${LOCALBASE}/tmp/
export PORT_DBDIR=${LOCALBASE}/var/db/pkg
export DISTDIR=${LOCALBASE}/tmp/dist
export WRKDIRPREFIX=${LOCALBASE}/tmp/work
export PORTSDIR=${HOME}/usr/ports
export PKGTOOLS_CONF=${LOCALBASE}/etc/pkgtools.conf
export DEPENDS_TARGET='install clean'

export X11BASE=${LOCALBASE}

export PKG_CONFIG_PATH="$HOME/usr/local/lib/pkgconfig:$HOME/usr/local/libdata/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/libdata/pkgconfig:/usr/libdata/pkgconfig"

# Set user and group variables to ourself
export BINOWN=`whoami`
export BINGRP=`id -G -n ${BINOWN}`
export SHAREOWN=${BINOWN}
export SHAREGRP=${BINGRP}
export MANOWN=${BINOWN}
export MANGRP=${BINGRP}

# Make sure files are installed with correct default permissions
export BINMODE=744
export SHAREMODE=644
export MANMODE=644

# Make sure we don't really try to become root, but just execute everything as ourselves
export SU_CMD="sh -c"

# Make sure the systemdefault make.conf is not read
export __MAKE_CONF=${LOCALBASE}/etc/make.conf

# Keep our own version of ldconfig hints
export LDCONFIG="/sbin/ldconfig -i -f ${LOCALBASE}/var/run/ld-elf.so.hints"
#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=${LOCALBASE}/bin:${LOCALBASE}/sbin:${PATH}
export MANPATH_MAP=${LOCALBASE}/bin:${LOCALBASE}/man

# Set application specific variables to make sure it doesn't pick up things from the main system
export APXS=${LOCALBASE}/sbin/apxs
export PERL=${LOCALBASE}/bin/perl
export PERL5=${PERL}
export SITE_PERL=${LOCALBASE}/lib/perl5/site_perl/5.8.8
export SITE_PERL5=${SITE_PERL}
export PERL_VERSION=5.8.8
export PERL_VER=${PERL_VERSION}

その後、ldconfigのサーチディレクトリを更新。

% ldconfig -r | awk '/search/ {print $3}' | tr ":" "\n" > ~/usr/local/etc/ld-elf.so.conf
% echo ${HOME}/usr/local/lib >> ~/usr/local/etc/ld-elf.so.conf
make !

あとは普通にmake installできる。

でも、perlをインストールの時にハマってる。

use.perlで、/etc/manpath.configを勝手に書き換えようとしてpermission deniedを出してくる。use.perlあたりが悪さしてると思うんだけどなぁ。