From Alpine Linux
< User:Ncopa
Revision as of 14:15, 7 May 2014 by Ncopa (talk | contribs) (start networking)
Jump to: navigation, search

This is how to set up a new build server.

# Create the container
lxc-create -n build-3-0-x86 -t alpine -- --arch x86 --release edge

# Make it autostart
ln -s lxc /etc/init.d/ && rc-update add

# setup ip forward for ssh
iptables -t nat -A PREROUTING -d -p tcp -m tcp --dport 22030 -j DNAT --to-destination
/etc/init.d/iptables save
lbu commit

# Create missing dir
mkdir /var/lib/lxc/build-3-0-x86/rootfs/var/cache/distfiles

# copy authorized_keys:
cp -a /var/lib/lxc/build-2-7-x86/rootfs/root/.ssh /var/lib/lxc/build-3-0-x86/rootfs/root/

# set up network:
vi /var/lib/lxc/build-3-0-x86/rootfs/etc/network/interfaces

Contents of /etc/network/interfaces

auto lo iface lo inet loopback auto eth0 iface eth0 inet static address netmask gateway
# Start container
/etc/init.d/ start

# log in as root
lxc-console -n build-3-0-x86

# make netowrking autostart
rc-update add networking
/etc/init.d/networking start

# install and set up ssh
apk add openssh
rc-update add sshd
/etc/init.d/sshd start
mkdir /root/.ssh
cat > /root/.ssh/authorized_keys
# paste the ssh keys and ctrl-d

# logout

#and detach from console: ctrl-a q

Log in via ssh.

# install alpine-sdk, sudo and aports-build
apk add alpine-sdk sudo aports-build

# make users in %wheel group rin commands without passwd

# create buildozer user (with good passwd)
adduser buildozer
addgroup buildozer abuild

From host, copy over buildozer keys from other build server:

cp -a /var/lib/lxc/build-2-7-x86/rootfs/home/buildozer/.abuild /var/lib/lxc/build-3-0-x86/rootfs/home/buildozer/ cp -a /var/lib/lxc/build-2-7-x86/rootfs/home/buildozer/.ssh /var/lib/lxc/build-3-0-x86/rootfs/home/buildozer/

You should now be able to log in via ssh as buildozer.

# clone aports and alpine-iso
git clone git://
git clone git://

# setup alpine-iso previous:
echo "2.7.0" > alpine-iso/previous

sudo vi /etc/abuild.conf

export JOBS=24                          
export MAKEFLAGS="-j$JOBS -l$JOBS"
PACKAGER="Buildozer <>"

# as buildozer, bootstrap the toolchain:
cd ~/aports/main
for i in $(ap recursdeps musl binutils gcc make patch | xargs ap builddirs); do (cd $i && abuild -r)||break; done

sudo apk upgrade -U -a

# set up repositories to only use selfbuilt packages:
echo "/home/buildozer/packages/main" > /etc/apk/repositories