Alpine Linux is built on musl libc and BusyBox, weighs about 130 MB installed, and is what most production Docker images use as a base. This guide installs it on a VM in ~5 minutes.
Prerequisites
- A VM with 256 MiB RAM and 1 GiB disk (Alpine truly is that small).
alpine-virt-3.20.x-x86_64.isofromalpinelinux.org/downloads/(oralpine-standardfor bare metal).
Step 1: Boot the ISO and log in
Boot the ISO. Log in at the prompt as root (no password).
Step 2: Run the installer
setup-alpine
Walk through the prompts:
- Keymap:
usthenus - Hostname:
alpine-host - Network interface: usually
eth0; pick DHCP for lab, manual IP for production - DNS:
1.1.1.1 8.8.8.8 - Timezone:
Asia/Riyadh - Proxy:
none - Mirror:
fto find fastest, or pick a regional mirror - SSH server:
openssh(default) - NTP client:
chrony - Disk: pick your target disk
- How to use it:
sysfor an installed system (notlvmordata) - Confirm — Alpine partitions, formats, copies the system over
After a couple of minutes it tells you to reboot. Remove the ISO first:
reboot
Step 3: First login
Log in as root with the password you set during setup-alpine.
Step 4: Create an operator user
apk add sudo
adduser ops
adduser ops wheel
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel
Push your SSH key from your workstation:
ssh-copy-id ops@alpine-host
Edit /etc/ssh/sshd_config:
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
rc-service sshd restart
Alpine uses OpenRC, not systemd. rc-service, rc-update, rc-status replace systemctl.
Step 5: A baseline of useful packages
apk update
apk upgrade
apk add bash vim curl htop git bind-tools tzdata ca-certificates iptables-openrc
bash is not installed by default — Alpine ships ash (BusyBox). If your scripts need bash, install it explicitly.
Step 6: Firewall
apk add awall
modprobe ip_tables
rc-update add iptables boot
rc-update add ip6tables boot
rc-service iptables start
A minimal awall config — /etc/awall/private/main.json:
{
"description": "skyline minimal",
"zone": {
"internet": { "iface": "eth0" }
},
"policy": [
{ "in": "internet", "action": "drop" },
{ "in": "_fw", "action": "accept" }
],
"filter": [
{ "in": "internet", "out": "_fw", "service": "ssh", "action": "accept" },
{ "in": "internet", "out": "_fw", "service": "http", "action": "accept" },
{ "in": "internet", "out": "_fw", "service": "https","action": "accept" }
]
}
awall enable main
awall activate
Verify
cat /etc/alpine-release
uname -a
rc-status
apk info | wc -l
Conclusion
Alpine installs in under five minutes and runs at a fraction of the disk + RAM of a traditional distro. The cost is musl libc — some Linux binaries built against glibc will not run unmodified. For Docker base images it is the default; for production VMs it is excellent when you control your own builds.
Next steps
- Learn the package manager via apk on Alpine Linux.
- Use Alpine in containers with Alpine Linux in a Docker container.
- For glibc-based distros see Install Debian 12.
Comments
0 total · 0 threads