It is currently Tue Feb 07, 2012 5:23 pm


All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Microcore 3.4 LiveCD installation on Qemu image
PostPosted: Thu Jul 22, 2010 9:42 pm 
Offline

Joined: Mon Nov 10, 2008 10:31 am
Posts: 441
Location: Slovakia
Hi,

This is a How to install Microcore Linux on Qemu image. After reading this manual you should be able create your own Microcore Qemu image.

1) Microcore Linux Installation (console support included)

1. First of all you need to download current microcore image (live CD version 3.4)

wget http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/3.x/release/microcore-current.iso

2. Create virtual qemu disk (use qcow2 format to reduce size of image)

qemu-img create -f qcow2 ./linux-microcore-3.4.img 20M

3. Start qemu virtual disk "linux-microcore" with microcore-current.iso mounted to cdrom

qemu -no-acpi -boot d -hda linux-microcore-3.4.img -cdrom ./microcore-current.iso

4. Install "cfdisk.tcz" and "grub-0.97-splash.tcz" on qemu disk (image)

tce-load -wi cfdisk.tcz
tce-load -wi grub-0.97-splash.tcz


5. Run cfdisk command to create partition on /dev/hda

sudo su
cfdisk /dev/hda

Now the Cfdisk Menu is opened. Use arrow keys and ENTER for navigate trough Menu

Navigate and select NEW -> Primary

Leave default size 16.45 MB for partiton.

Select Bootable for new Primary partition.
Select Write - partiton will be written on disk
Select Quit - you leave cfdisk Menu

6. Format new partition for ext4 file system

mkfs.ext4 /dev/hda1

7. Rebuild fstab file

rebuildfstab


8. Mount the new installed partition

edit /etc/fstab and add this line to the end of file (in Microcore version 3.4 line is already added)

/dev/hda1/ /mnt/had1/ ext4 noauto,users,exec 0 0

Now re-mount content of /etc/fstab:

mount -av

Check if /dev/hda1 is mounted with df command:

df -h

If not try to mount it:

mount /mnt/hda1

9. Create directories /mnt/hda1/boot/grub/

sudo mkdir -p /mnt/hda1/boot/grub/

10. Mount CD with Microcore Live CD

mount /mnt/hdc

11. Copy content of /mnt/hdc/boot/ from CD to /mnt/hda1/boot/

cp -p /mnt/hdc/boot/* /mnt/hda1/boot

files bzImage, tinycore.gz and directory ./isolinux/ should be copied to /mnt/hda1/boot/ directory

12. Create tce directory for extension


sudo mkdir -p /mnt/hda1/tce

Change owner and group for ./tce directory

sudo chown tc /mnt/hda1/tce && sudo chgrp staff /mnt/hda1/tce/

13. Prepare file for backup and restore (create empty file mydata.tgz)


touch /mnt/hda1/tce/mydata.tgz

14. Check if directory /usr/lib/grub/ exist.


If not, reboot qemu image and run image with this command

qemu -no-acpi -boot d -hda linux-microcore.img -cdrom ./microcore-current.iso

Then you neeed install grub-0.97-splash again:

tce-load --wi grub-0.97-splash.tcz

15. Install grub

sudo cp -p /usr/lib/grub/i386-pc/* /mnt/hda1/boot/grub/

16. Create file /mnt/hda1/boot/grub/menu.lst

sudo vi /mnt/hda1/boot/grub/menu.lst

default 0
timeout 0
title microcore-3.4
kernel /boot/bzImage quiet console=ttyS0,38400n8
initrd /boot/microcore.gz


17. Run grub

grub

Write these lines to grub prompt:

root (hd0,0)
setup (hd0)
quit


18. Umount Live CD and reboot

umout /dev/hdc
reboot


19. Start qemu disk

qemu -no-acpi -boot c -hda ./linux-microcore-3.4.img

Your new image should boot now and you can configure Microcore for redirect output to serial port.

20. Remaster Microcore for output to serial port

In this step you need copy microcore.gz from Microcore to Linux machine (Fedora Linux in my case), extract it, make changes in /etc/inittab, pack extracted system back to microcore.gz and copy microcore.gz from Fedora back to Microcore.

a) Install openssh extension (you need scp for secure copying)

tce-load -wi openssh

b) Copy microcore.gz to Linux machine

Assuming SSH server is already running on Fedora Linux.

scp -rv /mnt/hda1/boot/microcore.gz [email protected]:/home/brezular/temp/

File microcore.gz is in /home/brezular/temp/ directory.

c) Extract microcore.gz to /home/brezular/temp/extract/

Create extract directory:

cd /home/brezular/temp
mkdir extract
cd ./extract/


zcat ../microcore.gz | sudo cpio -i -H newc -d


Now, the full filesystem is extracted in /home/brezular/temp/extract/

[brezular@Fedora]$ls
bin dev etc home init lib mnt opt proc root sbin sys tmp usr var

d) Configure /etc/inittab to support serial console logins (rungetty daemon will be listen on serial port ttyS0)

sudo vi ./etc/inittab

ttyS0::respawn:/sbin/rungetty ttyS0 --autologin tc

e) Edit /etc/securetty to allow user root login on serial port ttyS0

Uncomment the line #ttyS0
If you plan setup telnet server add pts/0, pts/, pts/2, pts3, pts4 terminas for root login.

sudo vi ./etc/securetty

ttyS0
pts/0
pts/1
pts/2
pts/3
pts/4

f) Pack filesystem to microcore.gz

mv /home/brezular/temp/microcore.gz /home/brezular/temp/1microcore.gz
cd /home/brezular/temp/extract/
find | sudo cpio -o -H newc | gzip -2 > ../microcore.gz


g) Copy microcore.gz back to Linux Microcore

On Microcore:

sudo scp -rv [email protected]:/home/brezular/temp/microcore.gz /mnt/hda1/boot/

h) Edit grub menu.lst file to redirect console output to serial ports ttyS0 (previously done in grub configuration step 16, check it only)

vi /mnt/hda1/boot/grub/menu.lst

kernel /boot/bzImage quiet console=ttyS0,38400n8


21. Testing serial console connection

Run qemu image:

qemu -m 128 ./linux-microcore-3.4.img -serial telnet:0.0.0.0:3000,server,nowait

During the boot, use telnet to Microcore (From Fedora) with this command:

telnet localhost 3000

You should see whole boot process on console. After boot hit enter and type tc for box login.

22. Setting "tc" and "root" account

Microcore comes with two users - tc and root. By default password for user tc is not set.

Change superuser password to root

sudo su
passwd root

Exit from superuser account:
exit

Keep superuser's password being survived after next reboot:

echo "/etc/shadow" >> /opt/.filetool.lst
/usr/bin/filetool.sh -b


Username/password for superuser is root/root for actual Microcore 3.4 Qemu image.

2. Basic extensions installation and configuration

Note:
If you get strange md5 checksum warning messages during installation of extension, there is problem either in tce repository (wrong MD5 checksum uploaded to repository) or you are probably of of HDD space for Micrococe Qemu image (not enough space for downloaded extension).

If you are behind the proxy server you need to configure Microcore for proxy first:
export http_proxy=http://192.168.1.1:8080

1. Add ipv6 support to microcore

a) Load extension to add ipv6 support to microcore

tce-load -iw ipv6-2.6.33.3-tinycore.tcz

b) Make loading of ipv6 module persistent and load the modul

echo "modprobe ipv6" >> /opt/bootlocal.sh
sudo /opt/bootlocal.sh
/usr/bin/filestool.sh -b

2. Adding iptables, tcpdump, iperf, iproute2 to Microcore

tce-load -wi iptables tcpdump iperf openssh iproute2

Note firewall-2.6.29.1-tinycore.tcz is called netfilter-2.6.33.3-tinycore.tcz in Microcore 3.4 and it is automatically installed during ipv6-2.6.33.3-tinycore.tcz installation (firewalling and IPv6 support)

3. SSH server configuration on Microcore

a) Check if openssh extension is installed

ls /mnt/hda1/tce/optional/openssh*
/mnt/hda1/tce/optional/openssh.tcz
/mnt/hda1/tce/optional/openssh.tcz.dep
/mnt/hda1/tce/optional/openssh.tcz.md5.txt

If can't see openssh.tcz install it:

tc-load -w openssh

Check if openssh extension is loaded during the boot of Microcore Linux:

cat /mnt/hda1/tce/onboot.lst

Af there is not openssh in the list of extensions, add it:

echo "openssh.tcz" >> /mnt/hda1/tce/onboot.lst

b) "Create" openssh config file

sudo mv /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_config

c) Start openssh daemon

sudo /usr/local/etc/init.d/openssh start

The public/private rsa key pair and public/private dsa key are generated.

d) Start openssh deamon after each Microcore boot

echo "/usr/local/etc/init.d/openssh start" >> /opt/bootlocal.sh

e) Backup keys in ssh configuration directory "/usr/local/etc/ssh"

echo "/usr/local/etc/ssh" >> /opt/.filetool.lst
/usr/bin/filetool.sh - b

f) Test ssh server (password is root)

ssh root@localhost

4. Telnet server configuration on Microcore

Note: Skip the steps b) and c) if you modified /etc/securetty for pts in part 20e) (Remastering Microcore)

a) Add telnet deamon to the list of running application after next boot

sudo /usr/sbin/telnetd
echo "/usr/sbin/telnetd" >> /opt/bootlocal.sh


b) Configure terminals on which root is allowed to login

sudo vi /etc/securetty

pts/0
pts/1
pts/2
pts/3
pts/4

This will allow up to 5 telnet sessions to the server with root account.

c) Make /etc/securetty being on the list of saved files

echo "/etc/securetty" >> /opt/.filetool.lst

d) Save configuration

/usr/bin/filetool.sh -b

5. D-ITG 2.0.7 beta2 installation on Microcore

To avoid md5 failures (ppl.tcz) during installation of compiletc.tcz extension for D-ITG compilation it is good to create new "temporary" Qemu Microcore image (step 2 and 3 of this tutorial) and compile and D-ITG binaries there. After that binaries can be copied to actual Microcore 3.4 Qemu image.

First download D-ITG-2.7.0-beta2.zip to Fedora Linux:

On Fedora Linux:

a) Download D-ITG 2.0.7 beta2

wget http://www.grid.unina.it/software/ITG/c ... -Beta2.zip .

b) Unpack D-ITG-2.7.0-Beta2.zip

unzip ./D-ITG-2.7.0-Beta2.zip
cd ./D-ITG-2.7.0-Beta2/; rm ./d-itg-manual.pdf

c) Copy ./D-ITG-2.7.0-Beta2/ directory on Fedora Linux to temporary Microcore Linux

On Microcore Linux:

tce-load -iw openssh

scp -rv [email protected]:/home/brezular/D-ITG-2.7.0-Beta2 .

d) Installation tools for compiling

tce-load -iw compiletc.tcz

e) D-ITG compiling

cd /home/tc/D-ITG-2.7.0-Beta2/src/
make


D-ITG binaries should be created in /home/tc/D-ITG-2.7.0-Beta2/bin/ directory

f) Copy D-ITG binaries from temporary Microcore to Microcore 3.4 via Fedora Linux

on Temporary Microcore:
scp -rv /home/tc/D-ITG-2.0.7-Beta2/bin/ [email protected]:/home/brezular/

on Microcore 3.4:

scp -rv [email protected]:/home/brezular/bin/ /home/tc/

g) Final saving

Check if /home directory is saved (/opt/.filetool.lst)

cat /opt/.filetool.list

If yes, save contents of /home/ directory:

/usr/bin/filetool.sh -b

6. Creating script for using dhclient

Udhcpc in Microcore is as dhclient in other Linux distribution. Unfortunately dhclient is not included in Microcore. This script calls udhcpc when command dhclient is invoked.

sudo su
echo "udhcpc" > /sbin/dhclient
chmod 744 /sbin/dhclient
echo "/sbin/dhclient" >> /opt/.filetool.lst
/usr/bin/filetool.sh -b

7. Load basic iptables modules to Microcore

vi /opt/bootlocal.sh
modprobe iptable_mangle
modprobe iptable_nat
modprobe ipt_limit
modprobe ipt_multiport
modprobe ipt_tos
modprobe ipt_TOS
modprobe ipt_REJECT
modprobe ipt_TCPMSS
modprobe ipt_tcpmss
modprobe ipt_ttl
modprobe ipt_LOG
modprobe ipt_length
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
modprobe ipt_conntrack
modprobe ipt_state
modprobe ipt_helper
modprobe ip_nat_ftp
modprobe ip_nat_irc

/usr/bin/filetool.sh -b

3. Additional extensions installation and configuration

1. Quagga routing daemon installation and configuration

a) Quagga installation

tce-load -iw quagga

b) Check if Quagga is included in the list of after boot running extensions

cat /mnt/hda1/tce/onboot.lst | grep quagga
quagga.tcz

c) Run Zebra - kernel routing manager
/usr/local/sbin/zebra
privs_init: could not lookup user quagga

We need to to create user quagga:

sudo adduser quagga -H -D -s /bin/sh

Check if the user quagga is created and get the information about the user:

cat /etc/passwd
quagga:x:1000:1000:Linux User,,,:/home/quagga:/bin/sh

User quagga (ID 1000) is member of group quagga (ID 1000), without password and home directory. The preferred shell is Bourne shell for this user.
Invoke zebra the second time:

sudo /usr/local/sbin/zebra
vty_read_config: failed to open configuration file /usr/local/etc/zebra.conf : No such file or directory

d) Creating minimal configuration file for zebra and other daemons

su
echo "password zebra" > /usr/local/etc/zebra.conf
echo "password zebra" > /usr/local/etc/ripd.conf
echo "password zebra" > /usr/local/etc/ospfd.conf
echo "password zebra" > /usr/local/etc/bgpd.conf

e) Make Zebra and routing protocols running after Microcore reboot

echo "/usr/local/sbin/zebra -u root -d" >> /opt/bootlocal.sh
echo "/usr/local/sbin/ripd -u root -d" >> /opt/bootlocal.sh
echo "/usr/local/sbin/ospfd -u root -d" >> /opt/bootlocal.sh
echo "/usr/local/sbin/bgpd -u root -d" >> /opt/bootlocal.sh

echo "/usr/local/etc/" >> /opt/.filetool.lst
echo "/etc/group" >> /opt/.filetool.lst
echo "/etc/passwd" >> /opt/.filetool.lst
echo "/etc/shadow" >> /opt/.filetool.lst
/usr/bin/filetool.sh -b


f) Quagga operation

Each deamon listens on separate ports:

zebrasrv.....2600/tcp--------# zebra service
zebra.........2601/tcp--------# zebra vty
ripd...........2602/tcp-------# RIPd vty
ripngd........2603/tcp--------# RIPngd vty
ospfd.........2604/tcp--------# OSPFd vty
bgpd..........2605/tcp--------# BGPd vty
ospf6d........2606/tcp--------# OSPF6d vty
ospfapi.......2607/tcp--------# ospfapi
isisd...........2608/tcp-------# ISISd vty

For access to deamon, enter command telnet and the port of deamon:

telnet localhost 2601

Note: You have to call command /usr/bin/filetool.sh -b to keep changes in deamon configuration file after next Microcore reboot.
IPv6 routing deamon (ripngd, ospf6d) and isis are not running (quagga.tcz is not compiled for using them)

g) Enable ipv4 and ipv6 packets forwarding between interfaces

Transfer between network interfaces is disabled by default. To activate ipv4 and ipv6 forwarding you need to do:

sudo su
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.all.forwarding = 1" >> /etc/sysctl.conf
exit
echo "/etc/sysctl.conf" >> /opt.filetool.lst
echo "sysctl -p /etc/sysctl.conf" >> /opt/bootlocal.sh

/usr/bin/filetool.sh -b


Note systcl -a display all values

2.WPA supplicant installation and configuration

a) Wpa_supplicant.conf doesn’t exist so we must create it

vi /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ap_scan=0
network={
key_mgmt=IEEE8021X
eap=MD5
identity=”CiscoClient”
password=”cisco”
eapol_flags=0
}

This configuration works for EAP-MD5 authentication. If switchport is configured for dot1x port-control auto before the switch allows dot1x client (Microcore) access to the network client needs to be authenticated with username CiscoClient and password cisco on Radius server.
If switchport switchport is configured with dot1x port-control force-authorized or dot1x is not globally configured on switch, Microcore is always allow access to network.

b) Make file /etc/wpa_supplicant.conf to be saved

echo”/etc/wpa_supplicant.conf” >> /opt/.filetool.lst

c) Start wpa_supplicant for wired ethernet eth0 and let it be loaded during startup

echo “wpa_supplicant -ieth0 -Dwired -c /etc/wpa_supplicant.conf” >> /opt/bootlocal.sh

d) Save bootlocal.sh and .filetool.lst

/usr/bin/filetool.sh -b


End

------------------------------------------------

Read more how to install Tinycore (Microcore + GUI) at:
http://tinycorelinux.com/install.html
http://wiki.tinycorelinux.com/tiki-index.php

Console part of this tutorial:
http://theanand.info/
http://wiki.tinycorelinux.com/tiki-index.php?page=Remastering
http://www.vanemery.com/Linux/Serial/serial-console.html

Quagga:
http://openmaniak.com/quagga_tutorial.php
http://www.quagga.net/

Wpa_supplicant:
http://brezular.wordpress.com/2010/12/18/ccnp-switch-and-gns3-%E2%80%93-part-2-2-freeradius-and-wpa-supplicant-installation-and-configuration/





_________________
Brezular

http://brezular.wordpress.com


Top
 Profile  
 
 Post subject: Re: Microcore Live CD installation on Qemu image
PostPosted: Thu Jul 22, 2010 11:25 pm 
brezular wrote:
Hi,
19. Test qemu disk
qemu ./linux-microcore.img
Your new image should boot now and you can start load extensions (programs)
Cheers,

Thanks for this...i manage to get the installation working. One question regarding step 19.
Should this be qemu -m 48 ./linux-microcore.img

Thanks


Top
  
 
 Post subject: Re: Microcore Live CD installation on Qemu image
PostPosted: Thu Jul 22, 2010 11:46 pm 
Offline

Joined: Mon Nov 10, 2008 10:31 am
Posts: 441
Location: Slovakia
Hi,
Quote:
Should this be qemu -m 48 ./linux-microcore.img


you can specify how much memory your image takes with -m parameter (48MB).

If "m" is missing qemu runs image with default value (125MB). You can check it with "free" command in Microcore.

Cheers,

_________________
Brezular

http://brezular.wordpress.com


Top
 Profile  
 
 Post subject: Re: Microcore 3.4 LiveCD installation on Qemu image
PostPosted: Thu Dec 23, 2010 10:05 pm 
Offline
Site Admin

Joined: Sat Oct 11, 2008 1:41 pm
Posts: 798
Microcore 3.4 and Tinycore 3.4 qemu images, thanks to Brezular, are available to download from http://gns3.net/download

Cheers,

_________________
Jeremy
GNS3 Staff


Top
 Profile  
 
 Post subject: Re: Microcore 3.4 LiveCD installation on Qemu image
PostPosted: Mon Dec 27, 2010 6:25 pm 
Offline

Joined: Thu Jun 24, 2010 3:58 pm
Posts: 263
Location: [email protected]
Haha, great job brezular!!!
Thanks a lot for this awesome tutorial...

PS: Again for iptables modules and dhclient :)) (I saw that you played a lot in /home/tc/.ash_history)


Top
 Profile  
 
 Post subject: Re: Microcore 3.4 LiveCD installation on Qemu image
PostPosted: Tue Dec 28, 2010 12:18 pm 
Offline

Joined: Mon Nov 10, 2008 10:31 am
Posts: 441
Location: Slovakia
Quote:
(I saw that you played a lot in /home/tc/.ash_history)


Now you know all my secrets. I am going to help Jeremy to kill you ;-)

_________________
Brezular

http://brezular.wordpress.com


Top
 Profile  
 
 Post subject: Re: Microcore 3.4 LiveCD installation on Qemu image
PostPosted: Tue Dec 28, 2010 8:53 pm 
Offline

Joined: Thu Jun 24, 2010 3:58 pm
Posts: 263
Location: [email protected]
Brezular here is your hand ;)) (I'm becoming green)
So, this is the way you want to kill me :))


Top
 Profile  
 
 Post subject: Re: Microcore 3.4 LiveCD installation on Qemu image
PostPosted: Tue Dec 28, 2010 9:51 pm 
Offline
Site Admin

Joined: Sat Oct 11, 2008 1:41 pm
Posts: 798
No, this is my way :)

You are a moderator now, welcome on board ;)

_________________
Jeremy
GNS3 Staff


Top
 Profile  
 
 Post subject: Re: Microcore 3.4 LiveCD installation on Qemu image
PostPosted: Tue Dec 28, 2010 9:56 pm 
Offline

Joined: Thu Jun 24, 2010 3:58 pm
Posts: 263
Location: [email protected]
Thank you very much!!!
I really appreciate this ;))

---edit---
After a promotion I deserve a little vacation!
So, with God willing I'll see you next year ;))
Happy new year to anyone (including GNS3) !!!






Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO