Install Alpine Linux In A Virtual Machine

ยท

2 min read

Install Alpine Linux In A Virtual Machine

Alpine Linux is super lightweight and its easy for developer who use Docker to generate their own images using alpine as base. but for me i wanted to run some stuff via cron and for which i was not interested to install Ubuntu as those are very resource hungry.

Installing Alpine OS

Step 1

Download any alpine linux alpinelinux.org/downloads - i used alpine server (extended)

Step 2

Create A VM With min config in FreeNAS

Step 3

Boot into VM With VNC / Serial in FreeNAS

Step 4

Login as root -- No Password Required

Step5

Type setup-alpine

  1. Select your keyboard layout. i used us and us-alt-intl
  2. Enter Custom Hostname if required
  3. Select The Network Port
  4. Select IP Type (DHCP / Static)
  5. Set ROOT Password
  6. Set Timezone
  7. Follow Any Other Instructions
  8. for download mirror use type f to auto select
  9. Install SSH Server if required
  10. Select The Disk you want to install in eg (sda) and set it to sys to install it
  11. Remove Install Media And Reboot

Thats it alpine OS is now installed in that VM.


Installing Docker In Alpine

Step 1

run apk add docker Docker package is available in the Community repository. Therefore, if apk add fails because of unjustifiable constraints error, you need to edit the /etc/apk/repositories file to add (or comment) a line. Community repository link: dl-cdn.alpinelinux.org/alpine/latest-stable...

Step 2

run apk update && apk add docker again if repositories file edited

Step 3

  • To start the Docker daemon at boot, run rc-update add docker boot
  • Then to start the Docker daemon manually run service docker start

Installing Docker Compose

Step 1

run apk add py-pip it will install Python & PIP

Step 2

Since docker-compose version 1.24.0, you also need some dev dependencies: apk add python-dev libffi-dev openssl-dev gcc libc-dev make

Step 3

Then install docker-compose, run: pip install docker-compose


๐Ÿ‘€ Wrapping Up

Do not hesitate to share your feedback

I am on Twitter varunsridharan2. Give a follow!

Follow me on Github varunsridharan, Don't miss my amazing projects! ๐Ÿ’ฏ

๐ŸŒŽ Lets connect