さくら共用サーバでportsを使う
気紛さんの手順をFreeBSD13用(bash向け)に焼き直してみました。シェルをbashに変更する手順はこちらです。
ports treeの取得
-
portsnapで更新する為、portsディレクトリを作ってportsnap.confを置きます。
$ mkdir ~/usr/ports $ mkdir -p ~/usr/local/var/db/portsnap $ mkdir -p ~/usr/ports/distfiles
-
portsnap.confを作成します。
$ vi ~/usr/ports/portsnap.conf ---------- BEGIN ---------- # 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 ---------- E N D ---------- :wq
-
portsnapを実行します。
$ portsnap -f ~/usr/ports/portsnap.conf fetch extract update
ディレクトリの作成と環境変数の設定
-
インストール用ディレクトリを作成します。
$ 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
-
環境変数を設定します。
$ vi .bashrc ---------- BEGIN ---------- #### Ports #### https://faw.hatenablog.jp/entry/20090109 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:/u sr/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 ALLOW_UNSUPPORTED_SYSTEM=1 export MAKE_JOBS_UNSAFE=yes ---------- E N D ---------- :wq
-
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
パッケージのインストールと実行
-
パッケージをインストールします。
$ cd ~/usr/ports $ find ./ -name nyancat ./net/nyancat $ cd ./net/nyancat $ make install
-
実行します。
$ nyancat
付記
- 環境がある程度できた時点で ~/usr 配下のバックアップをお勧めします。
-
make deinstall
で削除できます。