COMP 3000 2011 Report: Alpine: Difference between revisions

From Soma-notes
Mevans (talk | contribs)
No edit summary
Mevans (talk | contribs)
No edit summary
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
='''Part 1'''=
== Background ==
== Background ==


[http://alpinelinux.org  Alpine Linux] is a free, small, and easy to install Linux distribution that began as a fork of the LEAF project (Linux Embedded Appliance Firewall). The main focus of this distribution is security, with features such as Pax and SSP, it prevents security hole exploitation. Alpine is designed for x86 Routers, VPNs, VoIP servers, and firewalls. This distribution is a unique blend of multiple others: the network configuration is like Debian's and the package management is similar to Debian's APT, RedHat's yum, and Arch Linux's PKGBUILDs (APKBUILD in Alpine). Its minuscule size is one of the main features of this distribution, this results in a size of around 5 MB instead of the traditional 100 MB of GNU/Linux (without the kernel).  
[[File:Alpinelogo.png | right]]
 
[http://alpinelinux.org  Alpine Linux] is a free, small, and easy to install Linux distribution that began as a fork of the LEAF project (Linux Embedded Appliance Firewall). The main focus of this distribution is security. It boasts features such as [http://en.wikipedia.org/wiki/PaX Pax] and [http://en.wikipedia.org/wiki/Stack-smashing_protection#GCC_Stack-Smashing_Protector_.28ProPolice.29 SSP](stack smashing protocol), it also prevents security hole exploitations. Alpine is designed for x86 Routers, VPNs (virtual private network), [http://en.wikipedia.org/wiki/Voice_over_IP VoIP] servers, and firewalls. This distribution is a unique blend of multiple distrobutions, the network configuration is like Debian's and the package management is similar to RedHat's yum, and Arch Linux's PKGBUILDs (APKBUILD in Alpine). Its minuscule size is one of the main features of this distribution, this results in an ISO size of around 51 MBs.
 
There are three different versions of Alpine available. The standard/stable release which has most common packages installed and is less prone to crashing or fatal errors. Alternatively there is the edge release, this is the latest release with the newest packages, unfortunately these releases are more likely to suffer errors. The final release is the mini version, this release only comes with basic packages, but it is stable and incredibly small.  


Alpine is available for free at [http://alpinelinux.org/downloads alpinelinux.org/downloads].
Alpine is available at [http://alpinelinux.org/downloads alpinelinux.org/downloads].
while the edge releases are available at http://nl.alpinelinux.org/alpine/edge/releases/x86/


== Installation ==
== Installation ==
Line 10: Line 17:


'''For a real instal'''
'''For a real instal'''
*Step 1: [http://alpinelinux.org/downloads] Download ISO.
*Step 1: [http://alpinelinux.org/downloads Download ISO].
*Step 2: Burn to a CD.
*Step 2: Burn to a CD.
*Step 3: Boot from CD, wait for an input prompt and login as root with no password.
*Step 3: Boot from CD, wait for an input prompt and login as root with no password.
*Step 4: Type setup-alpine, hit enter, and then follow the on screen instructions. Alternately refer to the next section for a walkthrough.
*Step 4: Wait for the system to boot, then type "setup-alpine", hit enter, and follow the on screen instructions. Refer to the next section for a walkthrough.


'''For a Virtual Machine instal'''
'''For a Virtual Machine instal'''
*Step 1: [http://alpinelinux.org/downloads] Download ISO.
*Step 1: [http://alpinelinux.org/downloads Download ISO].
*Step 2: Mount ISO onto a virtual drive.
*Step 2: Mount ISO onto a virtual drive.
*Step 3: Make a new Linux machine and boot from the virtual drive.
*Step 3: Make a new Linux machine and boot from the virtual drive.
*Step 4: Type setup-alpine, hit enter, and then follow the on screen instructions. Alternately refer to the next section for a walkthrough.
*Step 4: Wait for the system to boot, then type "setup-alpine", hit enter, and follow the on screen instructions. Refer to the next section for a walkthrough.


'''Detailed Setup Walkthrough'''
'''Detailed Setup Walkthrough'''
The first thing setup-alpine will ask you to do is to pick your keyboard layout. You have many choices, like US, Russian, and Japanese. To pick a US layout, simply type us. It will then ask which variant you want to use, us-acentos or us, type us. The next step is to pick the hostname (like 'foo' or 'system'), type whatever you want to name your system. Once a name has been chosen, a interface must be initialized, the only options are eth0 so just hit enter. After this comes more options, we will skip these for now and go with the default options by just hitting enter. Next a password must be chosen, enter in whatever you like, alpine will tell you how strong of a password it is, following this it will ask you to retype it to make sure you remember it. Now you must select a timezone, you can type ? for a list of available ones or just hit enter for the default. Finally, you must pick a mirror or type f to pick the fastest. Following this are more advanced options, we will just skip these by entering the default by hitting enter.
The first thing setup-alpine will ask you to do is to pick your keyboard layout like US, Russian, and Japanese. To pick a US layout, simply type "us". It will then ask which variant you want to use, us-acentos or us, type "us". The next step is to pick the hostname (like 'foo' or 'system'), type whatever you want to name your system. Once a name has been chosen, a interface must be initialized, the only option is eth0 so just hit enter. After pressing enter there are more options; the default settings can be selected by pressing enter. Next a password must be chosen, enter in whatever you like, after it will ask you to retype it to ensure you remember it. Now you must select a timezone, you can type "?" for a list of available ones or just hit enter for the default. Finally, you must pick a mirror or type "f" to pick the fastest. Following this there are more advanced options, we will just skip these by entering the default by hitting enter.
 


== Basic Operation ==
== Basic Operation ==


Many basic linux commands work similarly in alpine. For example "ps" will list the processes and "ls" followed by a file will list its contents. However the man pages are not installed by default due to their size, but these pages can be installed by typing "apk add man" followed by "apk add" the package you want "-doc". For example, if you wanted the man pages for iptables, you must simply type "apk add iptables-doc" and then you can access the iptables man page.
Many basic linux commands work in alpine. For example "ps" will list the processes and "ls" followed by a file will list its contents. However, the man pages are not installed by default due to their size. These pages can be installed by typing "apk add man" followed by "apk add" the package you want "-doc". For example, if you wanted the man pages for iptables, you must simply type "apk add iptables-doc" and then you can access the iptables man page.


Alpine Linux excels at servers, firewalls, and networks, none of which I have any experience with. Thankfully the website offers some tutorials (available at [http://wiki.alpinelinux.org/wiki/Tutorials_and_Howtos]) for a multitude of features. These features include, but are not limited to; hosting a mail server, setting up a satellite Internet connection, formatting a hard drive, and backing up flash memory.  
Alpine Linux excels at servers, firewalls, and networks, none of which I have any experience with. Thankfully the website offers some tutorials (available at http://wiki.alpinelinux.org/wiki/Tutorials_and_Howtos) for a multitude of features. These features include, but are not limited to; hosting a mail server, setting up a satellite Internet connection, formatting a hard drive, and backing up flash memory.  


== Usage Evaluation ==
== Usage Evaluation ==


Overall I found Alpine Linux to be a complicated yet interesting system. This is most likely due to my lack of networking and server knowledge. The system has no GUI, it is just a terminal, this is likely due to the desire to keep the file size down. In the end this is a interesting and, I assume, competent Linux distribution, although definitely not meant for people who are new to Linux.  
I found Alpine Linux to be a complicated, yet interesting system. This is most likely due to my lack of networking and server knowledge. The system has no GUI, it is just a terminal, this is likely due to the desire to keep the file size down. Overall this is a interesting and, I assume, competent Linux distribution, although definitely not meant for people who are new to Linux.
 
= '''Part 2''' =


==Software Packaging==


== '''Part 2''' ==
'''Packaging Format'''


'''packaging format'''
Software packages for Alpine Linux are tar.gz archives containing  
Software packages for Alpine Linux are tar.gz archives containing  
programs, files, and dependency. They have the extension .apk", also  
programs, files, and dependency. They have the extension .apk", also  
called "a-packs"
called "a-packs."


The packages are stored in one or more repositories(a directory with a  
The packages are stored in one or more repositories(a directory with a  
Line 48: Line 56:
'''Listing Packages'''
'''Listing Packages'''


To list all packages and their descriptions:
With Alpine Linux the method for listing all packages and their descriptions is to type
"apk search -v"
"apk search -v." This will give you a list of packages with their functions.


'''Adding Packages'''
'''Adding Packages'''


Use "add" to install packages and any required dependencies. If you have  
Packages can be added by using "add" to install packages and any required dependencies. If you have  
more than one repository, the add command installs the newest package.
more than one repository, the add command installs the newest package. Just type "apk add package-name" where package-name is the name of the package you would like to install.
 
"apk add openssh"  
"apk add openssh openntp vim"
 
'''Remove Packages'''


Use "del" to delete a package (and dependencies)
'''Removing Packages'''


"apk del openssh"  
Packages can be removed by using "del" to delete packages and its dependencies. Just type "apk del package-name" where package-name is the name of the package you would like to delete.
"apk del openssh openntp vim"


'''Catalog'''
'''Catalog'''
Line 72: Line 74:
37,000 total packages in Ubuntu.
37,000 total packages in Ubuntu.


'''Major Package Versions'''
==Major Package Versions==
 
kernel:
*definition: The kernel with grsecurity
*Version: 3.0.8
*web: http://grsecurity.net
*why: Because a kernel is required
 
libc:
*definitions: A library for c
*version: 0.9.32
*web: http://uclib.org
*why: Because a c library is required
 
Lua:
*definition: a powerful, lightweight programming language
*version: 5.1.4
*web: http://www.lua.org
*why: many programs on Alpine are dependent on it.
 
Fetchmail:
*definition: a remote mail retrieval and forwarding utility
*version: 6.3.21
*web: http://fetchmail.berlios.de
*why: to allow mail operations
 
Kamailio:
*definition: an open source SIP proxy
*version: 3.2.0
*web: http://kamailio.org
*why: enhanced security
 
Pearl:
*definition: Pearl (Practical Extraction and Report Language)
*version: 5.14.2
*web: http://www.pearl.org
*why: allows for pearl development
 
Samba:
*definition: Tools to access a server's filespace and printers
*version: 3.6.1
*web: http://samba.org
*why: helps for server manipulation
 
Shorewall:
*definition: a fire wall
*version: 4.2.10
*web: http://shorewall.net
*why: to enhance security


Squid:
{| border="1"
*definition: a full-featured web proxy cache server
|-
*version: 3.2.0.12
! Package
*web: http://www.squid-cache.org
! Definition
*why: enhance security
! Version
! Website
! Purpose
|-
| Kernel
| The kernel with grsecurity
| 3.0.8
| http://grsecurity.net
| A kernel is required
|-
| libc
| A library for c
| 0.9.32
| http://uclib.org
| A c library is required
|-
| Lua
| A powerful, lightweight programming language
| 5.1.4
| http://www.lua.org
| Many programs on Alpine are dependent on it.
|-
| Fetchmail
| A remote mail retrieval and forwarding utility
| 6.3.21
| http://fetchmail.berlios.de
| To allow mail operations
|-
| Kamailio
| An open source SIP proxy
| 3.2.0
| http://kamailio.org
| To enhance security
|-
| Pearl
| Pearl (Practical Extraction and Report Language)
| 5.14.2
| http://www.pearl.org
| Allows for pearl development
|-
| Samba
| Tools to access a server's filespace and printers
| 3.6.1
| http://samba.org
| Helps server manipulation
|-
| Shorewall
| A fire wall
| 4.2.10
| http://shorewall.net
| To enhance security
|-
| Squid
| A full-featured web proxy cache server
| 3.2.0.12
| http://www.squid-cache.org
| To enhance security
|-
| Util-Linux
| A collection of Linux utilities
| 2.20
| http://kernel.org/~kzak/util-linux/
| Allows for more versatility in Linux
|}


Util-Linux:
==Initialization==
*definition: a collection of Linux utilities
*version: 2.20
*web: http://kernel.org/~kzak/util-linux/
*why: allows for more versatility in Linux


'''Initialization'''
Every time the system starts, the package alpine-init runs. This package tells all the other packages when they are to initialize. The following is the load order the last time I booted the system.


On system start, the package alpine init is run, this tells all the other packages when to initialize. Then /proc is mounted followed by /run, after this it caches the service dependencies. The security and debug filesystems are mounted along with the modloop /media/cdrom/boot/grsec.modloop.squashfs. Then the hardware drivers and modules are loaded followed by mounting the local filesystems and configure the kernel parameters. Finally it starts the kernel logging and system logging.  
[[File:Alps.png| thumb | right| A typical initialization]]


(This is all printed out every time you reboot).
* /proc is mounted (if it is not already)
* /run is mounted so things may be run
* Server dependencies are cached
* Security filesystems are mounted
* Debug filesystems are mounted
* Busybox mdev is started
* Hardware drivers are loaded
* Modules are loaded
* System clock is set
* Local filesystem is checked for problems
* fsk is run on (busybox 1.19.2, 20011-11-03 15:50:21 UTC)
* Root filesystem read/write is remounted
* Local filesystem is mounted
* Busybox acpid is started
* Kernel parameters are configured
* User login records are created
* /var/run is cleaned
* /tmp directory is wiped
* Networking is started
* Chronyd is started
* Hostname is set
* Busybox kernel logging is started
* Busybox system logging is started
* Busybox cron is started
* Keymap is set
* Sshd is started
* Swap devices are activated
* And finally the random number generator is initialized


== References ==
== References ==


http://alpinelinux.org/
# Alpine Linux Homepage. Retrieved 2011, Dec. 15 http://alpinelinux.org/
# About Alpine Linux. Retrieved 2011, Dec. 15 http://alpinelinux.org/about
# Download Alpine Linux. Retrieved 2011, Dec 15 http://alpinelinux.org/downloads
# Download Alpine Linux Edge. Retrieved 2011, Dec 15 http://nl.alpinelinux.org/alpine/edge/releases/x86/
# VoIP information. Retrieved 2011, Dec 15 http://en.wikipedia.org/wiki/Voice_over_IP
# PaX information. Retrieved 2011, Dec 15 http://en.wikipedia.org/wiki/PaX
# SSP information. Retrieved 2011, Dec 15 http://en.wikipedia.org/wiki/Stack-smashing_protection#GCC_Stack-Smashing_Protector_.28ProPolice.29
# Tutorials for Alpine Linux. Retrieved 2011, Dec 15 http://wiki.alpinelinux.org/wiki/Tutorials_and_Howtos
# Tutorials for Alpine Linux - Cherokee. Retrieved 2011, Dec 15 http://wiki.alpinelinux.org/wiki/Cherokee

Latest revision as of 04:20, 19 December 2011

Part 1

Background

Alpine Linux is a free, small, and easy to install Linux distribution that began as a fork of the LEAF project (Linux Embedded Appliance Firewall). The main focus of this distribution is security. It boasts features such as Pax and SSP(stack smashing protocol), it also prevents security hole exploitations. Alpine is designed for x86 Routers, VPNs (virtual private network), VoIP servers, and firewalls. This distribution is a unique blend of multiple distrobutions, the network configuration is like Debian's and the package management is similar to RedHat's yum, and Arch Linux's PKGBUILDs (APKBUILD in Alpine). Its minuscule size is one of the main features of this distribution, this results in an ISO size of around 51 MBs.

There are three different versions of Alpine available. The standard/stable release which has most common packages installed and is less prone to crashing or fatal errors. Alternatively there is the edge release, this is the latest release with the newest packages, unfortunately these releases are more likely to suffer errors. The final release is the mini version, this release only comes with basic packages, but it is stable and incredibly small.

Alpine is available at alpinelinux.org/downloads. while the edge releases are available at http://nl.alpinelinux.org/alpine/edge/releases/x86/

Installation

One of the unique features of Alpine is its simplicity and ease of use. This is evident in its installation process which is as follows.

For a real instal

  • Step 1: Download ISO.
  • Step 2: Burn to a CD.
  • Step 3: Boot from CD, wait for an input prompt and login as root with no password.
  • Step 4: Wait for the system to boot, then type "setup-alpine", hit enter, and follow the on screen instructions. Refer to the next section for a walkthrough.

For a Virtual Machine instal

  • Step 1: Download ISO.
  • Step 2: Mount ISO onto a virtual drive.
  • Step 3: Make a new Linux machine and boot from the virtual drive.
  • Step 4: Wait for the system to boot, then type "setup-alpine", hit enter, and follow the on screen instructions. Refer to the next section for a walkthrough.

Detailed Setup Walkthrough The first thing setup-alpine will ask you to do is to pick your keyboard layout like US, Russian, and Japanese. To pick a US layout, simply type "us". It will then ask which variant you want to use, us-acentos or us, type "us". The next step is to pick the hostname (like 'foo' or 'system'), type whatever you want to name your system. Once a name has been chosen, a interface must be initialized, the only option is eth0 so just hit enter. After pressing enter there are more options; the default settings can be selected by pressing enter. Next a password must be chosen, enter in whatever you like, after it will ask you to retype it to ensure you remember it. Now you must select a timezone, you can type "?" for a list of available ones or just hit enter for the default. Finally, you must pick a mirror or type "f" to pick the fastest. Following this there are more advanced options, we will just skip these by entering the default by hitting enter.

Basic Operation

Many basic linux commands work in alpine. For example "ps" will list the processes and "ls" followed by a file will list its contents. However, the man pages are not installed by default due to their size. These pages can be installed by typing "apk add man" followed by "apk add" the package you want "-doc". For example, if you wanted the man pages for iptables, you must simply type "apk add iptables-doc" and then you can access the iptables man page.

Alpine Linux excels at servers, firewalls, and networks, none of which I have any experience with. Thankfully the website offers some tutorials (available at http://wiki.alpinelinux.org/wiki/Tutorials_and_Howtos) for a multitude of features. These features include, but are not limited to; hosting a mail server, setting up a satellite Internet connection, formatting a hard drive, and backing up flash memory.

Usage Evaluation

I found Alpine Linux to be a complicated, yet interesting system. This is most likely due to my lack of networking and server knowledge. The system has no GUI, it is just a terminal, this is likely due to the desire to keep the file size down. Overall this is a interesting and, I assume, competent Linux distribution, although definitely not meant for people who are new to Linux.

Part 2

Software Packaging

Packaging Format

Software packages for Alpine Linux are tar.gz archives containing programs, files, and dependency. They have the extension .apk", also called "a-packs."

The packages are stored in one or more repositories(a directory with a collection of *.apk files and an index file, named APKINDEX.tar.gz).

Listing Packages

With Alpine Linux the method for listing all packages and their descriptions is to type "apk search -v." This will give you a list of packages with their functions.

Adding Packages

Packages can be added by using "add" to install packages and any required dependencies. If you have more than one repository, the add command installs the newest package. Just type "apk add package-name" where package-name is the name of the package you would like to install.

Removing Packages

Packages can be removed by using "del" to delete packages and its dependencies. Just type "apk del package-name" where package-name is the name of the package you would like to delete.

Catalog

Due to Alpine Linux's small size and portable nature, it has fewer packages than most. There are 365 .apk files on disk, compared to the 37,000 total packages in Ubuntu.

Major Package Versions

Package Definition Version Website Purpose
Kernel The kernel with grsecurity 3.0.8 http://grsecurity.net A kernel is required
libc A library for c 0.9.32 http://uclib.org A c library is required
Lua A powerful, lightweight programming language 5.1.4 http://www.lua.org Many programs on Alpine are dependent on it.
Fetchmail A remote mail retrieval and forwarding utility 6.3.21 http://fetchmail.berlios.de To allow mail operations
Kamailio An open source SIP proxy 3.2.0 http://kamailio.org To enhance security
Pearl Pearl (Practical Extraction and Report Language) 5.14.2 http://www.pearl.org Allows for pearl development
Samba Tools to access a server's filespace and printers 3.6.1 http://samba.org Helps server manipulation
Shorewall A fire wall 4.2.10 http://shorewall.net To enhance security
Squid A full-featured web proxy cache server 3.2.0.12 http://www.squid-cache.org To enhance security
Util-Linux A collection of Linux utilities 2.20 http://kernel.org/~kzak/util-linux/ Allows for more versatility in Linux

Initialization

Every time the system starts, the package alpine-init runs. This package tells all the other packages when they are to initialize. The following is the load order the last time I booted the system.

A typical initialization
  • /proc is mounted (if it is not already)
  • /run is mounted so things may be run
  • Server dependencies are cached
  • Security filesystems are mounted
  • Debug filesystems are mounted
  • Busybox mdev is started
  • Hardware drivers are loaded
  • Modules are loaded
  • System clock is set
  • Local filesystem is checked for problems
  • fsk is run on (busybox 1.19.2, 20011-11-03 15:50:21 UTC)
  • Root filesystem read/write is remounted
  • Local filesystem is mounted
  • Busybox acpid is started
  • Kernel parameters are configured
  • User login records are created
  • /var/run is cleaned
  • /tmp directory is wiped
  • Networking is started
  • Chronyd is started
  • Hostname is set
  • Busybox kernel logging is started
  • Busybox system logging is started
  • Busybox cron is started
  • Keymap is set
  • Sshd is started
  • Swap devices are activated
  • And finally the random number generator is initialized

References

  1. Alpine Linux Homepage. Retrieved 2011, Dec. 15 http://alpinelinux.org/
  2. About Alpine Linux. Retrieved 2011, Dec. 15 http://alpinelinux.org/about
  3. Download Alpine Linux. Retrieved 2011, Dec 15 http://alpinelinux.org/downloads
  4. Download Alpine Linux Edge. Retrieved 2011, Dec 15 http://nl.alpinelinux.org/alpine/edge/releases/x86/
  5. VoIP information. Retrieved 2011, Dec 15 http://en.wikipedia.org/wiki/Voice_over_IP
  6. PaX information. Retrieved 2011, Dec 15 http://en.wikipedia.org/wiki/PaX
  7. SSP information. Retrieved 2011, Dec 15 http://en.wikipedia.org/wiki/Stack-smashing_protection#GCC_Stack-Smashing_Protector_.28ProPolice.29
  8. Tutorials for Alpine Linux. Retrieved 2011, Dec 15 http://wiki.alpinelinux.org/wiki/Tutorials_and_Howtos
  9. Tutorials for Alpine Linux - Cherokee. Retrieved 2011, Dec 15 http://wiki.alpinelinux.org/wiki/Cherokee