Setting up Alpine in a chroot: Difference between revisions

From Alpine Linux
No edit summary
(replace fancy wget with apk fetch and include list of official repos)
Line 2: Line 2:


  <nowiki>ARCH=x86
  <nowiki>ARCH=x86
wget 'http://nl.alpine.michaelzhou.net/alpine/edge/main/x86/apk-tools-static-'`wget -o /dev/null -O - 'http://alpinelinux.org/packages?title_op=%3D&title=apk-tools-static&apk_depends_value_op=contains&apk_depends_value=&name_op=%3D&name='$ARCH'&name_1_op=%3D&name_1=&name_2_op=%3D&name_2=' | fgrep 'views-field views-field-apk-version' -A1 | tail -n1 | cut -d'<' -f1 | sed 's/ //g'`'.apk'
apk fetch apk-tools-static -o ./
tar zxvf apk-tools-static-*.apk
tar zxvf apk-tools-static-*.apk
mkdir ./root
mkdir ./root
Line 9: Line 9:
chroot ./root sh -l</nowiki>
chroot ./root sh -l</nowiki>


{{{Tip|For a list of available repositories, see http://nl.alpinelinux.org/alpine/MIRRORS.txt}}}
  <nowiki>echo 'nameserver 8.8.8.8' >/etc/resolv.conf
  <nowiki>echo 'nameserver 8.8.8.8' >/etc/resolv.conf
echo 'http://nl.alpine.michaelzhou.net/alpine/edge/main/' >/etc/apk/repositories
echo 'http://nl.alpine.michaelzhou.net/alpine/edge/main/' >/etc/apk/repositories
echo 'http://nl.alpine.michaelzhou.net/alpine/edge/testing/' >>/etc/apk/repositories
echo 'http://nl.alpine.michaelzhou.net/alpine/edge/testing/' >>/etc/apk/repositories
apk update</nowiki>
apk update</nowiki>

Revision as of 07:35, 3 June 2011

To set up in ./root:

ARCH=x86
apk fetch apk-tools-static -o ./
tar zxvf apk-tools-static-*.apk
mkdir ./root
./sbin/apk.static --initdb -U --root root --arch $ARCH --repository http://nl.alpine.michaelzhou.net/alpine/edge/main/ --repository http://nl.alpine.michaelzhou.net/alpine/edge/testing/ add alpine-base
echo unset HISTFILE >>./root/etc/profile
chroot ./root sh -l

For a list of available repositories, see http://nl.alpinelinux.org/alpine/MIRRORS.txt

echo 'nameserver 8.8.8.8' >/etc/resolv.conf
echo 'http://nl.alpine.michaelzhou.net/alpine/edge/main/' >/etc/apk/repositories
echo 'http://nl.alpine.michaelzhou.net/alpine/edge/testing/' >>/etc/apk/repositories
apk update