Wednesday, October 15, 2008

Create Linux Ubuntu Server Mini.iso Flash-Drive Installation

Hi there!
Preparing and Creating Flash drive Installation.
Sometimes or always is helpful to have a Flash Drive with a Linux server installation files ready, because for some reason you wish to install and with a flash drive ready at hand in a matter of minutes it's goal acquired. whatever the location, only depending on some types of microprocessor.(School/Friend's house/Office/Supermarket PC) That's up to you.

Requirements:
-Linux Running
-Flash drive 1 GB ( First Sectors Cleaned )
-Mini.iso
-Syslinux Mtools
-Lilo
-Qemu ( Optional but helpful )
I hope I'm not forgetting anything.

Let's go, open a Console Terminal Window to issue the commands to obtain or goal:

sudo apt-get install syslinux mtools Lilo qemu
wget URL/mini.iso

ATM, we have the required software downloaded/installed ready to start doing things because the following commands (fdisk , mount, cp and others) usually come with most Linux distributions so let's continue:

Insert Flash-drive in usb port:

If there is a popup saying something about pen drive let it or close it.UPNP Flasdrive/OS Amazing Huh?

Let's go to the Console again:

sudo -s we've got root prompt.

fdisk -l
Lists all Storage Media Drives on Linux - From the list printed on the screen will be a lot or few info.
The Flash-drive info might be last, lists their partitions types so go ahead take a look and make sure u know wich drive /dev/name is assign to your Pen-drive ok ?
maybe /dev/sdg ? and if the pendrive have 2 partitions will list /dev/sdg1 and /dev/sdg2.

Ubuntu or Debian based distributions detect and mount the drives automatically so if you do:
mount Will list all /devices mounted on the system at the time you issue the command.
Got it ?
Do you have important things in you Pen-drive? Put them somewhere! We're going to clean it format/create new partition table! Ok?

fdisk /dev/sdx Where x is the letter corresponding to your Pen-drive device.

ATM we are going/using Fdisk.

Does it say anything to you F disk? No no no.. Format Disk is the correct meaning. =)

m prints the help
p prints partition table
a sets the partitions of the table list active
w writes/commits everything u did/change while using/inside fdisk program
n lets you create new partitions

Just do this while inside fdisk:

press p -> delete them all
press n -> press p when asked if primary or extended ->

hit enter to use the default 1st cylinder, +750M for partition size.

Done 1 partition 750 MB primary first sector of the Disk.

press a and then 1 to make the partition active.

press t to change partition filesystem type:
choose 6 - Fat16

We are done of fdisk? Yes you are correct..No we aren't.We have to leave fdisk successfully, and it's by pressing w which will say write/do this work to my flash-drive.
Press W To write changes to disk! sweet W.

Actually the partition table is created on the disk assigned to /dev/sdx but its partitions are not formatted, BTW never tried to mount without being formatted with these commands we are going to do no, which will probably happen something interesting.

Formatting:

mkfs.vfat or mkfs -t vfat -F 16 -n UbuntServer /dev/sdx1 - You choose mkfs.vfat or mkfs -t vfat both will work.
You see? -F 16 -n UbuntuServer partition we created. The disk is now formatted by this command by this program called mkfs which is the abbreviation of "Make File System", I always say file system is like the towel you use in your life, 1 for dinner table other for bath, other for hands other for living room table, each one with its purpose, type, format and characteristics.

mkfs.vfat -F 16 -n UbuntuServer /dev/sdx1

Next. What comes Next?Do You've any idea? Software downloaded, Flash-drive device detected at /dev/sdxx, and Cleaned,Partition created, Partition formatted.
We are going to copy the contents of the .iso into the newly created Partition on our Flash-Drive.

Let's read, mount the .iso OK?
Do you think we have to waste a cd to burn the .iso image to be able to read it or copy its contents? Of course not, if you can read them with Power iso an Amazing App. for Microsoft on Windows Platform, you probably can read with other app for Linux Platform.
Answer: You can read .iso and other media images with a program/command called "Mount" which is an amazing tool in Linux.

We used mount at some steps before, to list every device or directory mounted on the system, but now we're going to mount an .iso image which is in some directory, maybe /user/desktop? Firefox default download directory. Let's mount it, but find the path to .iso image ok?

mount -o loop mini.iso /media/image Here we are located where the .iso image resides which avoids to write the path to .iso.

Now the contents can be seen in /media/image/.
ls -al /media/image/ To see the content of the mini.iso

We have to copy the contents of mini.iso to the partition we have created /dev/sdg1
But once again, is /dev/sdg1 mounted?

So, we do:
mount To list to check if is mounted somewhere if not;

mount -t vfat -o rw /dev/sdx1 /media/flashdrive

The two mount points: /media/image/ and /media/flashdrive/, image.iso and New Partition in Pen-drive, respectively, have to exist in order to mount command be successful.
Mounted everything, we can copy from one directory to the other.

cp /media/image/* /media/flashdrive/ This copy command "cp", copies all content on /media/image/* to /media/flashdrive.
We are copying contents from the mini.iso to the partition /dev/sdx1 (flash-drive).

Next:
Syslinux -sf /dev/sdx1 To set the partition boot-able.

lilo -M /dev/sdx To set a boot-able Mbr sector on disk.

To finish :

cd /media/flashdrive && mv isolinux.cfg syslinux.cfg To move inside the pen-drive directory and rename the file isolinux.cfg (a config file) to syslinux.cfg, the reason is .iso image uses a different boot method. Boot method that will be used is syslinux.

Remove and Re-insert Pen-drive:
This one is helpful to check if all this work is effective without reboot and preparing Micro Computer to boot from Flash-Drive.¹

¹ Setting your PC Personal Computer to boot from flash-drive can be done on Bios, or by simply pressing a key on power-up to get BBS (Booting Disk Selection).

The following code:
qemu /dev/sdx Once again where x is the letter your Flash-drive was assigned to.

I think we can try this with memory cards, pen drives, and any storage medium with capacity above 512 MB and with the bios of PC able to boot from this type of media. Nowadays almost any Motherboard Bios have feature, detects boot-able media when connected to it on POST(Power ON Self Test), a diagnostic test on Power-up.

I hope i was clear, I'll verify this guide for errors and tried to make it easier for the beginner/average Linux user.Or improve it in future.
Thank you for your attention.

sudo apt-get install Syslinux Mtools Lilo Qemu
wget URL/mini.iso
sudo -s
fdisk -l
fdisk /dev/sdx
750 MB, active, FAT16
mkfs.vfat -F 16 -n UbuntuServer /dev/sdx1
mount -o loop mini.iso /media/image
mount -t vfat -o rw /dev/sdx1 /media/flashdrive
cp /media/image/* /media/flashdrive/
syslinux -sf /dev/sdx1
lilo -M /dev/sdx/
cd /media/flashdrive && mv isolinux.cfg syslinux.cfg
qemu /dev/sdx


Stay Cool. [[]]
Happy Linuxing.

Monday, October 13, 2008

Allow x-server root login

I have Kubuntu installed with live cd and i wanted to be able to use the user interface "UI" as root user!
So i searched on the net for a solution, and here it is:

1. Open a console terminal and get root prompt
Code: sudo -s
-> Enter your password

2. Find this file
Code: ls -al /etc/kde3/kdm/kdmrc

3. Open it with a console text editor
Code: nano /etc/kde3/kdm/kdmrc

4. Find
Code: AllowRootLogin=false

5. Change to
Code: AllowRootLogin=true

6: Saving and Closing Nano => "Console Text Editor"
ctrl + x ; press y ; and press execute

You're done - Hope it'll be helpful.