Table of Contents

Alpine

Download

$ wget http://dl-cdn.alpinelinux.org/alpine/v3.7/releases/x86_64/alpine-standard-3.7.0-x86_64.iso

Install Alpine

Create a raw disk image and boot the VM…

$ qemu-img create alpine.img 2G
$ qemu-system-x86_64 -enable-kvm -hda alpine.img -cdrom alpine-standard*.iso -boot d -m 512

Then, login as root (no password) and run :

$ setup-alpine

Follow instructions. Select disk “/dev/sda” with “sys” option. When the installation is complete, type “poweroff”.

$ qemu-system-x86_64 -enable-kvm -hda alpine.img -m 512

Then, you can add Alpine to QemuNet with these lines:

qemunet.cfg
# linux alpine
SYS[alpine]="linux"
FS[alpine]="$IMGDIR/alpine.img"
QEMUOPT[alpine]="-localtime -m 512"

Install Alpine Packages

Once Alpine image is started with Qemu… It will by default launch DHCP client as defined in “/etc/network/interfaces”.

In order to use the edge release (under constant development), you must edit /etc/apk/repositories. Change the version number (such as v3.2) to edge.

#/media/cdrom/apks
http://alpine.mirror.wearetriple.com/edge/main
http://alpine.mirror.wearetriple.com/edge/community
http://alpine.mirror.wearetriple.com/edge/testing

Then:

$ apk upgrade --update-cache --available
$ sync
$ reboot
# install new packages
$ apk update
$ apk upgrade
$ apk add bash bash-doc bash-completion
$ apk add nano emacs-nox
$ apk add iputils iptables iproute2
$ ...

Basic configuration steps:

  1. remove root pasword: $ passwd -d root
  2. set bash as default shell, edit /etc/passwd and replace /bin/ash by /bin/bash
  3. edit /etc/fstab and add this line host /mnt/host 9p trans=virtio,defaults,nofail 0 0 to enable file sharing
  4. disable DHCP… edit /etc/network/interfaces and comment all lines for interface eth0
  5. enable startup script: ln -s /mnt/host/start.sh /etc/local.d/local.start and then rc-update add local
# clean & halt
$ rm /etc/resolv.conf
$ history -c
$ poweroff

Install Alpine Desktop

Let's create a new QemuNet image called “alpinex”

$ cp --sparse=auto alpine.img alpinex.img  # be careful, when you copy sparse files!

Then, add these lines in qemunet.cfg:

qemunet.cfg
# linux alpinex
SYS[alpinex]="linux"
FS[alpinex]="$IMGDIR/alpinex.img"
QEMUOPT[alpinex]="-localtime -m 512"

Then run this image in raw mode:

$ ./qemunet.sh -l alpinex

First enable DHCP in /etc/network/interfaces and reboot…

To enable french keyboard:

$ apk add kbd setxkbmap
$ setxkbmap fr                  # for french keyboards

Then install Xorg and XFCE desktop environment:

$ setup-xorg-base
$ apk add alpine-desktop       
$ apk add faenza-icon-theme      # for icons  
$ apk add xf86-input-mouse xf86-input-keyboard # useful?
$ apk add xf86-video-modesetting # recommended for Qemu guests?
$ apk add dbus lxdm sudo
$ rc-update add dbus ; rc-service dbus start
$ rc-update add udev ; rc-service udev start

Add a desktop user (as sudoer):

$ adduser toto                  # password toto
$ addgroup sudo
$ addgroup toto sudo
$ emacs /etc/sudoers            # %sudo ALL=NOPASSWD: ALL  

Launch the XFCE4 desktop with LXDM:

$ rc-service lxdm start     # don't forget to select xfce session, before to log in!

If it works… quit XFCE

$ rc-update add lxdm  
$ reboot  

To enable “fr” keyboard in Xorg, add this section:

/etc/X11/xorg.conf
Section "InputClass"
	Identifier	"Keyboard Default"
	MatchIsKeyboard	"yes"
	Option		"XkbLayout" "fr"
EndSection

Try to get lightweight system by replacing “alpine-desktop” meta-package by “xfce4 + firefox”.

More details: http://wiki.alpinelinux.org/wiki/XFCE_Setup

Biblio