SYA710 Lab

SYA710 Lab05



Building a Fedora Kickstart DVD

Many system administrators would prefer to use an automated installation method to install Fedora or Red Hat Enterprise Linux on their machines. To answer this need, Red Hat created the kickstart installation method. Using kickstart, a system administrator can create a single file containing the answers to all the questions that would normally be asked during a typical installation.

My Kickstart lab steps are following:

1. Install Fedora 9(from supplied DVD) onto /dev/sdb in lab T2107

  • Create an account named clown with password seneca99
  • Set seneca99 as the root password
  • Set the time zone to Toronto
  • Install the default set of packages

2. Startup Fedora 9, after installation

   Enter grub mode when the system startup

·         grub> root=(hd1,0)

·         grub> kernel=/vmlinuz-2.6.25-14.fc9.X86-64

·         grub> initrd=/initrd-2.6.25-14.fc9.X86-64.img

·         grub> boot

3. Install k3b and isomaster

   Login as clown user

·         $su –

·         #yum install k3b isomaster

4. Use k3b to make ISO image on the HD from the Fedora 9 DVD

Run k3b, click CopyDVD in the Tools pull down menu, the follow form will appear. Click Only create image, save the image to the target location. Wait until it finish.

 g1 

5. Make new ISO image

·         Modify the isolinux.cfg file in the ISO image

Run isomaster, load the image file just created by k3b in the top file browser, find the isolinux directory in the bottom file browser and click it, extract the isolinux.cfg file

g2

Use vi edit the isolinux.cfg file, add ks=cdrom before append initrd=initrd.img, save it.

g3

In isomaster, remove the isolinux.cfg file in the bottom file browser, add it back from the top browser.

·         Make and add the ks.cfg file to the ISO image

#cp /root/anaconda-ks.cfg /home/clown/ks.cfg

#chown clowm.clown ks.cfg

In isomaster, find the ks.cfg file in the top file browser, then add it to the root directory in the bottom browser.

         g4

·         Create the new ISO image

6. Use k3b to burn the new image to a blank DVD. After finish burning, insert the new DVD to another machine, boot that machine and it will install automatically until it finishes.

 

Reference

Fedora Kickstart

SUN Solaris Jumpstart

Opensuse AutoYaST

 

 

 

SYA710 Lab04



Building a New Kernel

Linux is probably the only operating system that has a new kernel every so often. The most common reason to upgrade a kernel is to take advantage of some newer device drivers to handle some specific devices. How to build a new kernel? The following is the steps we did successfully in the lab.

 

1.Download source from kernel.org

We downloaded 2.6.27.rc9 from “http://kernel.org” to /home/joker/Download directory in this lab.

 

2.Unpack the source file

  #tar xvjf linux-2.6.27-rc9.tar.bz2

 

3.Create configuration (.config) file as follows:

  #yum list *kernel*

  #yum install kernel-devel kernel-headers

  #cd /usr/src/kernels/2.6.25-14.fc9.x86_64

  #ls -a

  .config

  #cp .config /home/joker/Download/linux-2.6.27-rc9

  #yum update

  #yum install gcc

  #make oldconfig

 

4.Compile kernel and modules

  #make

 

5.Copy the new kernel to the /boot directory as follows:

  #cd /home/joker/Download/linux-2.6.27-rc9/arch/x86/boot

  #cp bzImage /boot/vmlinuz-2.6.27.fc9.x86_64

  #chmod a+x /boot/vmlinuz-2.6.27.fc9.x86_64

  Note: File name “vmlinuz-2.6.27.fc9.x86_64” you can change as your wish.

 

6.Copy and rename the new System.map file to the /boot directory as follows:

  #cd /home/joker/Download/linux-2.6.27-rc9

  #cp System.map /boot/System.map-2.6.27.fc9.x86_64

  Note: File name “System.map-2.6.27.fc9.x86_64” you can change.

 

7.Install the modules

  #make modules_install

 

8.Create a new initial ramdisk as follows:

  #/sbin/mkinitrd /boot/initd-2.6.27.rc9.x86_64.img 2.6.27.rc9

  Note: This will create the /boot/initd-2.6.27.rc9.x86_64.img initail ramdisk

        image file. Replacing 2.6.27.rc9 with the version number of the new kernel.

        mkinitrd command format: mkinitrd <image file> <kernel version>

 

 

 

SYA710 Lab02



1. What is your full name and Seneca student ID?

Answer: My name is Kezhong Liang and Seneca student ID is 059877084.

 

2. What is the purpose of the wall command?

Answer: The purpose of the wall is to send a message to everybody’s terminal.

 

3. Identify the full path and names of ALL startup/shutdown links created in step 6.

Answer:

Startup link: /etc/rc3.d/S92carpal

Shutdown link: /etc/rc0.d/K08carpal

 

4. What is the purpose of the chkconfig command?

Answer:

The purpose of the chkconfig is to allow you to display and change the services running on your machine in all of the run levels.

 

Display all services

The ‘chkconfig’ command all by itself will display all available services in every run level, like so:

     # chkconfig –-list

     carpal  0:off 1:off 2:off 3:on 4:off 5:off 6:off

     anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off

      … …

 

Removing a service from chkconfig control for all run levels

Now that you know how to look for services that are on or off for a certain run  level, how do you get rid of them? The command

     # chkconfig –del carpal

    will remove a service from chkconfig control by removing the symlinks in all

    of the run level directories, which effectively turns the service off.

 

Placing a service under chkconfig control for default run levels

What if you selected the wrong one when messing around with “–del”?

     # chkconfig –add carpal

    will add the script back in for its default run levels – the ones listed in

    the ‘chkconfig’ comment line in the script

 

How /etc/rc.d/init.d scripts work

The scripts to run services are all located in /etc/rc.d/init.d. There are a set of ‘run level’ directories under /etc named rc0.d, rc1.d, and so on, that map to the various run levels. In order to execute a script (start a service) in a specific run level, a symbolic link to the service’s script in /etc/rc.d/init.d is created in the directory of interest. So, for example, if the carpal script is to be run for run levels 3, a symlink to /etc/rc.d/init.d/carpal is created in /etc/rc3.d and /etc/rc5.d.

 

How chkconfig knows what to do

The chkconfig program looks inside the original script (inside /etc/rc.d/init.d) for the comment line that begins “# chkconfig”.

  # chkconfig: 3 92 08

The first argument in this comment identifies which run levels are the defaults – in this case, 3. The second argument is the order of the script during startup – in this case, ’92’. And the third argument is the order that the service should be run when killed. These arguments are used for naming the symlinks for this script for startup and kill.

 

 

5. What is the purpose of the /etc/init.d/functions script?

Answer:

This file contains functions to be used by most or all shell scripts in the /etc/init.d directory.

 

6. What is the difference between the init and telinit commands?

Answer:

init is the parent of all processes on the system, it is executed by the kernal and is responsible for starting all other processes.

telinit is linked to init. It takes a one-character argument and signals init to perform the appropriate action.

 

7. What runlevels does Fedora 8 use and what is the purpose of each?

Answer:

  Runlevel                    State

     0                   to halt the system

     1                   Single user mode

     2                   Multiuser with no network services

     3                   Default text/console only start. Full multiuser

     4                   Reserved for local use

     5                   X-windows GUI mode

     6                   Reboot the system

   s or S                Single user/Maintenance mode

 

8. What is the purpose of the daemon and killproc functions?

Answer:

  The purpose of the daemon is to start a program and the killproc is to stop a program.

 

9. What common arguments do startup scripts take?

Answer:

   start and restart

 

10. How is a daemon different from a regular user process?

Answer:

A daemon is a software process that runs in the background (continuously) and  provides the service to client upon request.

A regular user process runs one time. Once done it will stop.

 

11. Where (what directory other than /proc) are process numbers normally saved for currently running daemons.

Answer:

  /etc/rc.d/rcX.d        –X means current runlevel

 

12. What is the purpose of the dot (.) command and where is it used in this lab?

Answer:

The purpose of the dot (.) command is to read and execute commands in the current  shell environment.

In this lab, the dot command is used in /etc/init.d/carpal file(. /etc/rc.d/init.d/functions).

 

13. What is a lock file used for?

Answer:

    The lock file is used to prevent multiple occurances from running at one time.

 

14. What is the full path name of the lock file used in this lab?

Answer:

    /var/lock/subsys/carpald

 

 

SYA710 Lab01



1. What is your full name?

Answer: Kezhong Liang

 

2. What is the exact size (in bytes) of the fakedisk file you created  in PART A?

Answer: 10240000 bytes

 

3. What is the exact output of the command used in question 8 in PART A?

Answer:

    

     Filesystem    Type    Inodes   IUsed   IFree IUse% Mounted on   

     /dev/loop0    ext2      2.5K      11    2.5K    1% /mnt1

 

4. How many total inodes are there in the file system you created in PART A?

Answer: 2.5K inodes

 

5. What is the exact output of the command used in question 11 in PARTB?

Answer: In my computer, the /dev/sda4 has occupied, so I created the /dev/sda7.

 The exact output is as follow.

         

      Filesystem    Type    Inodes   IUsed   IFree IUse% Mounted on

      /dev/sda7     ext3       62K     248     62K    1% /home

 

6. How many inodes are there in the file system you created in PART B?

Answer: 62K inodes

 

7. What is the purpose of the e2label command?

Answer: The purpose of the e2label command is to display or change the filesystem label on the ext2/ext3 filesystem located on device.

 

8. If you added a label of /home to the file system you created in PART

B, how would you change step 6 of PART B?

Answer: In the test, firstly, I used “e2label /dev/sda7 /disk07” command to change the filesystem label to “disk07”, then I changed step 6 of PART B as follow.

 

        LABEL=/disk07             /home ext3     defaults           1 3

 

9. List the steps needed to perform a file system check on the file system you created in PART B.

Answer:

        #init 1                //enter single user mode       

        #umount /dev/sda7

        #e2fsck /dev/sda7

        #reboot

 

10. The file system you created in PART B occupied the entire 1GB partition. List the steps you would need to do to increase the file system size to 2GB.

Answer:

        #init 1

        #umount /dev/sda7       

        #fdisk /dev/sda         //delete /dev/sda7, then recreate /dev/sda7    

        #partprobe

        #e2fsck -f /dev/sda7       

        #resize2fs /dev/sda7      

        #reboot

 

11. What command would you use to set the maximum mount count of the file system in PART B to 100? Give the full command.

Answer: The command “tune2fs”      

        #tune2fs /dev/sda7 -c 100

 

12. Using LVM, explain, in your own words, how a file system can be increased and decreased. Be sure to include the commands you would use.

Answer: Firstly, if you want to increase a file system, you should check whether

        the volume group has enough space(using command vgdisplay). If not, you

        should extend volume group(using command vgextend). Then you can increase

        the lv size(lvextend command). Finally, you can extend the file system

        (resize2fs command).

        If you want to decrease a file system, you can directly shrink it(resize2fs

        command), then you can decrease the lv(lvresize command). But you should

        be careful that the file system’s space cannot be less than the space its

        contain occupied, and the lv’s space cannot be less than the file system’s.

 

 

 

SYA710 Lab0



1.What is your full name?

Answer: My full name is Kezhong Liang.

 

2.What is the output in steps 3 and 8?

Answer:

[sudo] password for joker:

 

Disk /dev/sda: 10.2 GB, 10200547328 bytes

255 heads, 63 sectors/track, 1240 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x0008edf2

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1        1181     9486351   83  Linux

/dev/sda2            1182        1240      473917+  82  Linux swap / Solaris

 

Disk /dev/sdb: 62.0 GB, 62014404096 bytes

255 heads, 63 sectors/track, 7539 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x6ab1bd22

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1             400         449      401625   83  Linux

/dev/sdb2            5000        5608     4891792+  83  Linux

/dev/sdb3             500         561      498015   83  Linux

/dev/sdb4            3000        3365     2939895    5  Extended

/dev/sdb5            3000        3122      987966   83  Linux

/dev/sdb6            3123        3245      987966   83  Linux

 

Partition table entries are not in disk order

 

3.What is the purpose of the sudo command?

Answer:

sudo allows a permitted user to execute a command as the superuser or another

user, as specified in the /etc/sudoers file.

 

4.What is the purpose of the minus sign (-) when using the su command?

Answer:

It will bring the whole root environment, including PATH and other varibles.

 

5.Explain how you deleted the partition table with fdisk.

Answer:

a)#fdisk /dev/sda

b)Input ‘p’ at help prompt to display the partition table

c)Input ‘d’ to delete respectively

d)Input ‘w’ to save changes

e)Input ‘q’ to quit

f)#partprobe

 

6.What is the purpose of the partprobe command?

Answer:

partprobe is a program that informs the operating system kernel of partition table changes, by requesting that the operating  system  re-read the partition table.

 

7.Write the complete mail command you would use to email a copy of lab00 to your LEARN account from MATRIX.

Answer:

mail -s “sya710-lab0” kliang10@learn.senecac.on.ca < lab0.txt

 

8.What is the function of the -s option to the mail command?

Answer:

Specify subject on command line (only the first argument after the -s flag is used as a subject; be careful to quote subjects containing spaces.)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: