Skip to main content

Setup Alpine VM

Setup a lightweight development VM

Download Image:


Enable community repository:

sed -i '/[[:digit:]]\/community/s/^#//' /etc/apk/repositories
apk update

Use zsh as better default shell:

apk add zsh
sed -i '/\/root:/s#/bin/ash#/bin/zsh#' /etc/passwd

Install required packages:

# recommend
apk add sudo gcompat bash python3 curl wget

# for developers
apk add git mandoc tree unzip

# for WSL
apk add dos2unix libstdc++

exec $SHELL

Install Docker:

apk add docker cni-plugins
apk add docker-compose
apk add docker-doc
rc-update add docker
openrc default
rc-service docker start

SSH physical connection
apk add openrc openssh openssh-server
ssh-keygen -A
rc-update add sshd

Edit and save it:

vi /etc/ssh/sshd_config
# To allow login, uncomment the next line:
PasswordAuthentication yes
# To allow VSCode port forwarding, uncomment the next line and set it true.
AllowAgentForwarding yes

To allow root login:

echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
# change login passowrd, only one characters if not public server may be acceptable
passwd root

Launch the server:

# start
openrc default
rc-service sshd start
# restart
rc-service sshd restart

赞助作者 (Sponse me):