Вы находитесь на странице: 1из 60

OSA Course LI121 System and Network Administration I

Lab Exercises
Suse, Fedora and Ubuntu
Version 4.0, May 2008


ii

Book information
Title: LI121 Linux System & Network Administration I Lab Exercises
Version: 4.0
Course code: LI121
ISBN: 978-90-8688-004-5
4e druk
Open Source Academy
Rotterdamserijweg 122
3042 AS Rotterdam
the Netherlands
T: +31 654 227144
F: +31 10 2450902
E: info@OpenSourceAcademy.nl
W: www.OpenSourceAcademy.nl
Book P/N: H0121-90002
Printed in the Netherlands.
Protocomix 2003, 2004, 2005, 2006, 2007, 2008
Version Date Description
0.1 January 2004 Initial version.
0.2 January 2004 Peer review.
1.0 February
2004
First release.
1.1 January 2005 Update for Fedora 3
4.0 May 2008 Combined Suse and Fedora guides. Upgrade to Suse 10 and RedHat 5 /
Fedora 8. Added Ubuntu distribution



iii

Copyright notice
These training materials contain proprietary information of Protocomix. They are provided under a license
agreement containing restrictions on use and disclosure. These materials are protected by copyright law.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or
by any means, electronic, mechanical, photocopying, recording or otherwise without the prior written
permission of Protocomix.
Copyright 2003, 2004, 2005, 2006, 2007, 2008 Protocomix B.V. All rights reserved.
Microsoft, Microsoft Word, Microsoft Office, Windows, Windows 95, Windows 98, Windows NT, Windows XP, XP, Windows Vista, Vista and
MS-DOS are trademarks of Microsoft Corporation.
Intel, Pentium, Itanium, and Celeron are registered trademarks of Intel Corporation.
AMD, AMD Athlon, AMD Duron, and AMD K6 are trademarks of Advanced Micro Devices, Inc.
The Open Group, UNIX and X Window System are trademarks of The Open Group..
Linux is registered trademark of Linus Torvalds.
SuSe, ZENworks are trademarks of Novell inc.
RedHat is a trademark of RedHat Inc.
XFree86 is a registered trademark of The XFree86 Project, Inc.
Ubuntu is a trademark of Canonical Ltd. / Ubuntu Foundation
SSH and Secure Shell are trademarks of SSH Communications Security, Inc.
CUPS, and the CUPS logo are the trademark property of Easy Software Products.
MySQL, is a trademark of MySQL AB.
VMware, the VMware "boxes" logo and design, Virtual SMP and VMotion are registered trademarks of VMware, Inc.
Other company, product and service names may be trademarks of others.

Open Source Academy is a trademark of Protocomix B.V.

AuthorIT is a trademark of AuthorIT Software Corporation Ltd.
This document was created using AuthorIT, Total Document Creation (see AuthorIT Home - http://www.author-it.com).

Protocomix does not warrant that this document is error-free. The information in this manual has not formally been tested and is
distributed as-is without any warranty either express or implied. The use of this information or the implementation of any techniques is
for end user responsibility only. While Protocomix and its partners have carefully reviewed the contents of these course materials for
accuracy in a specific environment, there is no guarantee that the same or similar results will be achieved elsewhere. Customers
attempting to adapt these techniques for their own environment do so at their own risk.

If you find any problems in this documentation, please report them on the OSA website http://www.OpenSourceAcademy.nl.


Open Source Academy
Rotterdamserijweg 122
3042 AS Rotterdam
the Netherlands
T: +31 654 227 144
F: +31 10 245 0920
E: info@OpenSourceAcademy.nl
W: www.OpenSourceAcademy.nl
Printed in the Netherlands.


iv

Contents

The Suse and Fedora / Redhat books are combined. Some chapters are duplicated for each distribution.
Lab unit numbers ending in Distribution
R RedHat / Fedora
S Suse / Open SuSe
U Ubuntu
Lab units with no ending letter are suitable for all distributions. Remarks in the exercise point out where a
particular distribution may have a small difference.
About this lab guide

Contents v

About this lab guide iv
Unit 01R Installing Fedora, CentOS or RedHat Linux 1
Prerequisites................................................................................................... 1
Install Fedora from DVD .................................................................................. 1
Unit 01S Installing Suse Linux 5
Prerequisites................................................................................................... 5
Installing Suse From DVD ................................................................................ 5
Unit 01U Installing Ubuntu 9
Prerequisites................................................................................................... 9
Install Ubuntu from DVD.................................................................................. 9
Unit 02R Basic system configuration 13
Prerequisites..................................................................................................13
Changing display resolution.............................................................................13
Installing software..........................................................................................15
Creating user accounts ...................................................................................17
Network configuration ....................................................................................19
Adding a printer .............................................................................................21
Stopping Linux...............................................................................................22
Unit 02S Basic system configuration 27
Prerequisites..................................................................................................27
Changing display resolution.............................................................................27
Installing software..........................................................................................29
Creating user accounts ...................................................................................30
Network configuration ....................................................................................32
Adding a Printer .............................................................................................34
Stopping Linux...............................................................................................36
Unit 02U Basic System configuration 39
Prerequisites..................................................................................................39
Changing display resolution.............................................................................39
Installing software..........................................................................................40
Creating user accounts ...................................................................................43
Network Configuration....................................................................................46
Adding a printer .............................................................................................48
Stopping Linux...............................................................................................50
Unit 03 Logging in 53
Prerequisites..................................................................................................53
Text login......................................................................................................53
Logging in GUI...............................................................................................58
Gnome Desktop .............................................................................................59
Authentication settings ...................................................................................61

vi Contents

Unit 04 Working with the shell 69
Prerequisites for the shell................................................................................69
Basic command line structure..........................................................................69
Interactive command features .........................................................................70
Some basic commands ...................................................................................72
Unit 05 Working with files and Directories 75
Prerequisites..................................................................................................75
Accessing files................................................................................................75
Unit 06 History 79
Unit 07 Working with wildcards 81
Prerequisites..................................................................................................81
Shell wildcards ...............................................................................................81
Shell command line processing........................................................................82
Finding files ...................................................................................................82
Remote commands.........................................................................................84
Unit 08 Running processes 87
Prerequisites..................................................................................................87
Processes ......................................................................................................87
Using variables...............................................................................................88
Monitoring processes ......................................................................................92
Process control...............................................................................................95
Unit 09 Redirecting output 99
Prerequisites..................................................................................................99
Redirecting to files..........................................................................................99
Unit 10 Working with vi 101
Prequisites...................................................................................................101
Learning vi...................................................................................................101
Unit 11 Text filters 103
Prerequisites................................................................................................103
Standard filters ............................................................................................103
Pipelines of filters.........................................................................................104
Unit 12 File permissions 105
Prerequisites................................................................................................105
User and file identity.....................................................................................105
Directory protection......................................................................................106
File protection..............................................................................................107
Switching groups..........................................................................................107

Contents vii

Unit 13 A tour trough the graphical interface 109
Prerequisites................................................................................................ 109
X window system......................................................................................... 109
Unit 14 Hiking across the file system 111
Prerequisites................................................................................................ 111
Visiting some directories ............................................................................... 111
Using nautilus .............................................................................................. 113
Unit 15 Creating and mounting filesystems 115
Prerequisites................................................................................................ 115
Mounting..................................................................................................... 115
Creating new file systems. ............................................................................ 117
Unit 16 shell scripts 121
Prerequisites................................................................................................ 121
Starting a script ........................................................................................... 121
Unit 17F Virtualization 123
Prerequisites................................................................................................ 123
Create a VM................................................................................................. 123
Wine emulator ............................................................................................. 125
Unit 17S Virtualization 127
Prerequisites................................................................................................ 127
Create a VM................................................................................................. 127
Wine emulator ............................................................................................. 128
Unit17U Virtualization 131
Prerequisites................................................................................................ 131
Create a VM................................................................................................. 131
Wine Emulator ............................................................................................. 135
Unit 18 File system internals 137
Prerequisites................................................................................................ 137
File system internals..................................................................................... 137
Appendix A Lab setup guide 141
Hardware required ....................................................................................... 141
Local network .............................................................................................. 142
Internet access ............................................................................................ 142
Other items required .................................................................................... 142


1


In this lab we will install Fedora Linux. Make sure the installation is successful as we will use it during the
remainder of the course.
The labs in this book have been tested on RedHat Enterprise Server 5. Due to license restrictions OSA is
unable to provide you with RHEL CD's. If you provide your own installation media all labs in this book will
work. You can use CentOS as a Pure OSS alternative to RHEL.
Also make sure you create the user accounts at the end of this lab as we will these as well!
Prerequisites
These are the things you need to know in advance for this lab:
Know how to access the BIOS of your machine.
Know any passwords to access the OS of the PC.
Know the regional layout of your keyboard.
Check with your instructor if the local network supports DHCP. If not the instructor will supply you
with network information.
Machine equipped with a bootable DVD player.
A Fedora, RedHat or CentOS DVD.
On-line update
Your instructor should tell you if you can perform an on-line update in this classroom.
He may want to skip it due to time or bandwidth constraints...

Install Fedora from DVD
In this lab we will perform a DVD installation of Fedora, CentOS or RedHat. We will perform an "Office"
installation.
If you work with CentOS we choose the "Desktop-gnome" installation.
In this unit we will investigate the hardware of the PC. Do not spend too much time on this item as the
installation will take some 30 minutes.
Hardware inventory
1 Use the OS installed on the PC or BIOS setup to investigate your hardware. Make a note of the
following items:
Unit 01R Installing Fedora, CentOS or
RedHat Linux

2 Lab Exercises OSA Course LI121 System and Network Administration I

Processor type and speed.


Memory size.


Hard disk size.


Network card speed.


Do not spend too much time on this item.

DVD Installation
We will install the system with these parameters.
Check install media Skip
Language of install English
Keyboard Choose your keyboard layout.
Installation number (RedHat Only) Skip entering installation number.
Partitioning Create custom layout with static partitions.
See below for partition scheme.
Use LVM No
Bootloader GRUB
Network configuration DHCP
Time zone Your time zone
System Clock uses UTC Yes
Root password secret
Firewall Off
SELinux Disabled
User account Create a personal account

1 Boot from the first DVD
2 For CentOS and RedHat on the boot: prompt press <enter>.
For Fedora: Choose "Install or upgrade an existing system". (Do not choose text mode!)
3 Skip the DVD media check. This takes too long.
4 Click Next on the welcome screen.
5 Choose English as the installation language.
NOTE: All examples in this book assume English(English) as the installation language. If you
choose another language you have to translate the book instructions to match your
language screen.
6 Choose your keyboard layout.
In the Netherlands (with US keyboards) you can choose US English, or US English
International. Other regions should select the layout that matches the keyboard layout for
their region. Your instructor can help you if unsure about your keyboard layout.
7 RedHat Only: Installation number.
Skip entering installation number. (The installation number will tie this machine to your support
Contract with RedHat. We do not want this for this course.)
8 Choose "Create custom layout" from the drop down box.
The choice available depends on the Fedora release.

Unit 01R Installing Fedora, CentOS or RedHat Linux 3

We want to define out own partition layout. To do this we delete partitions of other
Operating Systems on the machine.
Wipe out the large partition(s) of any other operating system on the machine. (Click on the "ntfs" line
in Disk Druid, and then click Delete)
In some cases your instructor may advise you to leave a small partition intact on the disk. This
maintenance partition is used for restoring the machine after the course is done. Please leave such a
partition on the disk!
Then create the following partitions:
Mount
point directory
Filesystem
type
Partition
size
/boot ext3 100 Mb
/ ext3 512 Mb
/usr ext3 3800 Mb
/var ext3 2048 Mb
/home ext3 500 Mb
/tmp ext3 500 Mb
none Swap 2x memory size but no more than 1Gb.
To create a partition click NEW. In the top box choose the mount point directory, then set the size in
the appropriate box. Choose "Format as ext3".
To create the SWAP partition choose SWAP as the file system type.
We do leave some space unused for now!
Leave the rest of the disk space free and unused, so we can use it for later labs!
9 Ask your instructor to verify the partition table you made.
Mistakes in a static partition table can only be repaired by re-installation!
10 Bootloader
Choose Grub as the bootloader. Do not change any of the advanced options and bootloader password
options.
11 Network
Choose DHCP for network configuration.
If DHCP is not available at your site, use the addresses your instructor will give you.
12 Time and Time zone
Choose your local time zone by clicking on the map, or choosing the right time zone in the box below.
Check the "Clock uses UTC" checkbox.
13 Root password
Set the root password to "secret".
Do not choose another password. The instructor will use this password to help you via the
network if needed.
14 Installation set
Choose for:
Fedora: "Office and Productivity"
CentOS: "Desktop-gnome"
RedHat ES5: nothing.
as the installation type. We will add other software as needed later on; So leave "Customize later"
selected. Do not add any extra repositories.
15 Confirmation screen

4 Lab Exercises OSA Course LI121 System and Network Administration I

Click "NEXT" to confirm the selected software and start the installation using the DVD.
16 During the installation check Virtual screens #1 to #7 to see diagnostic messages.
To switch screens press caf to n to see the different VT screens. The graphical installer
should be visible on screen #6 (cak)
17 Click "REBOOT" when done.
Finishing the installation
1 Welcome and license
Click "Forward" on the welcome screen.
2 License agreement.
Accept the license agreement.
3 Select "no firewall" or "Disabled" on the firewall screen.
Click "Proceed" on the warning screen!
Yes! This is really what we want!
4 SELinux
SELinux is a system that hardens selected system processes. For now we will disable SELinux as it will
cause trouble in some of the upcoming labs.
Do DISABLE SELinux!
5 RedHat only: Do not enable the Kdump feature.
6 Date and time
Set the date and time of the clock..
Do not enable the NTP protocol.
7 Fedora Only: "Hardware Profile"
Do not participate in the hardware profile sharing project for this lab.
8 RedHat Only: Setup Software updates
Choose "No, I prefer to register at a later time"
9 User accounts
Create a personal user account. Please enter your full name so we can find it back later. Set a personal
password.
Do not change the "Use Network Login" settings.
10 RedHat only: "Configure Sound and Display"
Check if your monitor, video card and sound card were detected correctly.
Correct any misdetections. Select the right vendor and model from the lists.
Select a resolution.
11 Sound card
Try if you sound card is detected. Do not worry if it is not, we will not use it during this training.
12 Additional CD's
Do not install any additional documentation CD.
13 Finish
Click "Next" to finish the installation.
Try to login with your personal account.


5


In this lab we will install Suse Linux. Make sure the installation is successful as we will use it during the
remainder of this course.
Also make sure you create the user accounts at the end of this lab as we will these as well!
Prerequisites
Know how to access the BIOS.
Know any passwords to access the OS of the PC.
Check with your instructor if the local network supports DHCP. If not the instructor will supply you
the network information.
Machine equipped with a bootable DVD player.
A (Open)SuSE installation DVD.
On-line update
Your instructor should tell you if you can perform an on-line update in this classroom.
He may want to skip it due to time or bandwidth constraints...

Installing Suse From DVD
In this lab we will perform a DVD installation of Suse. We perform a "standard" installation. This will yield
an Office workstation installation of Suse Linux.
In this unit we will investigate the hardware of the PC. Do not spend too much time on this item as the
installation will take some 30 minutes.

Hardware inventory
1 Use the OS installed on the PC or BIOS setup to investigate your hardware. Make a note of the
following items:
Processor type and speed.


Memory size.


Hard disk size.


Unit 01S Installing Suse Linux

6 Lab Exercises OSA Course LI121 System and Network Administration I

Network card speed.


Do not spend too much time on this item.

DVD Installation
We will install the system with these parameters.
Language of install English
Keyboard Choose your keyboard layout.
Partitioning Create custom layout using static partitions.
See below for partition scheme.
Use LVM No
Bootloader GRUB
Network configuration DHCP
Time zone Your time zone
System Clock uses UTC Yes
Root password secret
Firewall Off
User account Create a personal account

1 Boot from the first DVD.
2 On the Boot Options: screen prompt choose <Installation>.
(Leave the boot options box empty)
3 When the Yast screen appears, choose the installation language.
NOTE: All examples in the book assume English(US) as the installation language
4 Agree with the License agreement.
5 Choose <New Installation>
6 Set Time Zone to your local time zone.
Choose your Region and Country from the two lists.
Choose "Hardware clock set to": UTC
7 Desktop manager
Choose "GNOME" as the desktop manager.
8 Review Installation settings
Choose <Partitioning> to perform manual partitioning.
9 Choose "Create Custom partition setup" or "Custom partitioning (for experts)".
Wipe out the large partition of any other operating system on the machine.
Your instructor may advise you to leave a small partition intact on the disk. This partition is used for
restoring the machine after the course is done. Please leave such a partition on the disk!
Then create the following partitions:
Mount
point directory
Filesystem
type
Partition
size
/boot ext3 100 Mb
/ ext3 1000 Mb
/usr ext3 3500 Mb
/opt ext3 512 Mb
/var ext3 250 Mb
/home ext3 500 Mb
/tmp ext3 500 Mb

Unit 01S Installing Suse Linux 7

none Swap 2x memory size but no more than 1Gb.
To create a partition click <Create>.
Clock "Format" and select file system "ext3".
In the "Size" box: Leave the start cylinder untouched and type +100M in the end cylinder box to
create a 100Mb partition.
Choose the mount point directory.
To create the SWAP partition choose SWAP as the file system type.
We do leave some space unused for now!
Leave the rest of the disk as free space so we can use it for upcoming labs.
10 Ask your instructor to verify the partition table you made.
Mistakes in a static partition table can only be repaired by a new installation!
Then return to the main YaST menu.
11 Choose <Accept> to start the installation
Accept the licenses.
Confirm the installation.
You can switch between the <Slide Show> and <Details> pane of YaST during installation.
12 During the installation check Virtual screens #1 to #7 to see diagnostic messages.
To switch screens press caf to u to see the different VT screens.
The graphical installer should be visible one of the screens.
13 After the first stage the machine will reboot.
Remove the DVD from the drive and reboot from the HD.
Wait for Yast to re-appear after the reboot.
Finishing the installation
1 Root password
Set the root password to "secret".
Accept the messages about this insecure password!
Do not choose another password if you want the instructor to help you in case of trouble....
2 Hostname and domain name
Choose a hostname for your system.
Set the domain to classroom.net.
3 Network configuration
Switch OFF the firewall!
Leave the network configuration on DHCP unless your instructor advises otherwise.
Disabling the firewall is important for the upcoming labs.
Choose <Next> to continue the testing the network installation.
Test the network connectivity by downloading the release notes.
4 Online update.
To save time we will skip this step for now. Choose Configure later.
Configuring many systems at the same time can lead to high network loads, slowing down
the installation.

8 Lab Exercises OSA Course LI121 System and Network Administration I

Your instructor should advise you if this option is available in this classroom.
5 Addition Installation Sources
De-select all repositories.
Make sure none of the repositories is checked as this will lead to a very lengthy download
session!
6 User authentication method
Set the authentication method to "Local (/etc/passwd)"
7 Create a personal user account.
Please enter your full name so we can find it back later. Set a personal password.
8 Let the cleanup do it's work.
9 Click next on the Release Notes.
10 Accept the hardware configuration as proposed.
11 Finish
Try to login with your personal account.


9


In this lab we will install Ubuntu Linux. Make sure the installation is successful as we will use it during the
remainder of this course.
Also make sure you create the user accounts at the end of this lab as we will these as well!
Prerequisites
Know how to access the BIOS of your machine.
Know any passwords to access the OS of the PC.
Check with your instructor if the local network supports DHCP. If not the instructor will supply you
with network information.
Machine equipped with a bootable DVD player.
An Ubuntu DVD.
On-line update
Your instructor should tell you if you can perform an on-line update in this classroom.
He may want to skip it due to time or bandwidth constraints...

Install Ubuntu from DVD
In this lab we will perform a DVD installation of Ubuntu.
We will perform an "Office" installation.
In this unit we will investigate the hardware of the PC. Do not spend too much time on this item as the
installation will take some 30 minutes
Hardware inventory
1 Use the OS installed on the PC or BIOS setup to investigate your hardware. Make a note of the
following items:
Processor type and speed.


Memory size.


Hard disk size.


Unit 01U Installing Ubuntu

10 Lab Exercises OSA Course LI121 System and Network Administration I

Network card speed.


Do not spend too much time on this item.

DVD installation
We will install the system with these parameters.
Language of install English
Keyboard Choose your keyboard layout.
Partitioning Create custom layout using static partitions.
See below for partition scheme.
Use LVM No
Bootloader GRUB
Network configuration DHCP
Time zone Your time zone
System Clock uses UTC Yes
Root password secret
Firewall Off
User account Create a personal account

1 Boot from the first DVD.
You have to wait considerable time because Ubuntu starts in "live" mode. In "live" mode you
can work with Ubuntu without installing it! For this course we will install Ubuntu onto the
hard disk.
If you encounter video problems, try the "Start in Safe Graphics mode" option of the
welcome screen.On the boot screen choose: "Start or install Ubuntu".
2 Double Click the "Install" icon on the desktop.
3 Choose English as the installation language.
NOTE: All examples in this book assume English(English) as the installation language. If you
choose another language you will have to translate the book exercises to match your
language.
4 Choose your time zone and location.
5 Choose your keyboard layout.
You can test your keyboard by typing in the box provided.
In the Netherlands you can choose US English, or US English International. Other regions
should select the layout for their region. Your instructor can help you if unsure about your
keyboard layout.
6 Prepare disk space: Choose "Manual".
We want to define our own partition layout. To do this we delete partitions of other
Operating Systems on the machine.
Wipe out the large partition(s) of any other operating system on the machine. (Click on the "ntfs" line
in "Prepare Partitions", and then click Delete Partition)
In some cases your instructor may advise you to leave a small partition intact on the disk.
This maintenance partition is used for restoring the machine after the course is done. Please
leave such a partition on the disk!
Then create the following partitions:

Unit 01U Installing Ubuntu 11

Mount
point directory
Filesystem
type
Partition
size
/boot ext3 100 Mb
/ ext3 512 Mb
/usr ext3 3000 Mb
/var ext3 1024 Mb
/home ext3 500 Mb
/tmp ext3 500 Mb
none Swap 2x memory size but no more than 1Gb.
To create a partition click on the "free space" line then click "New Partition". Choose if you want it to
be a Primary or logical (a Partition inside the extended partition). Set the size in Megabytes. Leave
"Location of the partition" to "Beginning"; This stacks the partitions from the beginning of the disk not
the end. Choose "Format as ext3". Then choose the mount point.
To create the SWAP partition choose SWAP as the file system type.
We do leave some space unused for now!
Leave the rest of the disk space free and unused, so we can use it in later labs!
7 Ask your instructor to verify the partition table you made.
Mistakes in a static partition table can only be repaired by re-installation!
8 Username and hostname.
Create a personal user account. Please enter your full name so we can find it back later. Set a personal
password.
Choose a hostname.
9 Click Next to start the installation.
10 During the installation check Virtual screens #1 to #10 to see diagnostic messages.
To switch screens press caf to n to see the different VT screens. The graphical installer
should be visible one of the screens.
11 After the installation has finished click "Restart now" to reboot.
Remove the CD when it pops out.


13


In this lab we will see the basic survival skills of the system administrator.
Prerequisites
The user account we created during installation.
The OpenOffice package needs to be installed.
We will try to access the Internet. This will only work if your site is properly connected to the Internet.
Changing display resolution
First we will set the resolution of our display.
Using the Display utility
1 Login with your personal account.
2 Open the "Display" utility
Open the System menu and choose "Administration" -> "Display".
Enter the root password in the box.
3 Check your monitor type and change it if needed.
Choose the vendor and monitor type. You may have to look at the back of your screen to determine
the exact type.
4 Choose a resolution!
5 Reboot your system for the new setting to take effect.
Rebooting is not strictly needed! You could go to a Virtual console, login as root and issue
[root@system ~]# init 3
[root@system ~]# init 5
This will reset the display manager and start one with the new settings.

The x.org tools
1 Look at the contents of /etc/X11/xorg.conf.
GUI: navigate to /etc/X11 and double click on xorg.conf to open if.
command line: less /etc/X11/xorg.conf
Unit 02R Basic system configuration

14 Lab Exercises OSA Course LI121 System and Network Administration I

The file consists of sections. Look for the "ServerLayout". In this section the other parts are assembled
into a server with keyboard, screen and mouse.
2 From a terminal window run xvidtune and play a little with the controls.
On LCD displays this may not have much influence as the display immediately compensates
for any changes you make to the timings.
You really need to know the specs for the Display to know what you should enter here.
3 Press the "show" button to see a modeline statement.
This is the line you would add to your screen section of xorg.conf if you wanted to "save" these
settings. We do not do this now.
4 Now we will test the xorg configuration tools.
First we will save a copy of our existing xorg.conf file so we can restore it later.
5 Logout from the GUI.
6 Switch to text console #1 and login as root
Press caf
login: root
passwd: secret
7 Rename the xorg.conf file to xorg.conf.original
system244:~ # cd /etc/X11/
system244:/etc/X11 # mv xorg.conf xorg.conf.original
8 Now we have to stop the GUI
system244:/etc/X11 # init 3
...
Shutting down service gdm done
9 Run xorgconfig.
system244:/etc/X11 # xorgconfig
Answer a few questions. Then quit the program with cC.
We will not try to configure X using this program!
10 Now run xorgcfg and watch the screen.
system244:/etc/X11 # xorgcfg

X Window System Version 7.2.0
Release Date: Sat Sep 22 22:10:58 UTC 2007
X Protocol Version 11, Revision 0, Release 7.2
Build Operating System: Fedora LINUX
Current Operating System: Linux system244 2.6.22.5-31-default #1 SMP 2007/09/21 22:29:00 UTC i686
After some time a drawing with your hardware should appear.
Accept this and save it to /etc/X11/xorg.conf; This is done by clicking "quit" to leave then accept
the default config file location.
11 Restart your GUI:
system219:/etc/X11 # init 5
....
Starting service gdm done
You should be able to login again.
12 Now we will reset our original configuration.
system244:/etc/X11 # cd /etc/X11
system244:/etc/X11 # mv xorg.conf.original xorg.conf
system244:/etc/X11 # rcxdm restart
Shutting down service gdm done
Starting service gdm done
system244:/etc/X11 #
13 Finally we will have a quick peek at the Monitor configuration database.
14 Login on the GUI and navigate to /usr/share/hwdata/ Open file MonitorsDB.
This file contains sync settings for many popular displays so you do not have to figure them out from
the display documentation.
Close the file after examination.

Unit 02R Basic system configuration 15


Installing software
Adding software after installation.
Graphical tool
1 First we will install software with the "Add/Remove Software"Tool:
Open "Applications" -> "Add/Remove Software".
Enter the root password (secret) when asked.
2 Inspect the repositories that are activated at present.
RedHat does not have configurable Repositories in the tool.
They are managed from the RHN web site and not inside the application.
Open the "Edit" -> "Repositories" menu.
Make sure the "Fedora" and "Updates" Repositories are selected.
3 Inspect the various categories.
4 Add ksudoku from the
"Applications" -> "Games and Entertainment"
Package group. Select it from the "Optional packages".
Observe that many dependencies were selected for the package in the "Details" button.
This lab only works with an Internet connection as the software is downloaded from the on-
line repository!
5 Close the tool.
6 Start "ksudoku" from the "Applications" -> "Games" menu.
7 Next we will install a package by browsing to it with the Nautilus file browser:
Browse the installation DVD on your desktop.
Double click the DVD icon on the desktop and go to the "Fedora" directory.
Double click on zsh-4.2.6-6.fc7.i386.rpm to install it.
8 Run zsh.
Open a terminal window and issue: zsh.
Type exit to leave the "z" shell.

Using the rpm command
Now we will use the command line and the rpm command to manage packages.
1 Open a terminal window and become root with su.
[student1@system ~]$ su -
Password: secret
Then make a list of all installed packages:
[root@system ~]# rpm -qa
chkconfig-1.3.34-1
info-4.8-15
sed-4.1.5-7.fc7
libXau-1.0.3-1.fc7
libcap-1.10-29
diffutils-2.8.1-16.fc7
libgtop2-2.14.8-1.fc7
shared-mime-info-0.20-2.fc7

16 Lab Exercises OSA Course LI121 System and Network Administration I

libXrandr-1.2.0-3.fc7
cracklib-2.8.9-10
.......
2 Show detailed information about the ksudoku package we installed earlier.
[root@system ~]# rpm -qi ksudoku
Name : ksudoku Relocations: (not relocatable)
Version : 0.3 Vendor: Fedora Project
Release : 2.fc7 Build Date: Wed 17 Jan 2007 09:30:19 PM CET
Install Date: Fri 28 Sep 2007 04:40:11 PM CEST Build Host:
hammer2.fedora.redhat.com
Group : Amusements/Games Source RPM: ksudoku-0.3-2.fc7.src.rpm
Size : 239381 License: GPL
Signature : DSA/SHA1, Fri 18 May 2007 11:20:00 PM CEST, Key ID b44269d04f2a6fd2
Packager : Fedora Project <http://bugzilla.redhat.com/bugzilla>
URL : http://ksudoku.sourceforge.net/
Summary : Sudoku game
Description :
Ksudoku is a fully-featured Sudoku puzzle generator and solver for KDE. With it
you can generate and play 3D and 2D puzzles of different sizes and levels. The
main algorithm is fast and extendable to any general graph coloring problem.
You need a package name here, not a rpm filename!
3 List the description of package of hunspell-af-0.20060117-1.fc9.noarch.rpm on the DVD.
Packages are on the DVD in directory /media/Fedora 9 i386 DVD/Fedora.
You need to use the -p flag of rpm and the file name as this package is not installed!
[root@system Fedora]# cd /media/Fedora 9 i386 DVD/Fedora
[root@system Fedora]# rpm -qip hunspell-af-0.20060117-1.fc9.noarch.rpm
Name : hunspell-af Relocations: (not relocatable)
Version : 0.20060117 Vendor: Fedora Project
Release : 1.fc7 Build Date: Wed 14 Feb 2007 10:11:48 AM CET
Install Date: (not installed) Build Host: ppc3.fedora.redhat.com
Group : Applications/Text Source RPM: hunspell-af-0.20060117-1.fc7.src.rpm
Size : 1553511 License: LGPL
Signature : DSA/SHA1, Fri 18 May 2007 09:13:11 PM CEST, Key ID b44269d04f2a6fd2
Packager : Fedora Project <http://bugzilla.redhat.com/bugzilla>
URL : http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries/
Summary : Afrikaans hunspell dictionary
Description :
Afrikaans hunspell dictionary
4 Install it from DVD.
[root@system Fedora]# rpm -ivh hunspell-af-0.20060117-1.fc7.noarch.rpm
Preparing... ########################################### [100%]
1:hunspell-af ########################################### [100%]
This installs the dictionary files for Afrikaans.
5 To see a list of files it has installed run rpm -ql on the package:
Now you have to use the package name not the file name!
[root@system Fedora]# rpm -ql hunspell-af
.....
6 Remove the package.
[root@system Fedora]# rpm -e hunspell-af
Again you have to use the package name not the file name!
Do not try to de-install hunspell itself! This is the base package and needed by many other
programs. hunspell-af only de-installs the Afrikaans dictionary for hunspell.

Using YUM
1 Search for packages providing exaile which is a media player using yum.
[root@system ~]# yum search exaile
As you can see there are many packages for exaile!
2 Let's install the exaile package.
[root@system ~]# yum install exaile
As you can see it automatically selects many dependent packages:
Dependencies Resolved

Unit 02R Basic system configuration 17


=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
exaile i386 0.2.10-2.fc7 updates 764 k
Installing for dependencies:
gamin-python i386 0.1.8-5.fc7 fedora 57 k
gnome-python2-gtkmozembed i386 2.14.3-4.fc7 updates 27 k
gstreamer-python i386 0.10.7-2.fc7 fedora 257 k
libsexy i386 0.1.11-1.fc7 fedora 42 k
python-CDDB i386 1.4-1.fc7 fedora 531 k
python-eyed3 noarch 0.6.12-1.fc7 fedora 147 k
python-gpod i386 0.4.2-1.fc7 fedora 146 k
python-mutagen noarch 1.12-1.fc7 updates 219 k
python-sexy i386 0.1.9-3.fc7 fedora 23 k
python-sqlite2 i386 1:2.3.3-1.fc7 fedora 90 k

Transaction Summary
=============================================================================
Install 11 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 2.3 M
Is this ok [y/N]:
3 Check the files in /etc/yum.repos.d and see that some pre-defined repositories are not enabled.
You can add a file to this directory if you want to more repositories. For example to add the RPMforge
repository create a file:
[root@system ~]# cd /etc/yum.repos.d
[root@system ~]# vi rpmforge.yum

# Name: RPMforge RPM Repository for $name $version - $builder
# URL: http://rpmforge.net/
[rpmforge]
name = $name \$releasever - RPMforge.net - dries
#baseurl = http://apt.sw.be/fedora/7/en/\$basearch/dries/RPMS
mirrorlist = http://apt.sw.be/fedora/7/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
For now we leave adding repositories as it is...
4 CentOS users:
If you have some extra time. Investigate YumEx that provides a Graphical front-end to yum. You can
find it if you add the CentOS extras repository.
Creating user accounts
Next we will create some accounts.
Graphical tool
1 Login as root on the graphical desktop.
2 Open the "System" menu "Administration" -> "Users and groups"
3 Add a new user.
Username: student1
Full name: First Student
Password: secret
Leave the other choices at their default value.
Accept the notices about password security!
4 Check the account expiration data for your own personal account.

18 Lab Exercises OSA Course LI121 System and Network Administration I

Double click on the user account.
Goto the "Account Info" and "Password Info" panes.
Account expiration will disallow all login (even with a correct password) after the date
Password expiration just forces regular password changes
5 Check your group memberships.
6 Close user manager.
useradd command
1 Open a terminal window.
Open the "Applications" start menu "System Tools" -> "Terminal".
2 Change to the root user with su.
[user@system ~]$ su -
Password secret
[root@system ~]#
3 Add a user with the useradd command.
[root@system ~]# useradd -c "Second Student" student2
The -c flag sets a Full Name for the user. Always a good idea on a busy system.
4 Next set a password for the new user:
[root@system ~]# passwd student2
Changing password for user student2.
New UNIX password: secret
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password: secret
passwd: all authentication tokens updated successfully.
Note how the weak password is accepted because we are root!
Only root may give a username argument to passwd to change the password of someone
else.
5 Switch to a virtual terminal. Try to login as the new user.
Press <CTRL><ALT><F1> to go to virtual terminal #1.
Login as student2 / secret
6 Try changing the password of this user.
First try a simple word like "unknown", then to something that is accepted!
You need to mix upper, lower case and some punctuation characters.
7 Inspect the hidden files in the new users home directory.
[student2@system ~]$ ls -a
./ ../ .bash_history .bash_logout .bash_profile .bashrc .emacs .gtkrc
Compare those to /etc/skel.
[student2@system ~]$ ls -a /etc/skel
./ ../ .bash_logout .bash_profile .bashrc .emacs .gtkrc
[student2@system ~]$
File .bash_history is not in /etc/skel. It was created during our first login.

password recovery
1 As root set a new password for one of the accounts you just created.
[student2@system ~]$ su -
.-.-.-
[root@system ~]# passwd student2
Only root can do this!
2 Switch to a virtual terminal, and try to login using the new password.

Unit 02R Basic system configuration 19


Network configuration
Now we will inspect our network configuration.
Graphical tools
Do not change any settings, as we need the network later! We just use the tool to show what's possible
with it.
1 open the "System" menu then choose
"Preferences" -> "System" -> "Network".
2 How are the network settings for eth0 configured? Static of with DHCP?
3 What other network interfaces are there?
See the list in the main window.
4 How is DNS configured?
Go to the DNS tab.
5 Check your firewall settings.
Open the "System" menu then choose "Administration"-> "Firewall and SELinux".
Make sure it set to "Disabled"
Do not enable or change the firewall at this moment.

Network check commands
1 Open a terminal window for root.
[student1@system ~]$ su -
Password: secret
[root@gast244 ~]#
2 Use the ifconfig command to show your network configuration.
[root@system ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:11:25:AB:55:28
inet addr:192.168.65.244 Bcast:192.168.65.255 Mask:255.255.255.0
inet6 addr: fe80::211:25ff:feab:5528/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:44119 errors:0 dropped:0 overruns:0 frame:0
TX packets:40099 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:6009052 (5.7 MiB) TX bytes:19254028 (18.3 MiB)
Base address:0x2000 Memory:d0120000-d0140000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5341 errors:0 dropped:0 overruns:0 frame:0
TX packets:5341 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:37420506 (35.6 MiB) TX bytes:37420506 (35.6 MiB)
3 Use the ping command to ping your neighbor.
[root@system ~]# ping 192.168.65.245
4 Use ifdown eth0. Then try to ping your neighbor again.
You can't ping without an interface: No route to host!
5 Use ifconfig again.
Is eth0 in the list?
No.

20 Lab Exercises OSA Course LI121 System and Network Administration I

6 Now bring up the interface eth0 again.
7 Use ifconfig again.
What about eth0?
It's back.
8 Use netstat -rn.
Where does your default gateway point to?
Try pinging it.
[root@system ~]# ping 192.168.1.65
9 Show your firewall settings:
[root@system ~]# iptables -L -v
10 Set the security level to secure with lokkit.
[root@system ~]# lokkit
11 Show the firewall settings again.
[root@system ~]# iptables -L -v
12 Reset the security level to no firewall.
Check to make sure you have no rules in the firewall!
13 Use the dig command to see th IP address for www.redhat.com.
The address is in the ANSWER section:
.
.
;; ANSWER SECTION:
www.redhat.com. 300 IN A 66.187.232.50
.
.
14 Do traceroute www.redhat.com.
[root@system ~]# traceroute www.redhat.com
(Only works with full internet connectivity. A firewall may block the command.)
15 Let's look at the network interface itself:
Run the ethtool:
[root@system ~]# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes
16 What driver is your card using? In which bus slot?
[root@system ~]# ethtoo -i eth0
driver: e1000
version: 7.3.20-k2-NAPI
firmware-version: N/A
bus-info: 0000:0b:07.0

Unit 02R Basic system configuration 21

Adding a printer
Finally we will add a printer. Your instructor should provide you with the details of the printer. If there is
not printer available we will install a printer that is offered by the instructor.
Ask your instructor for the printer information and record it here:
Printer information Value



Connection type

.... Via Network direct to printer using
.... Using RAW protocol (tcp/9100)
.... Using LPD protocol
.... Using IPP protocol
.... Via Network on other CUPS server
.... Via Network using LPD server
.... Via Network using SMB (Windows)

IP address



Manufacturer



Printer Type



IP Address



Add a printer
1 Open the "System" menu -> "Administration" -> "Printing"
2 Click on new printer.
Enter a name and Description for the new printer.
Enter your name as "location" so we can recognize printers in the classroom.
3 Choose the appropriate connection and hostname for the printer connection.
Choose "AppSocket/HP JetDirect" for a printer with a network interface. Use the setting your instructor
gave you.
4 Choose make and model.
5 Click on the newly installed Local printer and check its options.
Check paper size and print a test page.
6 Click on the "Server Settings" on the left pane.
Enable sharing of printers on the system by checking "Share published printers connected to this
system".
7 Leave the printers tool.
8 Open a web browser onto http://localhost:631 to open the CUPS home page.
Inspect your printer on the CUPS server.
Inspect your printer's "Set Printer Options"
9 If you refresh the "Printers" page after some time you should see the printers from other systems start
appearing.

22 Lab Exercises OSA Course LI121 System and Network Administration I

This happens because you shared your printers earlier.
10 Have a quick peek at CUPS documentation.
Click on the "Documentation/Help" tab in the browser.
Click on "Getting started" read "Printing and Options" and "Standard Printing options". The -o option
of the command line utilities allow you to specify print options. GUI applications provide these options
in a Dialog box.
11 Inspect the /etc/printcap file that is maintained by CUPS for legacy applications.
[root@system ~]# cat /etc/printcap
# This file was automatically generated by cupsd(8) from the
# /etc/cups/printers.conf file. All changes to this file
# will be lost.
printer|Color Laserjet 2650dtn:rm=system244.classroom.net:rp=printer:
PDF_Printer|Print to PDF file on Desktop:rm=system244.classroom.net:rp=PDF_Printer:
12 Let's print a manual page using the command line.
Issue man -t ls | lp -d <your printer>.
The -t option of man formats the manpage into PostScript, and the output is sent to lp which queues
the request. You have to specify the name of your printer after -d. Looking at the printcap file of the
last exercise that would be "printer" for the "Color Laserjet 2650dtn" of the example system.
If you wanted that double sided you could have given:
man -t ls | lp -o sides=two-sided-long-edge
13 Quickly after the lp command type lpq to inspect the print queues.
[root@system ~]# man -t ls | lp -d printer
request id is printer-2 (1 file(s))
[root@system ~]# lpq
printer is ready and printing
Rank Owner Job File(s) Total Size
active root 2 (stdin) 24576 bytes
Stopping Linux
Finally a small lab for identifying Linux and stopping it.
Identify Linux
1 List the contents of /etc/redhat-release.
[student1@system ~]$ cat /etc/redhat-release
Fedora release 9 (Moonshine)
Or on a RedHat system:
[student1@rhsystem ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5 (Tikanga)
2 And look at the contents of /proc/version.
[student1@system ~]$ cat /proc/version
Linux version 2.6.22.7-85.fc9 (kojibuilder@xenbuilder4.fedora.phx.redhat.com) (gcc version 4.1.2
20070502 (Red
Hat 4.1.2-12)) #1 SMP Fri Sep 21 19:53:05 EDT 2007
On RedHat
[student1@rhsystem ~]$ cat /proc/version
Linux version 2.6.18-8.1.6.el5xen (brewbuilder@ls20-bc1-13.build.redhat.com) (gcc version 4.1.1
20070105 (Red
Hat 4.1.1-52)) #1 SMP Fri Jun 1 19:23:33 EDT 2007
The difference is a small extension to the kernel version string....
3 Finally the uname -a command:
[student1@system ~]$ uname -a
Linux system 2.6.22.7-85.fc9 #1 SMP Fri Sep 21 19:53:05 EDT 2007 i686 i686 i386 GNU/Linux
Notice the same small addition to the kernel version string!
4 Run dmidecode to look at serial numbers / installed hardware.

Unit 02R Basic system configuration 23

This is useful if you need to supply information to the manufacturer for support calls etc.
[root@system ~]# dmidecode
# dmidecode 2.7
SMBIOS 2.3 present.
87 structures occupying 2861 bytes.
Table at 0x000F9BB0.

Handle 0x0000, DMI type 0, 20 bytes.
BIOS Information
Vendor: Dell Computer Corporation
Version: A01
Release Date: 09/02/2004
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 1024 kB
Characteristics:
ISA is supported
PCI is supported

Handle 0x0300, DMI type 3, 17 bytes.
Chassis Information
Manufacturer: Dell Computer Corporation
Type: Main Server Chassis
Lock: Present
Version: Not Specified
Serial Number: 5CHMC2J
Asset Tag: Not Specified
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: Unknown
OEM Information: 0x00000000
5 Run lshal to see a listing of recognized hardware:
[root@system ~]# lshal

Dumping 100 device(s) from the Global Device List:
-------------------------------------------------
udi = '/org/freedesktop/Hal/devices/computer'
info.callouts.add = {'hal-storage-cleanup-all-mountpoints'} (string list)
org.freedesktop.Hal.Device.SystemPowerManagement.method_execpaths = {'hal-system-power-
suspend', 'hal-system-power-suspend-clear-error', 'hal-system-power-hibernate', 'hal-system-
power-hibernate-clear-error', 'hal-system-power-shutdown', 'hal-system-power-reboot', 'hal-
system-power-set-power-save'} (string list)
org.freedesktop.Hal.Device.SystemPowerManagement.method_argnames = {'num_seconds_to_sleep', '',
'', '', '', '', 'enable_power_save'} (string list)
org.freedesktop.Hal.Device.SystemPowerManagement.method_signatures = {'i', '', '', '', '', '',
'b'} (string list)
org.freedesktop.Hal.Device.SystemPowerManagement.method_names = {'Suspend',
'SuspendClearError', 'Hibernate', 'HibernateClearError', 'Shutdown', 'Reboot', 'SetPowerSave'}
(string list)
6 Run lspci -v and lsusb -v to see a listing of PCI and USB devices in the system.
root@system:~# lspci -v
02:0e.0 RAID bus controller: Dell PowerEdge Expandable RAID controller 4 (rev 06)
Subsystem: Dell PowerEdge Expandable RAID Controller 4e/Di
Flags: bus master, stepping, 66MHz, medium devsel, latency 64, IRQ 20
Memory at fa0f0000 (32-bit, prefetchable) [size=64K]
Memory at fe9c0000 (32-bit, non-prefetchable) [size=256K]
Expansion ROM at fea00000 [disabled] [size=128K]
Capabilities: [c0] Power Management version 2
Capabilities: [d0] Message Signalled Interrupts: 64bit+ Queue=0/1 Enable-
Capabilities: [e0] PCI-X non-bridge device

7 Take a brief look at the files in /lib/modules/<your kernel version>. Open
modules.pcimap and modules.usbmap. These contain driver / Identification string information.
root@system:~# cd /lib/modules/2.6.22-14-generic/

[root@system 2.6.18-53.1.4.el5xen]# head -10 modules.pcimap
# pci module vendor device subvendor subdevice class class_mask data
heci 0x00008086 0x00002974 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x00002984 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x00002994 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029a4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029b4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029c4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029e4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0

24 Lab Exercises OSA Course LI121 System and Network Administration I

heci 0x00008086 0x000029f4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
nozomi 0x00001931 0x0000000c 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0

[root@system 2.6.18-53.1.4.el5xen]# head -10 modules.usbmap
# usb module match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass
bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info
lmpcm_usb 0x0003 0x046d 0xc50e 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x0
appleir 0x0003 0x05ac 0x8240 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x0
isight_usb 0x0003 0x05ac 0x8501 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x0
8 Print the contents of:
/proc/cpuinfo, /proc/interrupts, /proc/ioports and /proc/iomem.
[root@system ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Xeon(TM) CPU 2.80GHz
...
processor : 1
vendor_id : GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Xeon(TM) CPU 2.80GHz
This system has a Hyperthreading CPU that shows up as two CPU's.
[root@system ~]# cat /proc/interrupts
CPU0 CPU1
1: 269 0 Phys-irq i8042
5: 0 0 Phys-irq parport0
6: 7 0 Phys-irq floppy
8: 1 0 Phys-irq rtc
You get a listing of all interrupt assignments...
[root@system ~]# cat /proc/ioports
0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-006f : keyboard
0070-0077 : rtc
And a listing of the IO port assignment...
[root@system ~]# cat /proc/iomem
00000000-0009ffff : System RAM
000a0000-000bffff : Video RAM area
000cb000-000cbfff : Adapter ROM
000cc000-000ccfff : Adapter ROM
And a listing of the layout of main memory...
These assignments are not used very often anymore on modern systems as everything is
auto configured. But on older systems you had to consult this if you wanted to set jumpers
on expansion cards!

Stopping the machine
1 Read the man page for shutdown(8)
system:~ # man 8 shutdown
Notice that you can send a message waring the users of the upcoming shutdown.
Read the part about the time formats: absolute and relative times.
2 Read the manpage for sync(1).
This command will flush the buffer cache to disk. It is automatically called by the shutdown scripts.
3 Read the manpage for poweroff(8).
This page actually describes several commands to stop / reboot the system.
A reboot will bring the system to runlevel 6.
A halt will bring the system to runlevel 0.
4 Let's reboot our system in 2 minutes with the command line tool shutdown:

Unit 02R Basic system configuration 25

system:~ # shutdown -r +2 "Shutdown because of lab exercise"

Broadcast message from root (pts/0) (Tue Oct 9 14:30:31 2007):

Shutdown because of lab exercise
The system is going DOWN for reboot in 2 minutes!

Broadcast message from root (pts/0) (Tue Oct 9 14:31:31 2007):

Shutdown because of lab exercise
The system is going DOWN for reboot in 1 minute!

Broadcast message from root (pts/0) (Tue Oct 9 14:32:31 2007):

Shutdown because of lab exercise
The system is going down for reboot NOW!
On the console you will see the shutdown scripts doing their work...
5 In addition to the command line you can also shut the machine from the graphical login screen.


27


Let's configure our system. In this lab we will see the basic survival skills of the system administrator.
Prerequisites
The user account we created during installation. We will try to access the Internet. This will only work if
your site is properly connected to the Internet.
Changing display resolution
First we will set the resolution of our display.
Using YaST and SaX2
1 Login with your personal account.
2 Open YaST and goto "Hardware" -> "Graphics Card and Monitor" to launch SaX2.
3 Check your monitor type and change it if needed.
Choose the vendor and monitor type. You may have to look at the back of your screen to determine
the exact type.
4 Choose a resolution and test it!
When testing you will see a "test picture" and a button to accept the new setting.
If something is wrong you can press <CTRL><ALT><BACKSPACE> to quit the test and try another
resolution.
5 When satisfied you save and quit SaX2.
6 Reboot your system for the new setting to take effect.
Rebooting is not strictly needed! Linux sysadmins do not like to reboot the whole system for
minor configuration changes. You could go to a Virtual console, login as root and issue:
rcxdm restart
This will reset the display manager and start one with the new settings.

The x.org tools
1 Look at the contents of /etc/X11/xorg.conf.
GUI: navigate to /etc/X11 and double click on xorg.conf to open if.
command line: less /etc/X11/xorg.conf
Unit 02S Basic system configuration

28 Lab Exercises OSA Course LI121 System and Network Administration I

The file consists of sections. Look for the "ServerLayout". In this section the other parts are assembled
into a server with keyboard, screen and mouse.
2 From a terminal window run xvidtune and play a little with the controls.
On LCD displays this may not have much influence as the display immediately compensates
for any changes you make to the timings.
You really need to know the specs for the Display to know what you should enter here.
3 Press the "show" button to see a modeline statement.
This is the line you would add to your screen section of xorg.conf if you wanted to "save" these
settings. We do not do this now.
4 Now we will test the xorg configuration tools.
First we will save a copy of our existing xorg.conf file so we can restore it later.
5 Logout from the GUI.
6 Switch to text console #1 and login as root
Press caf
login: root
passwd: secret
7 Rename the xorg.conf file to xorg.conf.original
system219:~ # cd /etc/X11/
system219:/etc/X11 # mv xorg.conf xorg.conf.original
8 Now we have to stop the GUI
system219:/etc/X11 # rcxdm stop
Shutting down service gdm done
9 Run xorgconfig.
system219:/etc/X11 # xorgconfig
Answer a few questions. Then quit the program with cC.
We will not try to configure X using this program!
10 Now run xorgcfg and watch the screen.
system219:/etc/X11 # xorgcfg

X Window System Version 7.2.0
Release Date: Sat Sep 22 22:10:58 UTC 2007
X Protocol Version 11, Revision 0, Release 7.2
Build Operating System: openSUSE SUSE LINUX
Current Operating System: Linux system219 2.6.22.5-31-default #1 SMP 2007/09/21 22:29:00 UTC i686
After some time a drawing with your hardware should appear.
Accept this and save it to /etc/X11/xorg.conf; This is done by clicking "quit" to leave then accept
the default config file location.
11 Restart your GUI:
system219:/etc/X11 # rcxdm start
Starting service gdm done
You should be able to login again.
12 Now we will reset our original configuration.
system219:/etc/X11 # cd /etc/X11
system219:/etc/X11 # mv xorg.conf.original xorg.conf
system219:/etc/X11 # rcxdm restart
Shutting down service gdm done
Starting service gdm done
system219:/etc/X11 #
13 Login on the GUI and navigate to /usr/share/sax/api/data/cdb/ Open file Monitors.
This file contains sync settings for many popular displays so you do not have to figure them out from
the display documentation.
Close the file after examination.

Unit 02S Basic system configuration 29

Installing software
Adding software after installation
Graphical tools
1 In YaST choose "Software" -> "Installation Source"
In this window you can set possible source for software.
By default the CD should be listed.
You could add a network source here such as:
http://download.opensuse.org/distribution/10.3/repo/oss/ (For non Open Source
Software or "oss" for open software). The URL should match your distribution (SLES, or OpenSuSE)
and version (10, 10.2 or 10.3). By browsing http://software.opensuse.org/ you can find the
repository for your distribution and version. A list of mirrors near you is at
http://en.opensuse.org/Mirrors_ Released_Version
It is difficult to find the root of a distribution tree, but usually it is a "repo" directory. You need to
experiment a little as the directory structure changes often between OpenSuSE releases at the
moment...
Do not change the sources for now.... Too many people downloading in the classroom may
slow the network! If you want to experiment a little more do so when fewer people are
using the network.
2 Observe the state of the Software Catalogs: On or Off!
3 Leave the Installation Source screen by clicking "Abort".
4 Open "Software management"
5 In the filter box choose "Package groups"
Goto "Amusements" -> "Games" -> "Logic"
6 Choose "Ltris" a Tetris clone with Multiplayer and CPU opponents.
7 Choose Accept
Make sure you have the installation CD in the drive
8 The program is installed. Try it in the "Games" section of "More Applications"
9 Choose not to install more applications and leave Software Management.
10 OpenSuse 10.2 also supports ZENworks to install applications you can access it via the "Install
Software" option on the main menu.
Rumor has it that the OpenSuSE team wants to move away from ZENworks....
Open "Install software". Be patient as the application may be quite slow....
If you want you can install something with it but proceed to the next exercise immediately as you have
to wait quite some time...
It's advised to skip this step for now. The next step will use the program anyway.
11 Browse the installation DVD on your desktop.
Double click the DVD icon on the desktop and go to the "suse/i586" directory.
12 Double click on xpenguins-2-2-663.i586.rpm and install it.
Be patient with "Install software"!
13 Run xpenguins.

30 Lab Exercises OSA Course LI121 System and Network Administration I

"More Applications" -> "New Applications"
To stop the "application" you have to issue killall xpenguins on a command line.

Text tools
1 From a root terminal window make a list of all installed packages.
# rpm -qa
2 Show detailed information about the ltris package we installed earlier.
# rpm -qi ltris
You need a package name here, not a rpm filename!
3 List the description of package of xsnow from the DVD.
This package is NOT installed at present, so you need to use the -p flag and the filename as opposed
to the package name.
Packages are on the DVD in directory /media/SUSE1020.001/suse/i586.
system:~ # cd /media/SU1020.001/suse/i586/

system:/media/SU1020.001/suse/i586 # rpm -qip xsnow-1.42-293.i586.rpm

Name : xsnow Relocations: (not relocatable)
Version : 1.42 Vendor: SUSE LINUX Products GmbH, Nuernberg,
Germany
Release : 293 Build Date: Tue Nov 28 02:35:09 2006
Install Date: (not installed) Build Host: kalman.suse.de
Group : Amusements/Toys/Background Source RPM: xsnow-1.42-293.src.rpm
Size : 102228 License: Public Domain, Freeware, Other
License(s), see package
Signature : DSA/SHA1, Tue Nov 28 02:48:27 2006, Key ID a84edae89c800aca
Packager : http://bugs.opensuse.org
URL : http://www.euronet.nl/~rja/Xsnow/
Summary : A Christmas Animation
Description :
A nice animation. Santa Claus drives across the screen, pulled by his
reindeer. It snows and the snow accumulates on top of the windows.
Authors: Rick Jansen <rick@sara.nl>
Distribution: openSUSE 10.2 (i586)

4 Install xsnow and run it.
system:~# rpm -ivh /media/SUSE1020.001/suse/i586/xsnow-1.42-293.i386.rpm
system:~# xsnow
^c
system:~#
5 Remove the package.
system:# rpm -e xsnow
Creating user accounts
Next we will create some accounts.
Graphical tool
1 Login as root on the graphical desktop.
2 Open "System" -> "Yast"
3 Choose "Security and Users" -> "Users management"
4 Add a new user.
Full name: First Student
Username: student1
Password: secret

Unit 02S Basic system configuration 31

Accept the notices about password security!
5 Check the account expiration data for your own personal account.
Choose your account from the list, then go to the "Password settings" tab.

6 Check your group memberships.
This can be seen on the "Details" page.
7 Close user manager.
The useradd command
1 Open a terminal window.
Open the start menu More Application -> System -> Gnome Terminal.
2 Change to the root user with su.
user@system:~> su -
Password secret
system:~#
3 Add a user with the useradd command.
system:~# useradd -m -c "Second Student" student2
You need the -m flag to create a home directory for the user.
The -c flag sets a Full Name for the user. Always a good idea on a busy system.
4 Next you have to set a password for the new user.
system:~# passwd student2
Changing password for student2
New Password: secret
Bad Password: Too simple
Reenter New Password: secret
Password changed.
Note how the weak password is accepted because we are root!
Only root may give a username argument to passwd to change the password of someone
else.
5 Switch to a virtual terminal. Try to login as the new user.
Press <CTRL><ALT><F1> to go to virtual terminal #1.
Login as student2 / secret
6 Try changing the password of this user.
First try a simple word like "unknown", then to something that is accepted!
You need to mix upper, lower case and some punctuation characters.
7 Inspect the hidden files in the new users home directory.
student2@system:~> ls -a
Compare those to /etc/skel.
student2@system:~> ls -a /etc/skel
password recovery
1 As root set a new password for one of the accounts you just created.
[student2@system ~]$ su -
.-.-.-
[root@system ~]# passwd student2
Only root can do this!
2 Switch to a virtual terminal, and try to login using the new password.

32 Lab Exercises OSA Course LI121 System and Network Administration I

Network configuration
Now we will inspect our network configuration.
Graphical tools
Do not change any settings, as we need the network later! We just use the tool to show what's possible
with it.
1 Open the main menu "More Applications"-> "System" -> "YaST".
2 Choose "Network devices" -> "Network Card"
3 How are the network settings for eth0 configured? Static of with DHCP?
4 What other network interfaces are there?
See the list in the main window.
5 How is DNS configured?
Go to the DNS tab.
The DNS settings are probably supplied by your DHCP server, you can however view the
current settings.
6 Check your firewall settings for this interface on the General tab.
Make sure it set to "Firewall Disabled"!
7 Check the firewall settings in YaST -> "Users and Security" -> Firewall
Do not change anything!
Inspect the interface zone definitions, masquerading and exceptions.

Network check commands
1 Open the main menu and choose "More Applications" -> "System" -> network tools.
This will open the graphical network check toolbox.
Experiment a little with the tools in the various panes.
Try to ping your neighbour.
2 Use the root terminal window.
3 Use the ifconfig command in a terminal window to show your network configuration.
user@system:~> su -
Password: secret
system:~ # ifconfig
eth0 Link encap:Ethernet HWaddr 00:06:93:20:15:EC
inet addr:192.168.65.219 Bcast:192.168.65.255 Mask:255.255.255.0
inet6 addr: fe80::206:93ff:fe20:15ec/64 Scope:Link
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:174125 errors:0 dropped:0 overruns:0 frame:0
TX packets:155875 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33204918 (31.6 Mb) TX bytes:118142859 (112.6 Mb)
Interrupt:201 Base address:0xe000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0

Unit 02S Basic system configuration 33

RX bytes:1200 (1.1 Kb) TX bytes:1200 (1.1 Kb)
4 Use the ping command to ping your neighbor.
system:~ # ping 192.168.65.218
5 Use ifdown eth0. Then try to ping your neighbor again.
You can't ping without an interface: No route to host!
6 Use ifconfig again.
Is eth0 in the list?
No.
7 Now bring up the interface eth0 again.
8 Use ifconfig again.
What about eth0?
It's back.
9 Use netstat -rn.
Where does your default gateway point to?
The entry with destination 0.0.0.0 is the default route of your system.
Try pinging it.
system:~ # ping 192.168.1.65
10 Show your firewall settings:
system:~ # iptables -L -v
There should be no rules as we turned off the firewall at installation.
11 Open the firewall management in YaST
Choose "Security and users" -> " Firewall"
12 Inspect and note that your interface is in the "External zone".
Add the ssh and " HTTP server" service to "allowed services".
Click next to install the new rules.
13 Return to the firewall setup screen of YaST and turn on the Firewall.
14 Show your firewall settings again:
system:~ # iptables -L -v
There should be numerous rules including rules for http and ssh:
0 0 LOG tcp -- any any anywhere anywhere limit: avg 3/min burst
5 tcp dpt:http flags:FIN,SYN,RST,ACK/SYN LOG level warning tcp-options
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:http
1 60 LOG tcp -- any any anywhere anywhere limit: avg 3/min burst
5 tcp dpt:ssh flags:FIN,SYN,RST,ACK/SYN LOG level warning tcp-options
1 60 ACCEPT tcp -- any any anywhere anywhere tcp dpt:ssh
15 Return to the firewall setup screen of YaST and turn OFF the Firewall!
Check that the firewall ruleset is empty!
16 Use the dig command to see th IP address for www.suse.com.
The address is in the ANSWER section:
system:~ # dig www.suse.com

; <<>> DiG 9.3.2 <<>> www.suse.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59331
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;www.suse.com. IN A

;; ANSWER SECTION:
www.suse.com. 300 IN A 195.135.220.3

;; AUTHORITY SECTION:

34 Lab Exercises OSA Course LI121 System and Network Administration I

suse.com. 300 IN NS ns1.suse.de.
suse.com. 300 IN NS ns2.suse.de.

;; ADDITIONAL SECTION:
ns1.suse.de. 14400 IN A 195.135.220.2
ns2.suse.de. 14400 IN A 195.135.220.15

;; Query time: 410 msec
;; SERVER: 192.168.65.1#53(192.168.65.1)
;; WHEN: Fri Sep 28 11:38:42 2007
;; MSG SIZE rcvd: 121
Do traceroute www.redhat.com.
# traceroute www.redhat.com
(Only works with full internet connectivity. A firewall may block this command.)
17 Let's look at the network interface itself:
Run the ethtool:
system:~ # ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes
18 What driver is your card using? In which bus slot?
system:~ # ethtool -i eth0
driver: tg3
version: 3.77
firmware-version: 5751m-v3.29a
bus-info: 0000:10:00.0
Adding a Printer
Finally we will add a printer. Your instructor should provide you with the details of the printer. If there is
not printer available we will install a printer that is offered by the instructor.
Ask your instructor for the printer information and record it here:
Printer information Value



Connection type

.... Via Network direct to printer using
.... Using RAW protocol (tcp/9100)
.... Using LPD protocol
.... Using IPP protocol
.... Via Network on other CUPS server
.... Via Network using LPD server
.... Via Network using SMB (Windows)

IP address



Manufacturer



Unit 02S Basic system configuration 35


Printer Type



IP Address



Add a printer
1 Open YaST -> "Hardware" -> "Printer"
2 Click "Add"
3 Choose connection type "Network".
4 Choose network connection type as noted above.
5 Enter hostname and test the connection
6 Enter a description and enter your name as "location" so we can see who is owning a printer in the
classroom.
Make sure "Share printer" is on.
7 Choose Manufacturer and Model from the lists.
It is possible the system wants to install updated printer drivers. Allow this to happen.
8 Check the configuration options.
In particular Default paper Size: set it to what is common in your location.
Test the printer.
Testing is only useful if a printer is available.
9 Open a web browser onto http://localhost:631 to open the CUPS home page.
Inspect your printer on the CUPS server.
Inspect your printer's "Set Printer Options"
10 If you refresh the "Printers" page after some time you should see the printers from other systems start
appearing.
This happens because you shared your printers earlier.
11 Have a quick peek at CUPS documentation.
Click on the "Documentation/Help" tab in the browser.
Click on "Getting started" read "Printing and Options" and "Standard Printing options". The -o option
of the command line utilities allow you to specify print options. GUI applications provide these options
in a Dialog box.
12 Inspect the /etc/printcap file that is maintained by CUPS for legacy applications.
[root@system ~]# cat /etc/printcap
# This file was automatically generated by cupsd(8) from the
# /etc/cups/printers.conf file. All changes to this file
# will be lost.
printer|Color Laserjet 2650dtn:rm=system244.classroom.net:rp=printer:
PDF_Printer|Print to PDF file on Desktop:rm=system244.classroom.net:rp=PDF_Printer:
13 Let's print a manual page using the command line.
Issue man -t ls | lp -d <your printer>.
The -t option of man formats the manpage into PostScript, and the output is sent to lp which queues
the request. You have to specify the name of your printer after -d. Looking at the printcap file of the
last exercise that would be "printer" for the "Color Laserjet 2650dtn" of the example system.
If you wanted that double sided you could have given:
man -t ls | lp -o sides=two-sided-long-edge

36 Lab Exercises OSA Course LI121 System and Network Administration I

14 Quickly after the lp command type lpq to inspect the print queues.
[root@system ~]# man -t ls | lp -d printer
request id is printer-2 (1 file(s))
[root@system ~]# lpq
printer is ready and printing
Rank Owner Job File(s) Total Size
active root 2 (stdin) 24576 bytes
Stopping Linux
Finally a small lab for identifying Linux and stopping it.
Identify Linux
1 List the contents of /etc/SuSE-release.
student1@system:~> cat /etc/SuSE-release
openSUSE 10.2 (i586)
VERSION = 10.2
2 And look at the contents of /proc/version.
student1@system:~> cat /proc/version
Linux version 2.6.18.2-34-default (geeko@buildhost) (gcc version 4.1.2 20061115 (prerelease)
(SUSE Linux)) #1
SMP Mon Nov 27 11:46:27 UTC 2006
3 Finally the uname -a command:
student1@system:~> uname -a
Linux system 2.6.18.2-34-default #1 SMP Mon Nov 27 11:46:27 UTC 2006 i686 i686 i386 GNU/Linux
Notice that it is hard to see the distribution from this output!
4 Run dmidecode to look for serial numbers / hardware etc:
student1@system:~# dmidecode
# dmidecode 2.9
SMBIOS 2.3 present.
23 structures occupying 972 bytes.
Table at 0x000F2D5C.

Handle 0x0000, DMI type 0, 20 bytes
BIOS Information
Vendor: Hewlett-Packard
Version: 68DTV Ver. F.0E
Release Date: 07/22/2005
Address: 0xE0000
Runtime Size: 128 kB
ROM Size: 1024 kB
Characteristics:
PCI is supported
PC Card (PCMCIA) is supported

Handle 0x0003, DMI type 3, 13 bytes
Chassis Information
Manufacturer: Hewlett-Packard
Type: Notebook
Lock: Not Present
Version: Not Specified
Serial Number: CNU54049YS
Asset Tag: CNU54049YS
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: External Interface Enabled
5 Run lshal to see a listing of recognized hardware:
student@system:~> lshal

Dumping 117 device(s) from the Global Device List:
-------------------------------------------------
udi = '/org/freedesktop/Hal/devices/computer'
info.addons = {'hald-addon-cpufreq', 'hald-addon-acpi'} (string list)
info.bus = 'unknown' (string)
info.callouts.add = {'hal-storage-cleanup-all-mountpoints'} (string list)

Unit 02S Basic system configuration 37

info.capabilities = {'cpufreq_control'} (string list)
info.interfaces = {'org.freedesktop.Hal.Device.SystemPowerManagement',
'org.freedesktop.Hal.Device.resmgr', 'org.freedesktop.Hal.Device.CPUFreq'} (string list)
info.product = 'Computer' (string)
info.subsystem = 'unknown' (string)
6 Run lspci -v and lsusb -v to see a listing of PCI and USB devices in the system.
student@system:~> sudo lspci -v
10:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5751M Gigabit Ethernet PCI Express
(rev 11)
Subsystem: Hewlett-Packard Company Unknown device 0934
Flags: bus master, fast devsel, latency 0, IRQ 16
Memory at c8000000 (64-bit, non-prefetchable) [size=64K]
Capabilities: [48] Power Management version 2
Capabilities: [50] Vital Product Data
Capabilities: [58] Message Signalled Interrupts: Mask- 64bit+
Queue=0/3 Enable-
Capabilities: [d0] Express Endpoint IRQ 0
Capabilities: [100] Advanced Error Reporting
Capabilities: [13c] Virtual Channel

7 Take a brief look at the files in /lib/modules/<your kernel version>. Open
modules.pcimap and modules.usbmap. These contain driver / Identification string information.
student@system:~$ cd /lib/modules/2.6.22.13-0.3-default/

student@system:/lib/modules/2.6.22.13-0.3-default$ head -10 modules.pcimap
# pci module vendor device subvendor subdevice class class_mask data
heci 0x00008086 0x00002974 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x00002984 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x00002994 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029a4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029b4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029c4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029e4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029f4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
nozomi 0x00001931 0x0000000c 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0

student@system:/lib/modules/2.6.22.13-0.3-default$ head -10 modules.usbmap
# usb module match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass
bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info
lmpcm_usb 0x0003 0x046d 0xc50e 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x0
appleir 0x0003 0x05ac 0x8240 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x0
isight_usb 0x0003 0x05ac 0x8501 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x0
8 Print the contents of:
/proc/cpuinfo, /proc/interrupts, /proc/ioports and /proc/iomem.
student@system:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 13
model name : Intel(R) Pentium(R) M processor 1.73GHz
This system has a Hyperthreading CPU that shows up as two CPU's.
[root@system ~]# cat /proc/interrupts
CPU0 CPU1
1: 269 0 Phys-irq i8042
5: 0 0 Phys-irq parport0
6: 7 0 Phys-irq floppy
8: 1 0 Phys-irq rtc
You get a listing of all interrupt assignments...
[root@system ~]# cat /proc/ioports
0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-006f : keyboard
0070-0077 : rtc
And a listing of the IO port assignment...
[root@system ~]# cat /proc/iomem
00000000-0009ffff : System RAM
000a0000-000bffff : Video RAM area
000cb000-000cbfff : Adapter ROM
000cc000-000ccfff : Adapter ROM
And a listing of the layout of main memory...

38 Lab Exercises OSA Course LI121 System and Network Administration I

These assignments are not used very often anymore on modern systems as everything is
auto configured. But on older systems you had to consult this if you wanted to set jumpers
on expansion cards!

Stopping the machine
1 Read the man page for shutdown(8)
system:~ # man 8 shutdown
Notice that you can send a message waring the users of the upcoming shutdown.
Read the part about the time formats: absolute and relative times.
2 Read the man page for sync(1).
This command will flush the buffer cache to disk. It is automatically called by the shutdown scripts.
3 Read the man page for poweroff(8).
This page actually describes several commands to stop / reboot the system.
A reboot will bring the system to runlevel 6.
A halt will bring the system to runlevel 0.
4 Let's reboot our system in 2 minutes with the command line tool shutdown:
system:~ # shutdown -r +2 "Shutdown because of lab exercise"

Broadcast message from root (pts/0) (Tue Oct 9 14:30:31 2007):

Shutdown because of lab exercise
The system is going DOWN for reboot in 2 minutes!

Broadcast message from root (pts/0) (Tue Oct 9 14:31:31 2007):

Shutdown because of lab exercise
The system is going DOWN for reboot in 1 minute!

Broadcast message from root (pts/0) (Tue Oct 9 14:32:31 2007):

Shutdown because of lab exercise
The system is going down for reboot NOW!
On the console you will see the shutdown scripts doing their work...
5 In addition to the command line you can also shut the machine from the graphical login screen.


39


Let's configure our system. In this lab we will see the basic survival skills of the system administrator.
Prerequisites
The user account we created during installation. We will try to access the Internet. This will only work if
your site is properly connected to the Internet.
Changing display resolution
First we will set the resolution of our display.
Using the screen resolution utility
1 Login with your personal account.
2 Open the "Screen Resolution" utility
Open the System menu and choose "Preferences" -> "Screen Resolution".
3 Choose a resolution!
4 There is another utility that allows you to set the drivers and monitor settings.
Open the System menu and choose "Administration -> Screens and Graphics"
5 Enter your personal password.
6 Check your monitor type and change it if needed.
Choose the vendor and monitor type. You may have to look at the back of your screen to determine
the exact type.
The x.org tools
1 Look at the contents of /etc/X11/xorg.conf.
GUI: navigate to /etc/X11 and double click on xorg.conf to open if.
command line: less /etc/X11/xorg.conf
The file consists of sections. Look for the "ServerLayout". In this section the other parts are assembled
into a server with keyboard, screen and mouse.
2 From a terminal window run xvidtune and play a little with the controls.
On LCD displays this may not have much influence as the display immediately compensates
for any changes you make to the timings.
You really need to know the specs for the Display to know what you should enter here.
Unit 02U Basic System configuration

40 Lab Exercises OSA Course LI121 System and Network Administration I

3 Press the "show" button to see a modeline statement.
This is the line you would add to your screen section of xorg.conf if you wanted to "save" these
settings. We do not do this now.
4 Now we will test the xorg configuration tools.
First we will save a copy of our existing xorg.conf file so we can restore it later.
5 Logout from the GUI.
6 Switch to text console #1 and login as root
Press caf
ubuntu login: <your account>
passwd: *******
7 Rename the xorg.conf file to xorg.conf.original
student@ubuntu:~$ cd /etc/X11/
student@ubuntu:/etc/X11$ sudo mv xorg.conf xorg.conf.original
[sudo] password for student: ******
8 Now we have to stop the GUI
student@ubuntu:~$ sudo /etc/init.d/gdm stop
* Stopping GNOME Display Manager [ OK ]
9 Run dpkg-reconfigure.
student@ubuntu:/etc/X11$ sudo dpkg-reconfigure xserver-xorg
Answer all questions. (Choosing the proposed defaults often is the right choice!)
10 Restart the Graphical subsystem:
student@ubuntu:/etc/X11$ sudo /etc/init.d/gdm start
* Starting GNOME Display Manager [ OK ]
11 Login the Graphical environment with your personal account.
12 Now we will reset our original configuration.
student@ubuntu:/etc/X11$ cd /etc/X11
student@ubuntu:/etc/X11$ mv xorg.conf.original xorg.conf
student@ubuntu:/etc/X11$ sudo /etc/init.d/gdm restart
* Stopping GNOME Display Manager [ OK ]
* Starting GNOME Display Manager [ OK ]
Installing software
Adding software after installation.
Synaptic Graphical tool
First we will investigate the graphical tools available.
1 On the System menu open "Administration" -> "Synaptic Package Manager".
2 Enter your personal password.
3 Inspect the various categories.
4 Add openssh-server from the
"Networking" Package group.
Select it.
5 When satisfied choose "Apply" to install the selections.
Observe that some dependencies were selected for the package in the "Show Details".
This lab only works with an Internet connection as the software is downloaded from the on-
line repository!
6 Close the tool.

Unit 02U Basic System configuration 41

7 Inspect the Repositories that are enabled with the "Software Sources" tool in the "System"->
"Administration" menu.
Enter you personal password.
You may want to enable additional repositories.
Using dpkg
Dpkg is a log level tool that handles package installation and keeps track of what's installed on a system. It
is very low level and is hardly used in day to day management.
1 From a root terminal window make a list of all installed packages.
student1@ubuntu ~$ dpkg --list
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============- =================- ==========================
ii acpi 0.09-3ubuntu1 displays information on ACPI devices
ii acpi-support 0.103 Collection of useful events for acpi
ii acpid 1.0.4-5ubuntu8 Utils for using ACPI power management
ii adduser 3.103ubuntu1 Add and remove users and groups
ii alacarte 0.11.3-1ubuntu1 easy GNOME menu editing tool
.......
2 Show the files installed by the openssh-server package we installed earlier.
student1@ubuntu ~$ dpkg --listfiles openssh-server
/etc/init.d/ssh
/etc/default/ssh
/etc/network/if-up.d/openssh-server
/etc/pam.d/ssh
/usr/lib/openssh/sftp-server
/usr/sbin/sshd
/usr/share/man/man5/sshd_config.5.gz
/usr/share/man/man8/sshd.8.gz
/usr/share/man/man8/sftp-server.8.gz
You need a package name here, not a dpkg filename!
3 List the package that installed /bin/ls.
dpkg --search /bin/ls
coreutils: /bin/ls
4 Working with dselect: This tool was the first interactive tool to install software. It has been
superseded by more modern tools.
Start deselect
student@ubuntu:/etc/apt$ sudo dselect
[sudo] password for student: ****
Go to the [I]nstall menu and read the Help information.
Do not install any software right now with dselect!
Play a little with the interface, then leave it.
Using aptitude
aptitude is a neat command-line tool that provides a rich interface to perform day to day package
management. It also includes an interactive text interface.
1 Search for packages providing exaile which is a media player using yum.
student@ubuntu ~$ aptitude search exaile
p exaile - flexible audio player, similar to Amarok, but
2 The "p" flag shwos the package is not installed.
3 Show more information about exaile.
student@ubuntu:~$ aptitude show exaile
Package: exaile
State: not installed
Version: 0.2.10+debian-1.1ubuntu2

42 Lab Exercises OSA Course LI121 System and Network Administration I

Priority: optional
Section: universe/sound
Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>
Uncompressed Size: 2060k
Depends: python (>= 2.5), python (< 2.6), python-support (>= 0.2),
libatk1.0-0 (>=1.13.2), libc6 (>= 2.6-1), libcairo2 (>= 1.4.0),
libfontconfig1 (>= 2.4.0), libglib2.0-0 (>= 2.14.0),
libgtk2.0-0 (>= 2.12.0), libpango1.0-0 (>= 1.18.2), libx11-6,
libxcomposite1 (>= 1:0.3-1), libxcursor1 (> 1.1.2),
libxdamage1 (>= 1:1.1), libxext6, libxfixes3 (>= 1:4.0.1)enttree
Recommends: gstreamer0.10-plugins-ugly, python-gnome2-extras, python-cddb,
streamripper, python-gpod, python-gamin, python-notify,
python-gtkhtml2
Description: flexible audio player, similar to Amarok, but written in GTK+
Exaile is a media player aiming to be similar to KDE's Amarok, but for
GTK+. It incorporates many of the cool things from Amarok (and other media
players) like automatic fetching of album art, handling of large libraries,
lyrics fetching, artist/album information via the wikipedia, last.fm
support, optional iPod support (assuming you have python-gpod installed).

In addition, Exaile also includes a built-in shoutcast directory browser,
tabbed playlists (so you can have more than one playlist open at a time),
blacklisting of tracks (so they don't get scanned into your library),
downloading of guitar tablature from fretplay.com, and submitting played
tracks on your iPod to last.fm.

Homepage: http://www.exaile.org/

4 Let's install the exaile package.
student@ubuntu:~$ aptitude install exaile
As you can see it automatically selects many dependent packages:
student@ubuntu:~$ sudo aptitude install exaile
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Building tag database... Done
The following NEW packages will be automatically installed:
gstreamer0.10-plugins-ugly liba52-0.7.4 libdvdread3 libid3tag0 libmad0
libmpeg2-4 libsidplay1 libtre4 python-cddb python-elementtree python-gamin
python-gpod python-mutagen python-pyogg python-pysqlite2 python-pyvorbis
streamripper
The following packages have been kept back:
libxml2 libxml2-utils python-libxml2
The following NEW packages will be installed:
exaile gstreamer0.10-plugins-ugly liba52-0.7.4 libdvdread3 libid3tag0
libmad0 libmpeg2-4 libsidplay1 libtre4 python-cddb python-elementtree
python-gamin python-gpod python-mutagen python-pyogg python-pysqlite2
python-pyvorbis streamripper

0 packages upgraded, 18 newly installed, 0 to remove and 3 not upgraded.
Need to get 1929kB of archives. After unpacking 7868kB will be used.
Do you want to continue? [Y/n/?] Y
Choose Y to continue the installation.
Writing extended state information... Done
Get:1 http://nl.archive.ubuntu.com gutsy/main python-pysqlite2 2.3.4-2 [72.5kB]
Get:2 http://nl.archive.ubuntu.com gutsy/main python-pyogg 1.3-1.1ubuntu4 [19.6kB]
Get:3 http://nl.archive.ubuntu.com gutsy/main python-pyvorbis 1.3-1.2ubuntu2 [50.8kB]
... deleted...
Get:17 http://nl.archive.ubuntu.com gutsy/main python-gpod 0.5.2-2 [493kB]
Get:18 http://nl.archive.ubuntu.com gutsy/universe streamripper 1.62.2-2 [73.9kB]
Fetched 1929kB in 6s (308kB/s)
Selecting previously deselected package python-pysqlite2.
(Reading database ... 89108 files and directories currently installed.)
Unpacking python-pysqlite2 (from .../python-pysqlite2_2.3.4-2_i386.deb) ...
Selecting previously deselected package python-pyogg.
Unpacking python-pyogg (from .../python-pyogg_1.3-1.1ubuntu4_i386.deb) ...
... deleted ...
Unpacking python-gpod (from .../python-gpod_0.5.2-2_i386.deb) ...
Selecting previously deselected package streamripper.
Unpacking streamripper (from .../streamripper_1.62.2-2_i386.deb) ...
Setting up python-pysqlite2 (2.3.4-2) ...
Setting up python-pyogg (1.3-1.1ubuntu4) ...
Setting up python-pyvorbis (1.3-1.2ubuntu2) ...
... deleted ...

Unit 02U Basic System configuration 43

Setting up python-gpod (0.5.2-2) ...
Setting up streamripper (1.62.2-2) ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Building tag database... Done

5 Check the files in /etc/apt and see that some pre-defined repositories in sources.list are not
enabled.
You can add a file to the sources.list.d directory if you want to more repositories. For now we leave
adding repositories as it is...
6 Finally start aptitude without any options. You will enter the interactive text interface. Spend some
time exploring the text interface.
You can search for packages with "/".
Pressing enter will show detailed information about a package.
With "+" you select a package for later install.
With "g" (go) you will start dependency resolution, download and install.
With "q" you leave sub screens and at the top level aptitude itself.

Creating user accounts
Graphical tool
1 Login as on the graphical desktop.
2 Open "System" -> "Administration -> "Users and Groups"
3 Add a new user.
Full name: First Student
Username: student1

44 Lab Exercises OSA Course LI121 System and Network Administration I

Password: secret

4 Check the account expiration data for your own personal account.
Choose your account from the list, then go to the "Password settings" tab.
5 Check your group memberships.
This can be seen on the "User Privileges" page.
6 Close user manager.
The useradd command
1 Open a terminal window.
Open the start menu "Applications" -> "Accessories" -> "Terminal".
2 Add a user with the useradd command.
student@ubuntu~$ sudo useradd -m -c "Second Student" student2
[sudo] password for student: ****
You need the -m flag to create a home directory for the user.
The -c flag sets a Full Name for the user. Always a good idea on a busy system.
3 Next you have to set a password for the new user.
system:~# passwd student2

Unit 02U Basic System configuration 45

Changing password for student2
Enter new UNIX password: secret
Retype new UNIX password: secret
passwd: password updated successfully
The passwd command now sets the password for someone else because we perform this
action as root through sudo!
Only root may give a username argument to passwd to change the password of someone
else.
4 Switch to a virtual terminal. Try to login as the new user.
Press <CTRL><ALT><F1> to go to virtual terminal #1.
Login as student2 / secret
5 Change the password of this user.
It may be a good idea to reset it to what it was so you do not forget it.
However you now know how to reset a lost password!
6 There is a difference between the two users we created. The user-admin tool does a lot more than
the useradd tool!
Compare the accounts of student1 and student2:
student@ubuntu:~$ finger student1 student2
Login: student1 Name: First Student
Directory: /home/student1 Shell: /bin/bash
Never logged in.
No mail.
No Plan.

Login: student2 Name: Second Student
Directory: /home/student2 Shell: /bin/sh
Last login Tue Jan 15 14:51 (CET) on pts/3 from atlas.overschie.nl
No mail.
No Plan.

student@ubuntu:~$ id student1
uid=1001(student1) gid=1001(student1)
groups=1001(student1),4(adm),20(dialout),21(fax),24(cdrom),25(floppy),26(tape),29(audio),30(dip),46(plugdev)
,104(scanner),106(fuse)

student@ubuntu:~$ id student2
uid=1002(student2) gid=1002(student2) groups=1002(student2)
Useradd gives the user a Bourne shell (/bin/sh) in stead of the BASH shell. Also user-admin makes the
new user a member of several groups to allow all kinds of functions.
The files /etc/login.defs and /etc/default/useradd set these defaults. You have to use an
editor to change the defaults for new users created with useradd.
7 Inspect the hidden files in the new users home directory.
On the new user's session:
$ ls -a
. .. .bash_logout .bashrc Examples .profile
Compare those to /etc/skel.
$ ls /etc/skel
Examples
$ ls -a /etc/skel
. .. .bash_logout .bashrc Examples .profile
All files from /etc/skel are copied to the home directory of a new user. You can add files that you want
to appear in every new user's home directory to /etc/skel.
Password recovery
Only root can set the password of someone else. On Ubuntu you have to use the sudo command to
execute a command as root.
1 As root set a new password for one of the accounts you just created.

46 Lab Exercises OSA Course LI121 System and Network Administration I

student@ubuntu:~$ sudo passwd student2
[sudo] password for students:
Enter new UNIX password: secret
Retype new UNIX password: secret
passwd: password updated successfully
Only members of the adm group can use sudo to do this!
2 Switch to a virtual terminal, and try to login using the new password.
Network Configuration
Let's check how to configure and test the network.
Graphical tools
Do not change any settings, as we need the network later! We just use the tool to show what's possible
with it.
1 Open the "System" menu then choose
"Administration" -> "Network".
Enter your password.
2 What network interfaces are there?
See the list in the main window.
3 How are the network settings for eth0 configured? Static of with DHCP?
Ubuntu shows DHCP as "Roaming mode"
4 How is DNS configured?
Go to the DNS tab.
5 What is the name of your system?
See the General page.
6 Open the "Hosts" page.
Here is a list of a few well known IP address to host name mappings. These are used when DNS is not
functioning. (Such as during boot).
Network Check commands
1 Open the main menu and choose "More Applications" -> "System" -> network tools.
This will open the graphical network check toolbox.
Experiment a little with the tools in the various panes.
Try to ping your neighbour.
2 Use the root terminal window.
3 Use the ifconfig command in a terminal window to show your network configuration.
student@ubuntu:~$ sudo ifconfig
[sudo] password for student: secret
system:~ # ifconfig
eth0 Link encap:Ethernet HWaddr 00:06:93:20:15:EC
inet addr:192.168.65.219 Bcast:192.168.65.255 Mask:255.255.255.0
inet6 addr: fe80::206:93ff:fe20:15ec/64 Scope:Link
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:174125 errors:0 dropped:0 overruns:0 frame:0
TX packets:155875 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33204918 (31.6 Mb) TX bytes:118142859 (112.6 Mb)
Interrupt:201 Base address:0xe000


Unit 02U Basic System configuration 47

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1200 (1.1 Kb) TX bytes:1200 (1.1 Kb)
4 Use the ping command to ping your neighbor.
system:~ # ping 192.168.65.218
You have to ask your neighbour for his IP address.
5 Use netstat -rn.
Where does your default gateway point to?
The entry with destination 0.0.0.0 is the default route of your system.
Try pinging it.
student@ubuntu:~$ ping 192.168.1.65
PING 192.168.1.65 (192.168.1.65) 56(84) bytes of data.
64 bytes from 192.168.1.65: icmp_seq=1 ttl=64 time=3.88 ms
64 bytes from 192.168.1.65: icmp_seq=2 ttl=64 time=0.250 ms

--- 192.168.1.65 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.250/2.065/3.881/1.816 ms
6 Show your firewall settings:
student@ubuntu:~$ sudo iptables -L -v
Chain INPUT (policy ACCEPT 19694 packets, 32M bytes)
pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 18219 packets, 33M bytes)
pkts bytes target prot opt in out source destination
There should be no rules as we turned off the firewall at installation.
7 Graphical firewall management:
The default installation does not include a graphical firewall tool
These labs assume we have firestarter installed with
student@ubuntu$ sudo aptitude install firestarter
Open the firewall management in YaST
Choose "Applications" -> "Internet" -> " Firestarter"
8 Answer the questions of the wizzard.
You eth0 interface is connected to the internet.
No connection sharing.
9 Add the ssh and HTTP service to the "Allow service" pane of the window.
Go to the "Policy" page and click on the Allowed services part of the screen. Now the "Add Rule"
button becomes clickable. Make sure you are editing the "Inbound Policy"
Fill the form two time for the two protocols we want to allow.
Click "Apply Policy" to install the new rules.
10 Show your firewall settings again:
student@ubuntu$ sudo iptables -L -v -n
There should be numerous rules including rules for http and ssh:
0 0 LOG tcp -- any any anywhere anywhere limit: avg 3/min burst
5 tcp dpt:http flags:FIN,SYN,RST,ACK/SYN LOG level warning tcp-options
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:http
1 60 LOG tcp -- any any anywhere anywhere limit: avg 3/min burst
5 tcp dpt:ssh flags:FIN,SYN,RST,ACK/SYN LOG level warning tcp-options
1 60 ACCEPT tcp -- any any anywhere anywhere tcp dpt:ssh

48 Lab Exercises OSA Course LI121 System and Network Administration I

11 Return to the firestarter and turn OFF the Firewall!
Check that the firewall ruleset is empty!
12 Use the dig command to see th IP address for www.ubuntu.com.
The address is in the ANSWER section:
student@ubuntu:~$ dig www.ubuntu.com

; <<>> DiG 9.4.1-P1 <<>> www.ubuntu.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3376
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 0

;; QUESTION SECTION:
;www.ubuntu.com. IN A

;; ANSWER SECTION:
www.ubuntu.com. 600 IN A 91.189.94.158

;; AUTHORITY SECTION:
ubuntu.com. 288 IN NS ns1.mythic-beasts.com.
ubuntu.com. 288 IN NS ns2.mythic-beasts.com.
ubuntu.com. 288 IN NS ns.ubuntu.com.

;; Query time: 25 msec
;; SERVER: 192.168.65.2#53(192.168.65.2)
;; WHEN: Tue Jan 15 16:53:01 2008
;; MSG SIZE rcvd: 115

(Only works with full internet connectivity. A firewall may block this command.)
13 Let's look at the network interface itself:
Run the ethtool:
student@ubuntu:~$ sudo ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes
14 What driver is your card using? In which bus slot?
student@ubuntu:~$ ethtool -i eth0
driver: 3c59x
version: 3.81
firmware-version: v8.34.9a
bus-info: 0000:10:00.0
Adding a printer
Let's see if we can print something.
Add a printer
1 Open "System" -> Administration" -> "Printing"

Unit 02U Basic System configuration 49

2 On the server settings Make sure "Share printer" is on.
3 Click "New Printer"
4 Choose connection type "AppSocjket/HP JetDirect".
5 Enter IP address of the printer and port 9100.
6 Choose Manufacturer and Model from the lists.
Choose options for the printer driver.
7 Enter a name, description and enter your name as "location" so we can see who is owning a printer in
the classroom.
8 Choose the newly installed printer and Check the configuration options.
In particular Default paper Size: set it to what is common in your location.
Make sure "Share printer" on the Policy page is enabled.
Test the printer.
Testing is only useful if a printer is available.
9 Open a web browser onto http://localhost:631 to open the CUPS home page.
Inspect your printer on the CUPS server.
Inspect your printer's "Set Printer Options"
10 If you refresh the "Printers" page after some time you should see the printers from other systems start
appearing.
This happens because you shared your printers earlier.
11 Have a quick peek at CUPS documentation.
Click on the "Documentation/Help" tab in the browser.
Click on "Getting started" read "Printing and Options" and "Standard Printing options". The -o option
of the command line utilities allow you to specify print options. GUI applications provide these options
in a Dialog box.
12 Inspect the /etc/printcap file that is maintained by CUPS for legacy applications.
[root@system ~]# cat /etc/printcap
# This file was automatically generated by cupsd(8) from the
# /etc/cups/printers.conf file. All changes to this file
# will be lost.
printer|Color Laserjet 2650dtn:rm=system244.classroom.net:rp=printer:
PDF_Printer|Print to PDF file on Desktop:rm=system244.classroom.net:rp=PDF_Printer:
13 Let's print a manual page using the command line.
Issue man -t ls | lp -d <your printer>.
The -t option of man formats the manpage into PostScript, and the output is sent to lp
which queues the request. You have to specify the name of your printer after -d. Looking at
the printcap file of the last exercise that would be "printer" for the "Color Laserjet 2650dtn"
of the example system.
If you wanted that double sided you could have given:
man -t ls | lp -o sides=two-sided-long-edge
14 Quickly after the lp command type lpq to inspect the print queues.
[root@system ~]# man -t ls | lp -d printer
request id is printer-2 (1 file(s))
[root@system ~]# lpq
printer is ready and printing
Rank Owner Job File(s) Total Size
active root 2 (stdin) 24576 bytes

50 Lab Exercises OSA Course LI121 System and Network Administration I

Stopping Linux
Finally shutdown and hardware identification.
Identify Linux
1 List the contents of /etc/lsb-release.
student@ubuntu:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=7.10
DISTRIB_CODENAME=gutsy
DISTRIB_DESCRIPTION="Ubuntu 7.10"
2 And look at the contents of /proc/version.
student@ubuntu:~$ cat /proc/version
Linux version 2.6.22-14-generic (buildd@terranova) (gcc version 4.1.3 20070929 (prerelease)
(Ubuntu 4.1.2-16ubuntu2)) #1 SMP Tue Dec 18 08:02:57 UTC 2007
The difference is a small extension to the kernel version string....
3 Finally the uname -a command:
[student1@system ~]$ uname -a
Linux ubuntu 2.6.22-14-generic #1 SMP Tue Dec 18 08:02:57 UTC 2007 i686 GNU/Linux
Notice again a same small addition to the version string!
4 Run dmidecode to look at serial numbers / installed hardware.
[root@gollem ~]# dmidecode
# dmidecode 2.7
SMBIOS 2.3 present.
87 structures occupying 2861 bytes.
Table at 0x000F9BB0.

Handle 0x0000, DMI type 0, 20 bytes.
BIOS Information
Vendor: Dell Computer Corporation
Version: A01
Release Date: 09/02/2004
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 1024 kB
Characteristics:
ISA is supported
PCI is supported

Handle 0x0300, DMI type 3, 17 bytes.
Chassis Information
Manufacturer: Dell Computer Corporation
Type: Main Server Chassis
Lock: Present
Version: Not Specified
Serial Number: 5CHMC2J
Asset Tag: Not Specified
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: Unknown
OEM Information: 0x00000000
5 Run lshal to see a listing of system hardware:
student@ubuntu:~$ lshal

Dumping 100 device(s) from the Global Device List:
-------------------------------------------------
udi = '/org/freedesktop/Hal/devices/computer'
info.addons = {'hald-addon-cpufreq', 'hald-addon-acpi'} (string list)
info.bus = 'unknown' (string)
info.callouts.add = {'hal-storage-cleanup-all-mountpoints'} (string list)
info.interfaces = {'org.freedesktop.Hal.Device.SystemPowerManagement'} (string list)
info.product = 'Computer' (string)
info.subsystem = 'unknown' (string)
info.udi = '/org/freedesktop/Hal/devices/computer' (string)

Unit 02U Basic System configuration 51

org.freedesktop.Hal.Device.SystemPowerManagement.method_argnames = {'num_seconds_to_sleep',
'num_seconds_to_sleep', '', '', '', 'enable_power_save'} (string list)
org.freedesktop.Hal.Device.SystemPowerManagement.method_execpaths = {'hal-system-power-
suspend', 'hal-system-power-suspend-hybrid', 'hal-system-power-hibernate', 'hal-system-power-
shutdown', 'hal-system-power-reboot', 'hal-system-power-set-power-save'} (string list)
org.freedesktop.Hal.Device.SystemPowerManagement.method_names = {'Suspend', 'SuspendHybrid',
'Hibernate', 'Shutdown', 'Reboot', 'SetPowerSave'} (string list)
org.freedesktop.Hal.Device.SystemPowerManagement.method_signatures = {'i', 'i', '', '', '',
'i'} (string list)
6 Run lspci -v and lsusb -v to see a listing of PCI and USB devices in the system.
student@ubuntu:~$ sudo lspci -v
01:02.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 78)
Subsystem: 3Com Corporation 3C905CX-TX/TX-M Fast Etherlink for PC Management NIC
Flags: bus master, medium devsel, latency 32, IRQ 20
I/O ports at c000 [size=128]
Memory at ed000000 (32-bit, non-prefetchable) [size=128]
[virtual] Expansion ROM at 10000000 [disabled] [size=128K]
Capabilities: [dc] Power Management version 2
7 Take a brief look at the files in /lib/modules/<your kernel version>. Open
modules.pcimap and modules.usbmap. These contain driver / Identification string information.
student@ubuntu:~$ cd /lib/modules/2.6.22-14-generic/

student@ubuntu:/lib/modules/2.6.22-14-generic$ head -10 modules.pcimap
# pci module vendor device subvendor subdevice class class_mask data
heci 0x00008086 0x00002974 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x00002984 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x00002994 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029a4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029b4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029c4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029e4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
heci 0x00008086 0x000029f4 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
nozomi 0x00001931 0x0000000c 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0

student@ubuntu:/lib/modules/2.6.22-14-generic$ head -10 modules.usbmap
# usb module match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass
bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info
lmpcm_usb 0x0003 0x046d 0xc50e 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x0
appleir 0x0003 0x05ac 0x8240 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x0
isight_usb 0x0003 0x05ac 0x8501 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x0
8 Print the contents of:
/proc/cpuinfo, /proc/interrupts, /proc/ioports and /proc/iomem.
student@ubuntu:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Celeron(R) CPU 2.00GHz
This system has a Hyperthreading CPU that shows up as two CPU's.
[root@system ~]# cat /proc/interrupts
CPU0 CPU1
1: 269 0 Phys-irq i8042
5: 0 0 Phys-irq parport0
6: 7 0 Phys-irq floppy
8: 1 0 Phys-irq rtc
You get a listing of all interrupt assignments...
[root@system ~]# cat /proc/ioports
0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-006f : keyboard
0070-0077 : rtc
And a listing of the IO port assignment...
[root@system ~]# cat /proc/iomem
00000000-0009ffff : System RAM
000a0000-000bffff : Video RAM area
000cb000-000cbfff : Adapter ROM
000cc000-000ccfff : Adapter ROM
And a listing of the layout of main memory...

52 Lab Exercises OSA Course LI121 System and Network Administration I

These assignments are not used very often anymore on modern systems as everything is
auto configured. But on older systems you had to consult this if you wanted to set jumpers
on expansion cards!

Stopping the machine
1 Read the man page for shutdown(8)
system:~ # man 8 shutdown
Notice that you can send a message waring the users of the upcoming shutdown.
Read the part about the time formats: absolute and relative times.
2 Read the man page for sync(1).
This command will flush the buffer cache to disk. It is automatically called by the shutdown scripts.
3 Read the man page for poweroff(8).
This page actually describes several commands to stop / reboot the system.
A reboot will bring the system to runlevel 6.
A halt will bring the system to runlevel 0.
4 Let's reboot our system in 2 minutes with the command line tool shutdown:
system:~ # shutdown -r +2 "Shutdown because of lab exercise"

Broadcast message from root (pts/0) (Tue Oct 9 14:30:31 2007):

Shutdown because of lab exercise
The system is going DOWN for reboot in 2 minutes!

Broadcast message from root (pts/0) (Tue Oct 9 14:31:31 2007):

Shutdown because of lab exercise
The system is going DOWN for reboot in 1 minute!

Broadcast message from root (pts/0) (Tue Oct 9 14:32:31 2007):

Shutdown because of lab exercise
The system is going down for reboot NOW!
On the console you will see the shutdown scripts doing their work...
5 In addition to the command line you can also shut the machine from the graphical login screen.

Вам также может понравиться