Installing and Configuring The Linux Operating System

Table of Contents

last revision
27 October 2011, 6:33pm
book quality


This book will provide some hints on how to install and configure the Linux
operating system. This will largely concentrate on how to configure 
various devices when these devices are not automatically detected. This
can often be the most difficult part of installing a Linux OS.

SMALL DISTRIBUTIONS

  == small distros
  .. slitaz - the most popular, 16meg
  .. puppy - ok
  .. tinycore -
  ..

DOWNLOADING THE LINUX VERSION 

  * download an iso file for the version of linux

  * check a file against its md5 checksum. (download the file filename.md5.txt)
  >> md5sum -c filename.iso.md5.txt

  * or check the downloaded file with
  >> md5sum file  
  ##(compare the displayed value with the 'md5' value on the download site)
  
BURNING THE DOWNLOADED FILE TO DISK

  * burn at a slow speed??
  * dont use the computer for other tasks??

  * burn the iso to a compact disk, using the 'burn image' or
    'burn iso' mode of the cd recording software.

  * to check if the iso on the cd is good
  >> dd if=/dev/cdrom | md5sum 
  >> dd if=/dev/cdrom of=/dev/stdout | md5sum /dev/stdin 
  
  >> dd if=/dev/cdrom of=image.iso  ##(dumps the cd data to 'image.iso')
  >> md5sum

LIVE CD AND USB DISTRIBUTIONS
  
  'live cds' or usb stick are compact disks or usb memory sticks which can
  run a version (or distribution) of Linux without installing it to the
  computer hard disk and which can be 'booted' directly from the cd
  or the usb memory stick. This is very convenient for trying out new  
  distributions without in anyway affecting the current operating system
  (Windows or Linux) installed on the computer.

  >> http://www.livecdlist.com/ a list of linux live cds

LIVE USB ....

  @@ pendrivelinux.org
     good simple instructions for getting a variety of distributions on a 
     usb 'pendrive'

  == jargon
  @@ iso image
     Despite the name, this is not an image (picture) file which you
     can view, but a compressed file containing an entire operating
     system (or something else)
  @@ 

  Some distributions include their own specific tools to create 
  a 'live usb' on a memory stick. But you should still be able to 
  use unetbootin if you want to.

  == steps to create a live usb  
  .. download an 'iso' of the linux distribution.
  .. use 'md5' to check that the file downloaded properly
  .. use 'unetbootin' to install that iso file to a usb memory stick
  .. change the bios boot settings to usb, if possible
  .. multiple distributions on one stick is possible but harder 
  ..

  == tools 
  .. unetbootin - useful tool for installing to a usb
  ..

  * start unetbootin to install a distro to a usb
  >> sudo unetbootin

  Unetbootin can download a distribution from the net or use a
  local iso file. Currently (2010) it seems possible to only have one
  active distribution on the usb. 

  * use the file 'sum.txt' to check that the file downloaded well
  >> md5 -c sum.txt

BOOTING FROM USB ....

  On many computers, change the boot settings in the bios
  by pressing <f1> or <f2> or <f12> or something similar while the 
  computer is booting.

  On an eeepc press 'esc' as the machine is booting in order to 
  boot from a usb stick (changing the boot settings in the bios
  doesnt work)
  
KERNEL MESSAGES

  The kernel writes messages about its operation to /var/log/...

  * view the kernel messages
  >> tail -f /var/log/...

KERNEL VERSION 

  * display the version number of the linux kernel you are running
  >> uname -r

  * display the Linux kernel version as well as other compilation info.
  >> cat /proc/version
  
LINUX MODULES

  In linux 'device drivers' (as they are known in the PC world) are 
  refered to as modules or kernel modules. Modules in the 2.6 series of 
  linux kernels have an extension '.ko' (kernel object). In the 2.4 
  series of kernels the extension is just '.o'. Each 'device' on a 
  computer (such as a wifi 802.11 wireless card) needs one or more 
  modules to be loaded in order for it to work. 

  When Linux is installed on a computer, it normally tries to identify
  all the devices which form part of the computer and automatically
  use the correct modules for those devices. However this is not 
  always successful and you may need to configure the loading of 
  modules yourself.

  If hardware doesnt work a module needs to be installed.

   * see all modules which are currently loaded (being used)
   >> lsmod

   * search for a loaded module with 'rt' in its name
   >> lsmod | grep rt

   * load a particular module
   >> modprobe ...

   * show information for the given module 
   >> modinfo rt3090sta

BLACKLISTING MODULES ....

 If the kernel loads incorrect modules (or device drivers) it
 may be necessary to 'blacklist' them, that is, prevent these 
 erroneous modules from loading.

 * black list a module
 >> sudo vim /etc/modprobe.d/blacklist.conf
 >> type ... blacklist modulename

COMPILE A MODULE ....
 
   Each module needs to be compiled for a particular kernel. If a
   particular periferal is not working then a module may need to be
   compiled and installed. In order to compile a module the kernel
   headers must be available.

   * install the gnu 'c' compiler (gcc) to compile the module 
   >> sudo apt-get install build-essential 

   * install the linux kernel source headers (needed for compiling modules) 
   >> sudo apt-get install linux-headers-generic

   * find out the exact name of the device you need a module for
   >> sudo lshw

   Then search the manufacturers site for a linux driver for this site,
   or search other sources for a linux module.

   * download the source code for the module for the device
   >> wget ...

   * unpack the module sources (for gzipped files)
   >> tar xvzf xxx.tar.gz 

   * unpack the module sources (for bzipped files)
   >> tar xvjf xxx.tar.bz 

   * change directory to the module source folder (just unpacked)
   >> cd ...

   * read the compilation instructions for the module
   >> less README*

   * compile and install the module
   >> sudo make; sudo make install

   * build dependencies between modules 
   >> depmod -a

   * load the module 
   >> modprobe modulename

   * unload a module
   >> modprobe -r modulename
   
LOADING MODULES ....

  The process of loading a module (or 'driver') refers to telling the 
  kernel that you wish to use that module

  == tools 
  .. insmod - loads a single module, with no dependencies
  .. modprobe - loads a module and all its dependent modules
  ..

  * view the manual page for modules loaded at start-up
  >> man modules

  == manual pages
  .. modprobe.conf - configuring modprobe
  ..

  * load a module which is in the current folder.
  >> insmod hello.ko

MODULE ALIASES ...

  When using 'modprobe' a generic name for a module can be
  used instead of the 

  * view modules aliases already defined
  >> less /etc/modules.conf ??
  
UNLOADING MODULES ....

   * remove the ralink wireless card driver
   >> modprobe -r rt2860sta
   >> rmmod rt2860sta     ##(the same)

DEBUGGING MODULES ....

  Viewing and modifying linux modules requires you to be 
  the 'super-user' root. 

  * run a series of commands as to super user 
  >> sudo bash

  * search for available modules for a Realtex RTL8139 ethernet card
  >> sudo modprobe -l | grep 8139
  >> modprobe -l | grep 8139

  * search for available modules for a Boradcom wireless card
  >> modprobe -l | grep b43

  These commands search for what modules (called 'drivers' in the 
  microsoft world) are available to install, not what modules
  are currently being used.

  * list all loaded modules which have '8139' in their name 
  >> lsmod | grep 8139

  * see if the Broadcom wireless module is currently installed (loaded) 
  >> lsmod | grep b43
  
  * load the 'b43' module
  >> modprobe -v b43

  * list all modules currentlly installed
  >> lsmod

WRITE A MODULE ....

  * write a simple module

  #include <linux/module.h>       /* Needed by all modules */
  #include <linux/kernel.h>       /* Needed for KERN_INFO */
  #include <linux/init.h>         /* Needed for the macros */

  static int __init hello_start(void)
  {
  printk(KERN_INFO "Loading hello module...\n");
  printk(KERN_INFO "Hello world\n");
  return 0;
  }

  static void __exit hello_end(void)
  {
  printk(KERN_INFO "Goodbye Mr.\n");
  }

  module_init(hello_start);
  module_exit(hello_end);

Wireless Cards Configuration ‹↑›

display lots of information about all network devices including wifi

 lshw -C network

This also displays the driver which the card is using under the 'configuration' heading.

load and configure a ralink wireless module with linux kernel 2.4 series

 /sbin/insmod rt2860sta.o
 /sbin/ifconfig ra0 inet YOUR_IP up

load and configure a ralink wireless module with linux kernel 2.6 series

 /sbin/insmod rt2860sta.ko
 /sbin/ifconfig ra0 inet YOUR_IP up

check what network (and wireless) interfaces are available

 ifconfig -a

Audio Devices Configuration ‹↑›

display information about the audio devices available

 sudo lshw -C multimedia | less

Debugging Usb Devices ‹↑›

www: http://www.basicconfig.com/linux/mount
check if a usb device has been recognised
 lsusb

plug in the usb device and look in /proc/scsi

 cat /proc/scsi/scsi
the make and model of the device should be displayed

see what drive the usb device is attached to

 dmesg | grep sd

check PCI devices

 cat /proc/pci
 lspci

rescan the the scsi bus to (hopefully) detect a new device

 echo "- - -" > /sys/class/scsi_host/hostX/scan

Analysing Hardware ‹↑›

One of the crucial aspects of configuring your linux system to work correctly is to be able to identify each of the components which make up the computer system. These components are often referred to as 'devices' (except in the case of ram memory, or the cpu)

get a full report of hardware and operating system in html format

 hardinfo

another way to get lots of hardware and operating system info

uname -a > eg.txt lspci >> eg.txt lspci -vv >> system.txt ,,,

see the linux start-up messages

 dmesg | less

use lspci to get the names of chipsets of hardware

 lspci
 lspci -vv    provides a more detailed listing

see lots of hardware info

 lshw

display information, such as type, manufacture for network devices

 lshw -C network

Cpu Information ‹↑›

The cpu or 'central processing unit' is the core component of the computer which carries out the majority of actual computations performed by the computer.

get information about the cpu

 cat /proc/cpuinfo

Ram Memory ‹↑›

getinformation about Ram memory

 cat /proc/meminfo

Use An Ms Windows Driver On Linux ‹↑›

first find the .INF file for the hardware

install a windows driver

 ndiswrapper -i /path/to/.inf

view the ms windows drivers being used current

 ndiswrapper -l

stop linux from loading linux driver 'b43' (broadcom wireless card)

 echo "blacklist b43" >> /etc/modprobe.conf

Services ‹↑›

install or uninstall a service to run at computer start-up

 chkconfig

show all services which will automatically start at boot-time

 chkconfig

display if the 'apache2' web-server service will start at boot-time

 chkconfig apache2

stop the 'apache2' web-server from starting at boot-time

 sudo chkconfig apache2 off

NOTES:

Unclassified notes

Get info on RAM Slots and Max RAM.

 dmidecode 2.9 | grep "Maximum Capacity"; dmidecode -t 17 | grep Size

Quickly (soft-)reboot skipping hardware checks

 /sbin/kexec -l /boot/$KERNEL --append="$KERNELPARAMTERS" --initrd=/boot/$INITRD; sync; /sbin/kexec -e

Lists the supported memory types and how much your board can

 sudo dmidecode -t 5,16

Backup your OpenWRT config (only the config)

 curl -d 'username=root&password=your-good-password' "http://router/cgi-bin/luci/admin/system/backup?backup=kthxbye" > `date +%Y%d%m`_config_backup.tgz

DOCUMENT-NOTES:

tools for analysing hardware components
lspci - information about all pci components
lshw - queries the sysfs system
lsusb -
linuxinfo