Alpine Linux Notes
Table of Contents
Documentation
Install
- Once booted into the live cd login with
root, there is no password - Use the
setup-alpinecommand to start the automated installer - For keyboard layout type
us - For the keyboard variant type
us - Set the hostname
- Default the network device using dhcp
- Set the root password
- Set your timezone, for example
America/Kentucky/Louisville - Select the disk you would like to use for the install
- Select
cryptfirst followed bysys - Input the password you wish to encrypt the drive with
- The system will then be installed
- Type
rebootto use the new system
Package Management
- The package manager in alpine linux is
apk - Use the
addsub command to install a package,apk add sudo - Use
apk searchto find a package - Use the
delsub command to remove a package
Service management
- Alpine uses openrc init system
- The
rc-servicecommand has three sub commands,stop,start, andstatus- The format for using it is
rc-service <SERVICE_NAME> <SUB_COMMAND>
- The format for using it is
- Enabling and disabling of services is handled with
rc-update - When you enable a service you need to specify which runlevel it is going to operate under
- To view all the services running and their runlevels use
rc-update show -v - In addition to show rc-update has two command sub commands,
addanddelete- The format for using rc-update is like this:
rc-update <SUB_COMMAND> <SERVICE_NAME> <RUN_LEVEL>
- The format for using rc-update is like this:
Setup a User
- This example creates a user
adduser -h /home/<USER> -s /bin/ash <USER>, this will prompt you for the password - To give the user sudo access do the following:
- Install sudo with
apk add sudo - Create a sudoers file for the wheel group,
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel - Add the newly created user to the wheel group,
adduser <USER> wheel
- Install sudo with
Basic Packages
- This installs basic packages that I like to have on a system
apk add mg git make gcc g++ tmux
Setting up a GUI
- Run
setup-xorg-baseto install the needed GPU drivers - Add the user to the input and video groups,
adduser <USER> input,adduser <USER> video- You might need to log out and log in for this to take effect
- Install a few ttf fonts,
apk add ttf-hack ttf-dejavu - Install the appropriate GPU driver either Intel, AMD or QXL (QEMU)
QEMU
- Install the driver with,
apk add xf86-video-modesetting - Ensure the host is setup with the
virtiovideo driver - Also set the listen type on Display Spice to none
AMD
- Install the video driver,
apk add xf86-video-amdgpu - Install the firmware,
apk add linux-firmware-amdgpu - Install mesa,
apk add mesa-dri-gallium - Update the KMS setting:
- Add amdgpu to the kernel modules,
echo amdgpu >> /etc/modules - Add fbcon to the kernel modules,
echo fbcon >> /etc/modules - Install mkinitfs,
apk add mkinitfs - Add kms to the features list in the
/etc/mkinitfs/mkinitfs.conf - Run
mkinitfsand reboot
- Add amdgpu to the kernel modules,
DWM
- Install needed libraries,
apk install libx11-dev libxft-dev ncurses libxinerama-dev adwaita-icon-theme dbus-x11 - Clone dwm,
git clone https://git.suckless.org/dwm - Build dwm with
make && make install - Clone dmenu,
git clone https://git.suckless.org/dmenu - Build dmenu with
make && make install - Clone st,
git clone https://git.suckless.org/st - Build st with
make && make install - Create a
.xinitrcand add the lineexec dwm - Create a
.profileand add the linestartx - Log out and log back in and dwm should start
Building Emacs
- Install dependencies,
apk add autoconf texinfo gtk+3.0-dev libxpm-dev giflib-dev gnutls-dev ncurses-dev gawk - Clone emacs with
git clone -b <BRANCH> git://git.sv.gnu.org/emacs.git - Run autogen to create configure
./autogen.sh - Configure emacs with
./configure - Compile emacs with
make -j<NUMBER_OF_CORES+1> - The busybox awk is not compatible with the install scripts. We need to tell make install to use gawk instead,
AWK=gawk sudo make install