---
date: 2021-11-27T16:09:00Z
---
Here's a quick and messy checklist for running Alpine Linux on a KVM VPS.
* Get an example IPv4 address, netmask and gateway: `ifconfig` or `ip link` * Get the default nameservers (or set your own): `cat /etc/resolv.conf`
* *ISO* > *Add ISO* and paste the ISO link to the Virtual image
* *List VPS* > *Manage* (next to the vps name) > *Settings* > *VPS Configuration*
* Temporarily change the boot order: *1) CD Drive 2) Hard Disk*
* Select ISO: (select the custom user ISO)
* Save and reboot the VPS
* The CD drive usually has a name like `/dev/sr0` * Example of disk device name: `/dev/vda`
* This should be done before proceeding with the setup script, or it will fail during the disk partitioning with warnings about partitions not being found.
* Example configuration for network setup:
* Available interface: eth0
* Ip address for eth0: (IPv4 address from ifconfig/ip link output)
* Netmask: (from ifconfig/ip link, e.g. 255.255.255.0)
* Gateway: (often .0 or .1 in the IPv4 address subnet, e.g. xxx.xxx.xxx.1)
* DNS nameserver(s): (enter IPs separated by commas)
* Make sure to get the network connection working or the disk setup will fail to download the utilities needed to partition the disk. If it is unable to update the repo list, it's very likely there is something wrong with the network setup — ctrl+c to exit the script and re-run the script while checking the connection details carefully.
* The `setup-disk` part of the script will create 3 partitions: boot (~105 MB), swap (~4173 MB) and root (fills the remaining space).
* `vi /etc/apk/repositories`
* Remove the CD drive entry `/media/cdrom/apks`
* Optionally uncomment the community repo and/or the edge repo URLs if you want to pull from the testing repos
* Refresh the repo index: `apk update`
* `apk add bash doas vim`
* `adduser $user`
* From the ssh client: `ssh-copy-id -i ~/path/to/ssh/key.pub $user@$ip`
* `vi /etc/ssh/sshd_config`
* `PermitRootLogin no`
* `PasswordAuthentication no`
* Restart sshd: `rc-service sshd restart`
If your VPS doesn't have IPv6, you can skip the `ip6` parts.
* `modprobe ip_tables`
* `modprobe ip6_tables`
* `rc-update add iptables`
* `rc-update add ip6tables`
* `iptables-restore < /etc/iptables/ipv4.rules` * `ip6tables-restore < /etc/iptables/ipv6.rules` * `/etc/iptables/rules-save` * `/etc/ip6tables/rules-save`
* `rc-service iptables start` * `rc-service ip6tables start`
iface eth0 inet static address $address netmask 255.255.255.0 gateway $gateway
nameserver $dns1 nameserver $dns2
* `ifdown eth0` * `ifup eth0`
Install from an ISO to a Virtualbox machine
Alpine Wall — firewall frontend