Difference between revisions of "Install Alpine on coLinux"

From Alpine Linux
Jump to: navigation, search
(Created page with "Category:Virtualization == coLinux == This is a from-scratch instruction on how to install Alpine Linux under coLinux on Windows. [http://www.colinux.org/ coLinux] provide...")
 
(Remove Category:Installation)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Virtualization]]
+
== coLinux ==
  
== coLinux ==
+
[http://www.colinux.org/ coLinux] provides a virtualized Linux environment under Windows, much like Virtual Box or vmware. However there is much less overhead.
  
 
This is a from-scratch instruction on how to install Alpine Linux under coLinux on Windows.
 
This is a from-scratch instruction on how to install Alpine Linux under coLinux on Windows.
  
[http://www.colinux.org/ coLinux] provides a virtualized Linux environment under Windows, much like Virtual Box or vmware. However there is much less overhead.
+
== Preparation ==
  
 
Get the necessary files from [http://www.colinux.org/ colinux.org] - download latest version of coLinux installer.
 
Get the necessary files from [http://www.colinux.org/ colinux.org] - download latest version of coLinux installer.
Line 14: Line 14:
  
 
Copy Alpine Linux ISO e.g. ''alpine-mini-2.2.2-x86.iso'' to coLinux directory. We need also initrd image from CD, so extract ''grsec.gz'' (it's in ''boot'' directory) using 7-zip or other tool.
 
Copy Alpine Linux ISO e.g. ''alpine-mini-2.2.2-x86.iso'' to coLinux directory. We need also initrd image from CD, so extract ''grsec.gz'' (it's in ''boot'' directory) using 7-zip or other tool.
 +
 +
Right now we are messing few thing, mainly disk images. You can create them using ''fsutil''. Launch ''Command Prompt'', switch to coLinux directory, create ''alpine-root.fs'' and ''alpine-swap.fs''.
 +
 +
{{Cmd|fsutil file createnew alpine-root.fs 1610612736
 +
fsutil file createnew alpine-swap.fs 268435456}}
 +
 +
This will create 1.5GB image for root file system and 258MB file for swap. Values are in bytes, you can use [http://www.matisse.net/bitcalc/ bit calculator] to calculate different sizes.
  
 
== Configuration ==
 
== Configuration ==
Line 19: Line 26:
 
Now create some files. Start with ''alpine.bat'', which should look like this:
 
Now create some files. Start with ''alpine.bat'', which should look like this:
  
<pre>
+
{{Cmd|start colinux-daemon -t nt @alpine-bootstrap.conf}}
start colinux-daemon -t nt @alpine-bootstrap.conf
 
</pre>
 
  
 
Next one will be ''alpine-bootstrap.conf'' - our configuration file for coLinux. You can use this as skeleton:
 
Next one will be ''alpine-bootstrap.conf'' - our configuration file for coLinux. You can use this as skeleton:
Line 58: Line 63:
  
 
== Setup ==
 
== Setup ==
 
Right now we are messing few thing, mainly disk images. You can create them using ''fsutil''. Launch ''Command Prompt'', switch to coLinux directory, create ''alpine-root.fs'' and ''alpine-swap.fs''.
 
 
<pre>
 
fsutil file createnew alpine-root.fs 1610612736
 
fsutil file createnew alpine-swap.fs 268435456
 
</pre>
 
 
This will create 1.5GB image for root file system and 258MB file for swap. Values are in bites, you can use [http://www.matisse.net/bitcalc/ bit calculator] to calculate different sizes.
 
  
 
Now we're ready to launch Alpine coLinux for first time, use ''apline.bat'' for that. Alpine should load, login as root and start configuration.
 
Now we're ready to launch Alpine coLinux for first time, use ''apline.bat'' for that. Alpine should load, login as root and start configuration.
  
<pre>
+
{{Cmd|setup-alpine}}
setup-alpine
 
</pre>
 
  
 
Next we will create ext3 partition on ''alpine-root.fs'', we need ''e2fsprogs'' for that.
 
Next we will create ext3 partition on ''alpine-root.fs'', we need ''e2fsprogs'' for that.
  
<pre>
+
{{Cmd|apk add e2fsprogs
apk add e2fsprogs
 
 
mkfs.ext3 /dev/hda1
 
mkfs.ext3 /dev/hda1
apk del e2fsprogs
+
apk del e2fsprogs}}
</pre>
 
  
 
Mount newly created partition and start disk installation, switch off Alpine after installation.
 
Mount newly created partition and start disk installation, switch off Alpine after installation.
  
<pre>
+
{{Cmd|mount /dev/hda1 /mnt
mount /dev/hda1 /mnt
 
 
setup-disk /mnt
 
setup-disk /mnt
poweroff
+
poweroff}}
</pre>
 
  
 
== Fixes ==
 
== Fixes ==
Line 96: Line 86:
 
First thing you will notice is lack of console at boot time,  fix this:  
 
First thing you will notice is lack of console at boot time,  fix this:  
  
<pre>
+
{{Cmd|mount --bind / /mnt
mount --bind / /mnt
 
 
cd /mnt/dev
 
cd /mnt/dev
 
mknod -m 660 console c 5 1
 
mknod -m 660 console c 5 1
umount /mnt
+
umount /mnt}}
</pre>
 
  
 
Get rid of other boot warnings:
 
Get rid of other boot warnings:
  
<pre>
+
{{Cmd|vi /etc/mdev.conf
vi /etc/mdev.conf
+
''uncomment 1st console entry''
uncomment 1st console entry
+
''comment out 2nd console entry''
comment out 2nd console entry
 
  
 
vi /etc/sysctl.conf
 
vi /etc/sysctl.conf
del net.ipv4.tcp_syncookies
+
''del net.ipv4.tcp_syncookies''
  
 
vi /etc/modules
 
vi /etc/modules
remove everything
+
''remove everything''
  
 
vi /etc/apk/repositories
 
vi /etc/apk/repositories
del /media/hdc/apks
+
''del /media/hdc/apks''}}
</pre>
 
  
 
Create swap:
 
Create swap:
  
<pre>
+
{{Cmd|mkswap /dev/hda2
mkswap /dev/hda2
 
 
swapon /dev/hda2
 
swapon /dev/hda2
 
vi /etc/fstab
 
vi /etc/fstab
add /dev/hda2 swap swap default 0 0
+
''add /dev/hda2 swap swap default 0 0''}}
</pre>
 
  
 
Add swap service and remove acpid:
 
Add swap service and remove acpid:
  
<pre>
+
{{Cmd|rc-update add swap
rc-update add swap
+
rc-update del acpid}}
rc-update del acpid
 
</pre>
 
  
 
Copy kernel modules from cofs0:
 
Copy kernel modules from cofs0:
  
<pre>
+
{{Cmd|mount cofs0 -t cofs /mnt
mount cofs0 -t cofs /mnt
 
 
cd /
 
cd /
tar xzvf /mnt/vmlinux-modules.tar.gz
+
tar xzvf /mnt/vmlinux-modules.tar.gz}}
</pre>
 
  
 
Last step to enjoying Apline coLinux is simple:
 
Last step to enjoying Apline coLinux is simple:
  
<pre>
+
{{Cmd|reboot}}
reboot
+
 
</pre>
+
{{Tip|Alpine Linux is booting so fast, I had to add "''sleep 2''" to ''/etc/init.d/networking'' - coLinux didn't connect to TAP interface in time ;)}}
  
Alpine Linux is booting so fast, I had to add "''sleep 2''" to ''/etc/init.d/networking'' - coLinux didn't connect to TAP interface in time ;)
+
[[Category:Virtualization]]

Latest revision as of 19:40, 25 March 2012

coLinux

coLinux provides a virtualized Linux environment under Windows, much like Virtual Box or vmware. However there is much less overhead.

This is a from-scratch instruction on how to install Alpine Linux under coLinux on Windows.

Preparation

Get the necessary files from colinux.org - download latest version of coLinux installer.

Run the installer (just go through the installation). I installed everything to c:\Program Files\coLinux , and will refer to it as if you do it the same way.

Download the latest version of Alpine Linux: alpinelinux.org/downloads. I recommend mini edition. coLinux supports only 32-bit platform, so we don't have much choice - pick up x86 version.

Copy Alpine Linux ISO e.g. alpine-mini-2.2.2-x86.iso to coLinux directory. We need also initrd image from CD, so extract grsec.gz (it's in boot directory) using 7-zip or other tool.

Right now we are messing few thing, mainly disk images. You can create them using fsutil. Launch Command Prompt, switch to coLinux directory, create alpine-root.fs and alpine-swap.fs.

fsutil file createnew alpine-root.fs 1610612736 fsutil file createnew alpine-swap.fs 268435456

This will create 1.5GB image for root file system and 258MB file for swap. Values are in bytes, you can use bit calculator to calculate different sizes.

Configuration

Now create some files. Start with alpine.bat, which should look like this:

start colinux-daemon -t nt @alpine-bootstrap.conf

Next one will be alpine-bootstrap.conf - our configuration file for coLinux. You can use this as skeleton:

# Configuration to run Alpine Linux under coLinux

# Standard coLinux kernel
kernel=vmlinux

# Alpine Linux boot initrd file
# This option *MUST* be removed after Linux was installed to boot from hda1 !
initrd=grsec.gz
alpine_dev=hdc:iso9660

# Root file system (Empty file, 700MB...1GB)
hda1=alpine-root.fs
#root=/dev/hda1

# Swap file (Empty file, 64MB...256MB)
#hda2=alpine-swap.fs

# Downloaded ISO file (unchanged)
hdc=alpine-mini-2.2.2-x86.iso

# Windows directory with kernel modules
#cofs0=cofs0

# Optional settings (memory and network)
mem=256
eth0=tuntap,"coLinux"

# Terminal size
#cocon=140x60

Setup

Now we're ready to launch Alpine coLinux for first time, use apline.bat for that. Alpine should load, login as root and start configuration.

setup-alpine

Next we will create ext3 partition on alpine-root.fs, we need e2fsprogs for that.

apk add e2fsprogs mkfs.ext3 /dev/hda1 apk del e2fsprogs

Mount newly created partition and start disk installation, switch off Alpine after installation.

mount /dev/hda1 /mnt setup-disk /mnt poweroff

Fixes

Some fixes in alpine-bootstrap.conf are needed. Comment out ISO and initrd images. Uncomment root path, alpine-swap.fs and cofs0. Create folder cofs0 and copy there kernel modules from coLinux e.g. vmlinux-modules.tar.gz. Start Alpine coLinux once again.

First thing you will notice is lack of console at boot time, fix this:

mount --bind / /mnt cd /mnt/dev mknod -m 660 console c 5 1 umount /mnt

Get rid of other boot warnings:

vi /etc/mdev.conf uncomment 1st console entry comment out 2nd console entry vi /etc/sysctl.conf del net.ipv4.tcp_syncookies vi /etc/modules remove everything vi /etc/apk/repositories del /media/hdc/apks

Create swap:

mkswap /dev/hda2 swapon /dev/hda2 vi /etc/fstab add /dev/hda2 swap swap default 0 0

Add swap service and remove acpid:

rc-update add swap rc-update del acpid

Copy kernel modules from cofs0:

mount cofs0 -t cofs /mnt cd / tar xzvf /mnt/vmlinux-modules.tar.gz

Last step to enjoying Apline coLinux is simple:

reboot

Tip: Alpine Linux is booting so fast, I had to add "sleep 2" to /etc/init.d/networking - coLinux didn't connect to TAP interface in time ;)