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.iso2. Create virtual qemu disk (use qcow2 format to reduce size of image)qemu-img create -f qcow2 ./linux-microcore-3.4.img 20M3. 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.iso4. 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.tcz5. Run cfdisk command to create partition on /dev/hdasudo sucfdisk /dev/hdaNow the Cfdisk Menu is opened. Use arrow keys and ENTER for navigate trough Menu
Navigate and select
NEW -> PrimaryLeave 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 systemmkfs.ext4 /dev/hda17. Rebuild fstab file
rebuildfstab8. Mount the new installed partitionedit /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 0Now re-mount content of /etc/fstab:
mount -avCheck if /dev/hda1 is mounted with df command:
df -hIf not try to mount it:
mount /mnt/hda19. Create directories /mnt/hda1/boot/grub/sudo mkdir -p /mnt/hda1/boot/grub/10. Mount CD with Microcore Live CDmount /mnt/hdc11. Copy content of /mnt/hdc/boot/ from CD to /mnt/hda1/boot/cp -p /mnt/hdc/boot/* /mnt/hda1/bootfiles bzImage, tinycore.gz and directory ./isolinux/ should be copied to /mnt/hda1/boot/ directory
12. Create tce directory for extensionsudo mkdir -p /mnt/hda1/tceChange 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.lstsudo 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.gz17. Run grubgrub Write these lines to grub prompt:
root (hd0,0)
setup (hd0)
quit18. Umount Live CD and rebootumout /dev/hdc
reboot19. Start qemu diskqemu -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 portIn 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 machineAssuming 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 -dNow, the full filesystem is extracted in /home/brezular/temp/extract/
[brezular@Fedora]$
lsbin 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 ttyS0Uncomment 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.gzmv /home/brezular/temp/microcore.gz /home/brezular/temp/1microcore.gz
cd /home/brezular/temp/extract/
find | sudo cpio -o -H newc | gzip -2 > ../microcore.gzg) Copy microcore.gz back to Linux MicrocoreOn 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,38400n821. Testing serial console connectionRun qemu image:
qemu -m 128 ./linux-microcore-3.4.img -serial telnet:0.0.0.0:3000,server,nowaitDuring the boot, use telnet to Microcore (From Fedora) with this command:
telnet localhost 3000You should see whole boot process on console. After boot hit enter and type
tc for box login.
22. Setting "tc" and "root" accountMicrocore comes with two users -
tc and
root. By default password for user
tc is not set.
Change superuser password to
rootsudo su
passwd root
Exit from superuser account:
exitKeep superuser's password being survived after next reboot:
echo "/etc/shadow" >> /opt/.filetool.lst
/usr/bin/filetool.sh -bUsername/password for superuser is
root/root for actual Microcore 3.4 Qemu image.
2. Basic extensions installation and configurationNote: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:80801. Add ipv6 support to microcorea) Load extension to add ipv6 support to microcoretce-load -iw ipv6-2.6.33.3-tinycore.tczb) Make loading of ipv6 module persistent and load the modulecho "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 installedls /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 opensshCheck if openssh extension is loaded during the boot of Microcore Linux:
cat /mnt/hda1/tce/onboot.lstAf there is not openssh in the list of extensions, add it:
echo "openssh.tcz" >> /mnt/hda1/tce/onboot.lstb) "Create" openssh config filesudo mv /usr/local/etc/ssh/sshd_config.example /usr/local/etc/ssh/sshd_configc) Start openssh daemonsudo /usr/local/etc/init.d/openssh startThe public/private rsa key pair and public/private dsa key are generated.
d) Start openssh deamon after each Microcore bootecho "/usr/local/etc/init.d/openssh start" >> /opt/bootlocal.she) Backup keys in ssh configuration directory "/usr/local/etc/ssh" echo "/usr/local/etc/ssh" >> /opt/.filetool.lst/usr/bin/filetool.sh - bf) Test ssh server (password is root)ssh root@localhost4. 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.shb) Configure terminals on which root is allowed to loginsudo vi /etc/securettypts/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 filesecho "/etc/securetty" >> /opt/.filetool.lstd) Save configuration/usr/bin/filetool.sh -b5. 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 beta2wget http://www.grid.unina.it/software/ITG/c ... -Beta2.zip .b) Unpack D-ITG-2.7.0-Beta2.zipunzip ./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 LinuxOn Microcore Linux:
tce-load -iw opensshscp -rv [email protected]:/home/brezular/D-ITG-2.7.0-Beta2 .d) Installation tools for compilingtce-load -iw compiletc.tcze) D-ITG compiling cd /home/tc/D-ITG-2.7.0-Beta2/src/
makeD-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 Linuxon 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 savingCheck if /home directory is saved (/opt/.filetool.lst)
cat /opt/.filetool.listIf yes, save contents of /home/ directory:
/usr/bin/filetool.sh -b6. 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.shmodprobe 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 -b3. Additional extensions installation and configuration1. Quagga routing daemon installation and configuration a) Quagga installation tce-load -iw quaggab) 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/zebraprivs_init: could not lookup user quagga
We need to to create user quagga:
sudo adduser quagga -H -D -s /bin/shCheck 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/zebravty_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 daemonssu
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 rebootecho "/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 -bf) Quagga operationEach 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 interfacesTransfer 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 -bNote systcl -a display all values
2.WPA supplicant installation and configurationa) 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.lstc) 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.shd) Save bootlocal.sh and .filetool.lst /usr/bin/filetool.sh -bEnd------------------------------------------------
Read more how to install Tinycore (Microcore + GUI) at:
http://tinycorelinux.com/install.htmlhttp://wiki.tinycorelinux.com/tiki-index.phpConsole part of this tutorial:
http://theanand.info/http://wiki.tinycorelinux.com/tiki-index.php?page=Remasteringhttp://www.vanemery.com/Linux/Serial/serial-console.htmlQuagga:
http://openmaniak.com/quagga_tutorial.phphttp://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/