HostOnNet Blog

Alpine Linux – Tiny Linux Distribution

Looking for Linux Server Admin or WordPress Expert? We can help.

Alpine Linux is a tiny linux distribution based on busybox.

System details are

/ # cat /etc/*release
3.5.2
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.5.2
PRETTY_NAME="Alpine Linux v3.5"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org"
/ # uname -r
4.9.0-2-amd64
/ #

Total size of file system is 4.3 MB.

After running apk update, file system usage is 5.2 MB.

~ # du -h -d 1 /
0	/dev
8.0K	/root
4.0K	/mnt
4.0K	/home
216.0K	/sbin
0	/proc
4.0K	/run
2.6M	/lib
296.0K	/etc
212.0K	/usr
16.0K	/media
1.1M	/var
4.0K	/tmp
808.0K	/bin
4.0K	/srv
0	/sys
5.2M	/
~ # 

Installing Software

First you need to update software repository used by apk.

apk update

Example

~ # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz
v3.5.2-18-g781d2272fd [http://dl-cdn.alpinelinux.org/alpine/v3.5/main]
v3.5.2-14-gd7ba0e189f [http://dl-cdn.alpinelinux.org/alpine/v3.5/community]
OK: 7959 distinct packages available
~ # 

To install a package, run

apk add PKG-NAME

Example

~ # apk add nginx
(1/2) Installing pcre (8.39-r0)
(2/2) Installing nginx (1.10.3-r0)
Executing nginx-1.10.3-r0.pre-install
Executing busybox-1.25.1-r0.trigger
OK: 5 MiB in 13 packages
~ # 

There is /etc/init.d/nginx, but i can’t run it for some reason.

~ # /etc/init.d/nginx start
/bin/sh: /etc/init.d/nginx: not found
~ # ls -l /etc/init.d/nginx 
-rwxr-xr-x    1 root     root          1364 Mar  2 19:29 /etc/init.d/nginx
~ # 

Here is what i done to get nginx runnin

~ # nginx 
~ # nginx: [emerg] open() "/run/nginx/nginx.pid" failed (2: No such file or directory)

~ # mkdir /run/nginx
~ # nginx
~ # curl localhost
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
~ # 

Posted in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.