How to Setup and SSH into Alpine Linux Virtual Box

Andrew WC Brown
ExamPro
Published in
3 min readOct 14, 2018

Motivation

I want a lightweight virtual image that I can share with developers to get them up and running.

  • I want things to be dead simple.
  • I want to provide the smallest possible download
  • I want them to be developer ready in less than 10 mins.

So we’re going to use Alpine due to its small size. We’re going to use VirtualBox instead of use Docker or Vagrant to keep thing simple, and we’re going to make a snapshot so we can then pass that along to developers.

Install VirtualBox

Setup Virtual Image

Download Alpine Linux Virtual x86_64

Create a new Virtual Guest and name it whatever you like and proceed to create.

Create the Virtual Hard Disk, I’ve reduced the file size to 1GB.

Proceed to settings

and Attach the Alpine ISO to the Optical Driver

Enable Port Forwarding and we’ll forward ports so we can ssh into our server as well as access our web-application from a web browser. Least the Host and Guest IP blank.

Launch the instance and to login just type root

Install ssh

apk add openssh
rc-update add sshd
rc-status
/etc/init.d/sshd start

configure ssh

vi /etc/ssh/sshd_config
  • Type /PermitEmpty and Press Enter
  • Type /no and Press Enter
  • Type cw (change word)
  • Type yes
  • Press ESC
  • Type :wq to save and quit
/etc/init.d/sshd restart

configure networking

auto eth0  
iface eth0 inet dhcp

restart networking

/etc/init.d/networking restart

ensure changes take affect

ifconfigadduser deployssh deploy@localhost -p 2222

--

--

Andrew WC Brown
ExamPro

I have an unhealthy obsession with web-development.