Fedora8MinimalChroot
From coLinux
<msonsuz> Fedora 8 is released. A new page is needed. If you can improve please do.
Contents |
[edit] Extra information
Because I use mingw cygwin colinux qemu etc. I made a folder in my c drive called Linux and which has subfolders for each distribution.
c:\Linux - Colinux - Cygwin - Distro (the folder with image files for colinux/qemu/distribtion iso's) - Mingw - Qemu ...
[edit] Link
TOOLS
- explore2fs To be able to copy your files from image in Windows. One way.
- unxutils like dd ls
- winpcap driver for winpcap
WEBSITES
- colinux official site
- colinux wikipedia
- development and stable binaries website of henry nestler
- colinux mailing list to search for known problems
[edit] Qemu to make an minimal install image
There is no (easy) way to install Fedora Core from a DVD image to a file using colinux. So I needed an emulator which had a gui, could be easily used without doing too much work, and where you could convert the file into colinux image. In the article Converting Distributions there is an example how to convert a qemu image to colinux image. For this reasons I use qemu to make an installation.
PREPARATION
- Download Fedora Core 8 image from Fedora and put in Distro folder (C:\Linux\Distro)
- Download Qemu from most recent windows port here is official site
- To speed things up you can install Kqemu-1.3.0pre11 installer
- Extract qemu zipfile from windows port to c:\Linux\Qemu
- Go to the command prompt (Windows XP => Start / Run / CMD)
- make a image to install fedora core (minimal 700MB) in dos by typing (2gb would be 1024*1024*1024*2 + 63*512)
fsutil file createnew c:\Linux\Distro\qemu_fc8_min_2gb 2147515904
- make a image for a 512mb swap file in dos by typing (512mb would be 1024*1024*512 + 63*512)
fsutil file createnew c:\Linux\Distro\qemu_swap_512mb 536903168
- Open notepad, create next batchfile, change settings like qemu_dir and name of iso file and save it (C:\Linux\Qemu\start_installation.bat)
@ECHO OFF set qemu_dir=C:\Linux\Distro set hd=%qemu_dir%\qemu_fc8_min_2gb set swap=%qemu_dir%\qemu_swap_512mb set cdrom=%qemu_dir%\FC-8_i386.ISO set mem=256 qemu -hda %hd% -hdb %swap% -cdrom %cdrom% -m %mem% -boot d -L . pause
- start up start_installation.bat and install fedora core with the second drive a swap drive
INSTALLATION
For the installation I recommend the following steps. I use text modus where you use tab,space, arrows and enter to choose options and this steps explains text modus. With ctrl+tab you can get out the window.
- first screen will ask in what modem you want to startup. To make the installation go faster you can choose the (text mode)
- and press enter (if you want to install in gui mode with mouse just choose first option)
- you can skip dvd testing if you want to
- press yes when asked to erase all data for hda and hdb
- choose create custom layout and press ok
- choose free space under /dev/sda press new and choose following options
Mount point / File System type ext3 Allowable drives only sda1 Fill all available space selected
- choose free space under /dev/sdb press new and choose following options
mount point will become <Not Applicable> if you change the File System type to swap File system Type swap Allowable drives only hdb selected Fill all available space selected
- If done correctly you will see
Devices Start End Size Type Mount point /dev/sda sda1 1 261 2047M ext3 / /dev/sdb sdb1 1 65 509M swap
- For Bootloader configuration choose Use Grub Bootloader
- When asked where to install the boot loader choose /dev/sda1 First sector of boot partition
- When you get to Package Selection Disable the 3 options and enable Customize software selection and press OK
- In Package Group Selection disable everything.
- Fedora will check dependencies (will take a long time (10 minutes) so go get some herbal tea or whatever).
- Press OK and the installation will start. (took me 20 minutes so get some more tea)
- When done installing press Reboot and close Qemu.
- Remove KQemu from Start=>Control panel=>Software.
CONVERTING TO COLINUX
I found this on one of the wikipages.
- download and install unxutils I found a link here
- go to the command prompt (Windows XP => Start / Run / CMD)
- go to your distro folder
cd \Linux\Distro
- convert qemu fedora core image to colinux image
dd if=qemu_fc8_min_2gb of=fc8_min_2gb.img bs=512 skip=63
- you only need the file fc8_min_2gb.img the other 2 files (qemu_swap_512mb and qemu_fc8_min_2gb) can be removed (you could also save it for temp backup)
[edit] install colinux and make image bootable
TO KNOW
I use an extra image disk which I use between different distributions as a second disk.
With Fedora Core 5 I had a problem with udev and hotplugin which gave problems with ssh etc. This was because the udev version did not support the older colinux kernel so I solved it by downloading and installing manually an older version. Thanks to Aguspiza which made a comment about using an older version of the colinux kernel, which was correct. Now I use the most recent version which is version 0.8.0 with kernel 2.6.22 and has Kernel with hotplug enabled (for udev). Before you start please check if there is a newer version of the colinux kernel at the testing folder of henry nestler.
There are 2 types of network connections: TAP connection and a bridged connection(WinPCap). I normally use tap but now will use them both to show examples. For more information look at Network
TAP driver creates an TAPconnection with an icon in Networkconnections. When you setup you networkcard using TAP connection goes through this TAP. This means you can only reach this connection from the host PC and not from another one. If you want to connect the internet using colinux you just make a shared connection from you internet connection (wlan or lan card) to the TAPconnection.
Bridged connection is a shared connection with the network card (lan or wlan). The colinux machine is visible from outside the host PC. Colinux will also have another IP adress as the host PC. It is like two machines using the same card are connection to the internet. Both machines will ask for an IP adress and for example the router will give both a different IP. I had a problem using my WLAN card with bridged because of a disabled option in an older kernel. With LAN it did work. Did not try it with the newer kernel.
INSTALLATION AND PREPARATION
When you have downloaded the newest version of colinux start installing it. I use normally the options Native Windows Linux Console, colinux Virtual Ethernet Driver (TAP-Win32) and colinux Bridged Ethernet (WinPCap). If you want to use WinPCap please install the winPcap driver. When asked for a folder I use C:\Linux\Colinux.
- Create an extra image 1gb file by using the following command in the dosprompt (windows XP):
fsutil file createnew c:\Linux\Distro\ext3_disk_1gb.img 1073741824
- Create a swap image 512 mb because I will use 256 mb memory by using the following command in the dosprompt (windows XP):
fsutil file createnew c:\Linux\Distro\swap_512mb 536870912
- Use noexecute to set the correct options. IF NOT DONE CORRECT PC WILL HANG AND YOU HAVE TO RESTART.
- Go to Control Panel=>Network connections
- Rename the LAN connection to LAN and the TAP connection to TAP.
- right click on LAN connection and press properties
- go to tab advanced, enable Allow other users to connect through this computer's internet connection and choose if applicable TAP
- give the TAP connection a static IP 10.0.0.10 and subnetmask 255.255.255.0
- Create a colinux.conf file in the Distro folder for example C:\Linux\Distro\colinux_fc8_minimal.conf:
############################################ # MAKE SURE THERE IS AN EXTRA LINE AT THE END # OF THE BATCH FILE # # initrd should only be used at first start # to install kernel modules for example when # you upgrade your colinux ############################################ ############################################ # DEFAULT ############################################ # set your runlevel to text-only mode or graphical mode # root=/dev/hda1 fastboot 1 (single-user mode) # root=/dev/hda1 fastboot 3 (text-only mode) # root=/dev/hda1 fastboot 5 (graphic mode) ############################################ kernel=vmlinux initrd=initrd.gz mem=256 root=/dev/sda1 fastboot 5 ############################################ # Drives ############################################ #cobd0=C:\Linux\Distro\image #hda1=:cobd0 ############################################ sda1=\DosDevices\C:\Linux\Distro\fc8_min_2gb.img sda2=\DosDevices\C:\Linux\Distro\ext3_disk_1gb.img sdb1=\DosDevices\C:\Linux\Distro\swap_512mb ############################################ # Ethernet ############################################ #eth0=slirp,00:ff:00:00:00:00 #eth0=pcap-bridge,"LAN", 00:ff:00:00:00:00 #eth0=tuntap,TAP,00:ff:00:00:00:00 ############################################ eth0=tuntap,"TAP",00:ff:00:00:00:00 eth1=pcap-bridge,"LAN",00:ff:00:00:00:01 # please leave this as last line. Otherwise last of macadress goes as input for boot
- Create a batch file in the colinux folder for example C:\Linux\Colinux\start_fc8_minimal.bat:
@echo off colinux-daemon.exe --install-driver colinux-daemon.exe @"c:\Linux\Distro\colinux_fc8_minimal.conf" -t nt colinux-daemon.exe --remove-driver pause
- start the batchfile start_fc8_minimal.bat so colinux starts(If it does not start it will give an error message. Maybe you typed something wrong).
- login with your username and pass
- format swap
mkswap -c -v1 -L SWAP /dev/sdb1
- format extra image to ext3
mkfs -t ext3 /dev/sda2
- edit /etc/fstab
# this is what I changed mine fstab to /dev/sda1 / ext3 defaults 1 1 /dev/sda2 /mnt ext3 defaults 1 1 devpts /dev/pts devpts gid=5,mod=620 0 0 tmpfs /dev/shm tmpfs defaults 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 /dev/sdb1 swap swap defaults 0 0
NETWORKING
setup eth0
- edit /etc/sysconfig/network-scripts/ifcfg-eth0
# File: /etc/sysconfig/network-script/ifcfg-eth0 DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=10.0.0.100 NETMASK=255.255.255.0 GATEWAY=10.0.0.10 #HWADDR=00:ff:00:00:00:00
- Now you can from windows ssh your colinux using 10.0.0.100
setup eth1
- edit /etc/sysconfig/network-scripts/ifcfg-eth1 if it not exists make one
# File: /etc/sysconfig/network-script/ifcfg-eth1 DEVICE=eth1 ONBOOT=no BOOTPROTO=dhcp #HWADDR=00:ff:00:00:00:01
When you start colinux it will start the eth1 by using command ifup eth1 and will get an IP adress from the router where the LAN adapter gets his ip-adress. It will be a different IP-adress. With ifconfig eth1 you can find out the IP adress and ssh it from another pc.
DNS
- to use a dns server edit /etc/resolv.conf
nameserver 111.111.111.111
UPDATE WITH YUM/SMART
Normally I use yum because it is given as default. Aguspiza gave as alternative Smart. I looked at is and it has its advantages, most important speedup. After Fedora 7 Yum has improved in speed, so I am leaving out Smart. For smart see Fedora 6.
YUM
- gui version for in x-windows
yum install pirut
- update existing installation
yum update
- after update clean temp files
yum clean all
- if you want to change settings for the repository go to /etc/yum.repos.d/
- to install something
yum install package
[edit] making it colinux proof
When booting you get some failures. Here you can find the solutions.
error: setting default font (latarcyrheb-sun16): putfont: PIO_FONT: Function not implemented
- Rename the program /bin/setfont to /bin/setfont.old
mv /bin/setfont /bin/setfont.old
- Create a new script file /bin/setfont with condition for coLinux
#!/bin/bash if ! uname -r | grep -q -e "-co-" then /bin/setfont.old $@ fi
- and make it executable
chmod +x /bin/setfont
error: hwclock is unable to get I/O port access: the iopl(3) call failed.
- coLinux don't allow hwclock. Edit file /etc/rc.d/rc.sysinit, locate the line with hwclock and add a condition for colinux:
before
[-x /sbin/hwclock ] && /sbin/hwclock $CLOCKFLAGS
after
if ! uname -r | grep -q -e "-co-" then [-x /sbin/hwclock ] && /sbin/hwclock $CLOCKFLAGS fi
- Edit file /etc/rc.d/init.d/halt, locate the line with hwclock and write a condition for colinux:
before
[-x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS
after
if ! uname -r | grep -q -e "-co-" then [-x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS fi
[edit] compress image file smallest possible
Ok after you've done all this you could start to make a rar file so you can if you do something wrong just unpack the rar file and you start all over. (found at the mail list). It can become big because the empty space is not really zero so your compressor makes the file big. What you do is you make a file which has null characters that is as big as the empty space and remove the file
- start with another image file and set the image you want to compress in the xml conf file in this example sda2
- mount the image into /mnt
mount /mnt /dev/sda2
- remove colinux modules
rm -rf /mnt/lib/modules/*-co-*
- remove wtmp
rm -f /mnt/var/log/wtmp
- remove all from tmp
rm -rf /mnt/tmp/*
- clean apt get
rm -rf /mnt/src/var/state/apt/lists/ayo.freshrpms.* rm -rf /mnt/src/var/cache/apt/*.bin
- or clean yum
chroot /mnt yum clean all exit
- get the number of available space in mb
chroot /mnt
df -m
#Filesystem 1M-blocks Used Available Use% Mounted on
#/dev/sda2 1984 750 1132M 40% /mnt
exit
- make a file filled with zero which is almost as big as the empty space in hda2. For count do the available size of sda2 minus 2
dd if=/dev/zero of=/mnt/foobar bs=1M count=1130
- remove the zero file
rm /mnt/foobar
- clean /mnt/root/.bash_history
- Unmount the image from /mnt
umount /mnt
- change mountcount etc
tune2fs -c 0 /dev/sda2 tune2fs -T 20090101 /dev/sda2
If you compress it now, it will become much smaller.
[edit] VNC (external Xwindows) login
You do not have to start Fedora 8 in GUI mode (colinux.conf file runlevel 5) For the VNC client I use RealVNC and for Desktop Environment I use KDE. (but you can use your own like winx-32 tightvnc and GNOME).
Another usefull link
- startup eth1 or have eth0 in shared mode
ifup eth1
- get xwindows
- get minimal kde
yum install kdebase
- or get full kde
yum groupinstall "KDE (K Desktop Environment)"
- or get full GNOME (with setup xdmcp you are for now on your own/Maybe somebody could add to this)
yum groupinstall "GNOME Desktop Environment"
- In Fedora 8 the fonts are not installed automatically using dependencies.
yum install xorg-x11-fonts-Type1
- install the vnc server
yum install vnc-server
- first time create password and files
vncserver
- edit in your home dir /home/user/.vnc/xstartup or root dir /root/.vnc/xstartup to let automatically start KDE otherwise you will get gray screen
before
#!/bin/sh # Uncomment the following two lines for normal desktop: # unset SESSION_MANAGER # exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & twm &
after
#!/bin/sh # Uncomment the following two lines for normal desktop: # unset SESSION_MANAGER # exec /etc/X11/xinit/xinitrc #[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup #[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources #xsetroot -solid grey #vncconfig -iconic & #xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #twm & startkde & #gnome-session & #startxfce4 &
SETUP FIREWALL VNC SERVER
Each VNC server instance listens on port 5900 plus the display number on which the server runs. For example: Display 1 5901 Display 2 5902 etc.
- start firewall configure tool
system-config-firewall-tui
- in Customize->Other ports use the correct portnumber.For the automatic startup I use display 1 which uses port 5901
5901:tcp
- restart xwindows
shutdown -r now
STARTUP VNC SERVER AUTOMATICALLY
- edit in /etc/sysconfig/vncservers
before
#VNCSERVERS="2:myusername" #VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
after, use your own username instead of root
#VNCSERVERS="2:myusername" #VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost" VNCSERVERS="1:root" VNCSERVERARGS[1]="-geometry 1024x768"
- make the VNC server start on boot
chkconfig vncserver on
- restart colinux
shutdown -r now
- now you can reach your VNC server with your VNC client using the IP of colinux with the displaynumber.
10.0.0.100:1
OR STARTUP VNC SERVER MANUALLY
- start vnc server
vncserver -geometry 1024x768
- first time it will ask for a password
- It wil say at which display vnc server is started. For example display :1
New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1
- start your vnc client and fill in the IP of colinux with the displaynumber.
10.0.0.100:1
VNC Server commands
- restart VNC server
service vncserver restart
- kill VNC server for a certain display, i.e. display :2
vncserver -kill :2
[edit] APACHE with PHP/MySQL
Installing a webserver is really really easy
start internet
ifup eth1
install apache
yum install httpd
make apache start at boot
chkconfig httpd on
install php
yum install php
install mysql-server
yum install mysql-server
install to be able to use mysql from apache
yum install php-mysql
make mysql start at boot
chkconfig mysqld on
set password for mysql (change the pass123 into something else)
mysqladmin -u root password 'pass123'
clean up
yum clean all
restart colinux
shutdown -h now
