Skip to content

Latest commit

 

History

History
83 lines (64 loc) · 4.04 KB

HowTo_Alpine_Linux.md

File metadata and controls

83 lines (64 loc) · 4.04 KB

Container "Alpine Linux"

Introduction

Alpine Linux is a very small Linux distribution based on musl libc and busybox. This container is thought for users, that want to build containers with very small footprint without compiling and building on their own. This solution is in between a full blown Debian container and a container built from scratch.

This document will describe how to install Alpine Linux within a container and will show some of the first steps in it.

Install and configure the container

Download the Alpine Linux container and store it on your PC.

  • Open a browser and enter the IP address "192.168.1.1" of web interface of the M3 device in default settings.
  • Click in menu "Administration" on the button "import container" to upload the stored container to the M3 device. The new container will appear in the list.
  • Click the wand icon to create a configuration for this container.
  • Click the pen icon to enter the configuration for the container.
  • Select the "IP net1" to which the containers Ethernet interface should be bridged
  • Enter a free IPv4 address, e.g. 192.168.1.3 and its net mask 24
  • Enter the IP address of the gateway
  • Click to "Save settings"
  • Click the blinking the gear icon to activate the profile

This will start a Alpine Linux in the new container.

Login to the container and configure networking

Alpine Linux will start an SSH server that can be used to login. Open a terminal or a putty and enter the configured IP address of the container:

joe@pc ~  $ ssh [email protected]

When using putty enter the IP address and click connect. The user name is "root", the password is also "root".

The first thing to do is to change the password of the user "root"! This container will behave like a real PC that nasty people want to enter and install their bot net client on it to use it for their nasty goals:

container1:~# passwd

The IP address and the optional default gateway have already been set by the configuration of the M3 device. What still is missing is the DNS server. Use the tiny editor "vi" to edit the file:

container1:~# vi /etc/resolv.conf

Press "i" to enter "edit mode" and change the IP address to the one of the correct gateway. Leave edit mode to store and exit the editor with the keys <ESC>:x (first <ESC> to return to command mode, then the ":" to introduce a command, finally "x" as the command to store and exit vi). Test if the container can reach its targets you can use the tool "ping" in the container:

container1:~# ping insys-icom.com

Install additional programs

Alpine Linux comes with a packet management tool called "apk". It should be updated:

container1:~# apk update

After that packages from a huge pool can be installed, for instance the web server "lighttpd":

container1:~# apk add lighttpd

Start the service:

container1:~# rc-service lighttpd start

Start the service automatically after the container starts:

container1:~# rc-update add lighttpd default

Create a small web page the web server can deliver:

container1:~# vi /var/www/localhost/htdocs/index.html

Create a little web site like this:

<html>
	<body>Hello world!</body>
</html>

This site should now be accessible with a web browser: http://192.168.1.3

The website of Alpine Linux offers a lot of additional useful documentation like Tutorials or FAQs