Boot from the installation medium, log in as root, and run the setup script with option -q
$ setup-alpine -q
Install to disk
$ setup-disk -m sys
Reboot
Run the setup script until Disk & Install and stop right there (Ctrl+c)
$ setup-alpine
Install to disk without creating the swap partition
$ setup-disk -m sys -s 0 /dev/sda
or no swap and also set /boot size (in MB, default 300)
$ export SWAP_SIZE=0
$ export BOOT_SIZE=500
$ setup-disk -m sys
Single partition setup ➔ https://github.com/wizetek/alpine
Base system
$ setup-keymap
$ setup-timezone
$ setup-interfaces
$ setup-ntp
Host name
$ setup-hostname
$ hostname -F /etc/hostname
Root and user accounts and passwords
$ passwd
$ setup-user -a
Option -a adds user to admin group wheel and installs doas
Secure Shell access (SSH)
$ setup-sshd
Note: There is no sudo. Alpine Linux uses doas by default.
Enable community repo
$ setup-apkrepos
Select (c) Community repo enable or edit /etc/apk/repositories and uncomment the corresponding line.
Install man pages
$ apk add docs
Package docs is a metapackage that pulls in mandoc.
Install compatibility layer to run glibc binaries
$ apk add gcompat
Note: glibc is typically used by proprietary / binary-only software, like NVIDIA drivers. Sometimes such applications are available as Flatpaks which can run on musl systems.
Core utilities
$ apk add coreutils
Linux utilities
$ apk add util-linux
Search utilities
$ apk add findutils grep
Bash shell
$ apk add bash bash-completion
Hardware management
$ apk add pciutils usbutils hwdata
Disk management
$ apk add udisks2
Network management
$ apk add iproute2
Build environment
$ apk add build-base
Set up desktop environment
$ setup-desktop
or just a window manager
$ apk add icewm
Install fonts
$ apk add font-terminus font-inconsolata font-dejavu font-noto font-noto-cjk font-awesome font-noto-extra
Add sound server and related tools
$ apk add pipewire pipewire-pulse pipewire-alsa wireplumber pavucontrol
Set up device manager (eudev is a drop-in replacement for systemd udev)
$ setup-devd udev
***
The following services get automatically installed by setup-desktop but may still need to be added to the default runlevel via rc-update
D-Bus
$ apk add dbus dbus-x11
$ rc-update add dbus
$ rc-service dbus start
elogind
$ apk add elogind
$ rc-update add elogind
$ rc-service elogind start
polkit
$ apk add polkit-elogind
$ rc-update add polkit
$ rc-service polkit start
Start login manager
$ rc-service lightdm start
Alpine Package Keeper (apk)
Search for a package name
$ apk search vim
and show description too
$ apk search -v vim
Search for exact match (-e or -x or --exact)
$ apk search -e vim
Search in description (--description)
$ apk search -d vim
Search reverse dependencies / required by (--rdepends)
$ apk search -r gvim
Add (install)
$ apk add vim
or manually edit package list
$ vim /etc/apk/world
$ apk fix
Delete (remove/uninstall)
$ apk del vim
and recursively delete dependencies
$ apk del -r vim
Fix (reinstall)
$ apk fix vim
and also fix dependencies (--depends)
$ apk fix -d vim
Update package list and upgrade all packages
$ apk update
$ apk upgrade
or both actions combined
$ apk -U upgrade
Upgrade specific package(s)
$ apk upgrade vim screen mc htop nmap
or
$ apk add -u vim
Prevent package upgrade
$ apk add 'vim=9.1.1415-r0'
or
$ apk add 'vim<9.1.1415'
then allow upgrading later
$ apk add 'vim>9.1.1415'
Ask for confirmation (--interactive)
$ apk -i upgrade
Do not make any changes (--simulate)
$ apk -s upgrade
Remove old packages from cache
$ apk cache clean
List all packages (show license and installation status by default)
$ apk list
List specific package(s)
$ apk list vim
and also show description
$ apk list -v vim
List upgradable packages
$ apk list -u
but do not show license and status (--quiet)
$ apk list -u -q
or
$ apk version
List installed packages
$ apk list -I
List orphaned packages
$ apk list -O
Show installed packages
$ apk info
and show version information
$ apk info -v
and include version and description
$ apk info -vv
Show "required by" reverse dependencies (--rdepends)
$ apk info -r xxd
Show "depends on" package dependencies (--depends)
$ apk info -R vim
Show "contains" – files provided by package (--contents)
$ apk info -L vim
Show "is owned by" – which package owns the specific file (--who-owns)
$ apk info -W /etc/rc.conf
Show all information about package (--all)
$ apk info -a vim
Show statistics about all packages
$ apk stats
1. Edit /etc/apk/repositories and change all instances of the release version number
$ setup-apkrepos
Alternatively, instead of specific version, use "latest-stable" which will always trigger release upgrades whenever version changes. Beware.
2. Update repository index / package list
$ apk update
3. First, upgrade apk package manager itself if needed
$ apk add --upgrade apk-tools
or
$ apk upgrade --self-upgrade-only
4. Then upgrade all available packages
$ apk upgrade --available
Option --available forces all packages to be upgraded, even if they have the same version numbers.
Edit /etc/apk/repositories to change version to edge and optionally add the testing repository.
#/media/cdrom/apks
http://dl-cdn.alpinelinux.org/alpine/edge/main
http://dl-cdn.alpinelinux.org/alpine/edge/community
http://dl-cdn.alpinelinux.org/alpine/edge/testing
Upgrade with confirmation
$ apk -U -i upgrade
Note: Packages in testing are user-contributed, are only built for edge and have no support (staging only).
Start, stop, restart, status of services
$ rc-service sshd start
$ rc-service lightdm stop
$ rc-service networking restart
$ rc-service networking status
Add, delete services
$ rc-update add sshd
$ rc-update delete sshd
Show all services and their corresponding runlevels
$ rc-update show
include all services, even without runlevel
$ rc-update show -v
Show services at specific runlevel
$ rc-update show default
$ rc-update show boot
View active runlevel and services
$ rc-status
List runlevels
$ rc-status -l
Change runlevel
$ openrc single
$ openrc default