Samstag, 26. Januar 2013

3 ways to install Linux

There is more than one way to install Linux on a computer. Which one is best depends on how often you do it, how different your requirements are and whether you work in a lab or at unpredictable customer locations (and have to take your lab with you). Basically there are three ways:

click-through

You put the DVD into the drive, boot from it and follow the instructions on screen. There is nothing wrong about this as long as you are only doing 3 installations or so per month in your lab - or 10 as a consultant at customers. To support this type of installation in your lab you can set up an NFS server to store your installation media and the like.
SUSE's final confirmation screen in a manual installation

automated installation

Automated installation is called kickstart with Fedora and Red Hat or AutoYaST with SUSE. Instead of answering the installer's question, you hand over a text file to it that contains the answers. How big do you want your partitions to be? Just describe it in the file. Then store this file on a virtual floppy disk, on a file server or on the install media and tell the installer where it is:
SUSE's installer pointed to an autoinstall file on an NFS server

I describe the details for SUSE at http://www.linuxintro.org/wiki/autoYast
You can develop this topic until you have a complete installation factory. Have you looked at Chris' phpEquiMon? This is a collaborative hardware inventory list that integrates PXE to redeploy servers with one click and one reboot. It's great if you have the skillset to install it.

cloning

If you have a Linux installation you can clone it. You do not depend on SUSE's or Red Hat's auto install mechanisms. You just copy your harddisk byte-by-byte to another harddisk in another computer. Even better, copy it file-by-file. Then you can go to a bigger harddisk. My favorite command is
 
tar -cvz $(ls | grep -v proc)  | ssh root@192.168.0.5 "cat >slash.tar.gz"
 
I describe it in detail on  http://www.linuxintro.org/wiki/cloning

Freitag, 25. Januar 2013

Creating an autoyast file

Today I want to create an autoyast file that actually works. Whoever says this is easy does not have the complete information.

I am using SUSE 12.2 here, installed into a VirtualBox virtual machine:
VirtualBox with 4 virtual machines
To clone this machine using autoyast I start it, open a shell in it and type
yast -i autoyast2
yast clone_system

This will create a file /root/autoinst.xml that clones the system you just installed.

If you now go and use this autoyast file with VirtualBox it will not work. After some time your installation will show a black screen, nothing else. As I have a little bit of a Linux education I could solve this problem:
SUSE Installer during the unattended installation via AutoYast

In the shell type

yast2 sw_single

then de-install yast2's iscsi client. Then again clone the config:

yast clone_system

and find a file /root/autoinst.xml. This is now useable. Ok, I had to do some minor modifications still, but you can see them on your own. I have shared it on gitHub.

Samstag, 19. Januar 2013

Creating a bootstick with AutoYaST

It is a good thing to have a Linux bootstick ready. You can boot any computer with it and diagnose hardware problems, eliminate viruses or fix startup problems.

There are a lot of ways to create a bootable USB stick. Today I want to explore a new one: Using a virtual machine and AutoYaST.  AutoYaST allows you to create a file to answer the installer's questions. We will use it on a VirtualBox virtual machine with no harddrive and a USB stick. This description is based on SUSE Linux 12.2, but other operating systems may work similar.

Create a virtual floppy

Autoyast requires a file that contains the answers to the installer's questions. It can be on a floppy disk. As I do not have a floppy drive, I will use a virtual floppy here which is a file. So, create a file that has exactly the size of a floppy disk by opening a console and typing:
dd if=/dev/zero of=floppy.img bs=1024 count=1440
Format this floppy:
mkfs.msdos floppy.img
Mount this floppy:
mkdir /mnt/loop 
mount -o loop floppy.img /mnt/loop
Create a file autoinst.xml that looks like this.
Copy the autoinst.xml to the virtual floppy
cp autoinst.xml /mnt/loop
Unmount the virtual floppy.
umount /mnt/loop

Create your virtual machine

Install VirtualBox on your SUSE Linux:
yast -i VirtualBox

Start VirtualBox with the command
VirtualBox
VirtualBox, in this case with 4 virtual machines

Create a new virtual machine without harddisk: Click on New -> Next -> enter "autoyast" as name for your virtual machine -> Next -> enter 1024 GB RAM -> Next -> un-tag "Start-up Disk" -> Next -> Continue -> Create
Insert the SUSE 12.2 DVD into the machine:

Click on the virtual machine "autoyast" -> Settings -> Storage -> IDE Controller -> add CD/DVD drive -> add the SUSE 12.2 DVD. Click on the + sign to add a floppy controller. Add the virtual floppy that we called floppy.img. It should look like this:

"Inserting" a virtual DVD and floppy into your virtual machine
Click OK and start the virtual machine. Select F12, then c to start from CD-ROM. In the boot screen, enter autoyast=floppy:
Your virtual machine starting from SUSE DVD using your autoyast floppy

Insert the USB stick into your physical computer. Use VirtualBox to attach the USB stick to the virtual machine. First, attach the "Generic Mass Storage Device", then your USB stick becomes visible (in this example it is the SanDisk Cruzer Blade). Select both so the virtual machine will be able to see the USB stick
Telling your virtual machine it has access to the USB stick
After selecting, type Enter and the installation will run unattendedly.
Final confirmation
Did I say unattendedly? Well, not quite. There will be one more window that asks you for confirmation like the above. And don't worry - the root password is set.

After installation, the system will try to reboot to do the initial configuration. This will fail because VirtualBox cannot boot from USB. However you can use the bootstick now.


Raspberry Pi, test my internet connection

Since start of Corona times, I use my internet at home also for work. So its reliability and performance has become crucial. Performance see...