Updated: 2013-04-13 20:49 EDT

1 Overview

1.1 Using Other Virtualization Software

You can use any virtualization software you like to create and run this CentOS virtual machine, e.g. VirtualBox, Parallels, etc., but faculty only fully support questions about VMware. It’s what we know.

2 Download CentOS 5.8 Disk 1

You can start this download process and wait for it to finish while you move on to the next step to Create an Empty Virtual Machine.

In this section, you will download CentOS 5.8 to your machine. It must be CentOS 5.8 DVD 1, no other version is acceptable for this course. (If you want to play with a desktop version of Linux, don’t use this version. Get something graphical and desktop-friendly such as Ubuntu or Mint to play with. This course is configuring a non-GUI server version of Linux.)

You can get the CentOS 5.8 DVD 1 image from one of the following places. We recommend that you choose the first one; it’s the fastest one.

2.1 Download Method 1: From a Local T114 File Share (fastest)

You can get a copy of the DVD from the C:\CST folder on any of the workstations in Algonquin Lab T114. You can do this in any of these three Share Method ways, but you must be wired into the T114 room to do it (no wireless):

2.1.1 Share Method 1: Enable Passworded Share

(This information is provided by Richard Donnelly.)

This share requires a username and password to access:

  1. On the machine containing the C:\CST share, run CMD as Administrator: Right Click and select Run As Administrator
  2. Enter the following commands and replace the italic sections as required:
    1. net user username password /ADD
      • you can make up any username and password you like
    2. net share cst=C:\CST
    3. netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
  3. To access this share from your Windows machine on the same wired network, start a CMD prompt and type:
    • net use x: \\ipaddress\CST /USER:username password
      • there are no blanks in the network share name \\ipaddress\CST, e.g. \\10.50.23.45\CST.
      • ipaddress is the IP address of the machine sharing C:\CST
      • username and password match the ones you chose, above.
    • NOTE: You cannot access T114 or T126 machines from Algonquin Wireless! Use a wired connection in the room.
  4. The share will be visible as drive X: on your machine, and also using the network path \\name\CST where name is either the machine name or the IP address, e.g. a path similar to \\t114-06\CST or \\10.50.23.45\CST
  5. Choose DVD disk 1: CentOS-5.8-i386-bin-DVD-1of2.iso

Make sure you use a wired connection to download any files.

2.1.2 Share Method 2: Enable Public Password-Free Share

(This information is provided by Michael Porteous.)

Anyone can access this share without a password:

  1. On the machine containing the C:\CST share, follow this link to turn on Windows Sharing on the C:\CST folder
  2. To access this share from your Windows machine on the same wired network, use the network path \\name\CST where name is either the machine name or the IP address, e.g. a path similar to \\t114-06\CST or \\10.50.23.45\CST
  3. Choose DVD disk 1: CentOS-5.8-i386-bin-DVD-1of2.iso

Make sure you use a wired connection to download any files.

2.1.3 Share Method 3: Sneaker Net: Use a USB Drive

You can copy the DVD image from C:\CST on any T114 machine onto a USB drive and then attach the USB drive to your own computer and copy it to your local computer.

  • Choose DVD disk 1: CentOS-5.8-i386-bin-DVD-1of2.iso

2.2 Download Method 2: From the CSTECH Downloads Folder (slower)

This is slower than the above Windows Share method. It only works on campus, but it works anywhere on campus, not just in T114:

  1. On your laptop use a browser to go to the Web site http://cstech on campus.
  2. Choose any room from the left side-bar (e.g. T114). Go to Drivers and Downloads, Linux, CentOS 5.8 i386
  3. Choose DVD disk 1: CentOS-5.8-i386-bin-DVD-1of2.iso

Make sure you use a wired connection to download any files.

2.3 Download Method 3: From the Internet (slowest)

This is slower than all the above methods. Use it only if you have to:

  1. On your laptop use a browser to go to the Web site http://www.centos.org/.
  2. Go to Downloads, Mirrors, Mirror List.
  3. Pick an HTTP mirror and find the same DVD disk 1 ISO to download:
  4. Choose DVD disk 1: CentOS-5.8-i386-bin-DVD-1of2.iso

3 Verify the Downloaded ISO

You will need some form of checksum program that runs on your local computer. It has to be something that can calculate md5 or sha hashes. Unix/Linux/OSX machines already have the md5sum command available. One suggestion (thanks Richard!) for Windows users is HashTab:

  1. Download and install HashTab for Windows. (Unix/Linux/OSX users don’t need this program.)
  2. Copy the desired hash to the clipboard (e.g. from the md5sum.txt file).
  3. Right click in the file you wish to verify, i.e. select your DVD disk 1 CentOS-5.8-i386-bin-DVD-1of2.iso
  4. Click Properties and then file hashes.
    • It will compare the hashes to the one(s) in your clipboard.
    • MD5 and SHA-1 are the defaults, but it can be customized to include others.

You can get a copy of the checksum files (e.g. md5sum.txt) from the Linux CentOS 5.8 i386 folder on the http://cstech/ web site.

  1. Verify that you have DVD disk 1 (of 2) named CentOS-5.8-i386-bin-DVD-1of2.iso

  2. Verify the checksum of the image you download against the checksum recorded in any of the checksum files located in the same folder. (For example, open md5sum.txt and locate the checksum for the DVD 1 disk and compare it with the checksum of the image you downloaded.)

On a machine that has the C:\CST folder, you can run an md5sum program on Windows by opening C:\CST\cygwin\bash and typing /usr/bin/md5sum.exe filename at the BASH shell prompt. (You can install the free Cygwin package on your own Windows laptop to get BASH and all the Unix tools for Windows, including md5sum, find, etc.)

4 Create an Empty Virtual Machine

In this section, you will create an empty Linux 32bit CentOS-compatible Virtual Machine. You can do this while you are waiting for your CentOS DVD disk 1 to download.

  1. Start VMware on your machine. Any version of VMware since Version 7 should work.
  2. Use a Typical install (fewer questions than Custom install)
  3. Select: Install O/S later
  4. Select Guest O/S: Linux, Version CentOS (do not choose 64 bit)
  5. Virtual Machine Name: CentOS (or your choice)
  6. Disk Size: 1.8G (actually type the number 1.8 into the box)
    • if asked: stored as a single file (Monolithic)
  7. Customize Hardware: Memory: 256MB
  8. Customize Hardware: Networking: Bridged
    • Select connect at power on
    • If you later have problems with Bridged, try setting this to NAT
  9. Attach nothing to the virtual DVD drive - leave it empty.
  10. Finish.

To confirm your settings: Select menu VM | Settings to open Virtual Machine Settings and look under the Hardware tab to confirm:

Memory: 256MB
Processors: 1
Hard Disk: 1.8GB
Network Adapter: Bridged

Under the Options tab confirm:

General: CentOS

Start over if you don’t see the above settings.

5 Install CentOS 5.8

After you have downloaded and verified the checksum of DVD disk 1 CentOS-5.8-i386-bin-DVD-1of2.iso, you can do a Minimal Installation of CentOS 5.8 into your empty CentOS virtual machine.

Note that CentOS 5 is identical to Red Had Enterprise Linux 5 (RHEL5) except for colours and trademarks, and remember this as you’re doing the following steps.

  1. Connect your downloaded and verified CentOS-5.8-i386-bin-DVD-1of2.iso ISO to your VMware virtual CD drive using the VM Settings Hardware CD/DVD device page:
    1. Use ISO image: browse to the location of your CentOS DVD disk 1.
    2. Check Connected and Connect at power on.
    3. Save
    4. Power on your CentOS Virtual Machine.
  2. Follow these Web instructions for doing a Minimal Installation of CentOS 5:
    https://access.redhat.com/knowledge/solutions/15772
    1. set your host name to be your eight-character Blackboard userid
    2. set your time zone to be America/Montreal
    3. make sure you uncheck (turn off) all software except the Base install!
    4. During the install you will choose a root password
    5. Reboot your virtual machine (not your laptop) when prompted.
  3. After the reboot you will see the firstboot setup agent. (If you accidentally exit the agent, just type firsboot at a shell prompt to start it again.) Use the firstboot agent to disable SELinux (Security Enhacned Linux) as follows:
    1. Use the arrow keys to select Firewall configuration
    2. Use the tab key to select Run Tool and press Enter.
    3. Security Level: Enabled
    4. SELinux: Disabled
    5. Do not change any other settings.
    6. Tab to OK and push Enter to return to the Setup Agent.
    7. Tab to Exit and push Enter to leave the tool.

5.1 Verify Correct CentOS Installation

  1. Log in as the user root with the password that you remember
    1. run: fdisk -l and verify that your Disk /dev/sda is 1932 MB.
    2. Verify that you have only installed the two required %packages groups named @base and @core, as specified in the last paragraph in the above Minimal Installation instructions
    3. run: rpm -q -a | wc and verify that you have exactly 362 packages installed.
    4. run: df -h and verify that your ROOT virtual disk has a size of 1.4G and is using between 810M and 821M (65%).
    5. run: free and verify that you have a total Memory of 254980.
    6. run: ifconfig eth0 and verify that your inet addr is set to be one on your local network (as you would expect with Bridged networking with DHCP).
  2. You may need to delete this virtual machine and re-install if the above numbers are wrong - consult with your instructor.

6 Snapshot your Minimal Installation

  1. Use VMware (or your virtualization software) to create a Snapshot of your new Minimal Installation VM before proceeding. Label the Snapshot Minimal Installation and enter a dated comment explaining how you created it. You will have this snapshot to come back to if you ever need it.

7 Install Packages and Configure

At present all we need is an updated version of the VIM text editor:

7.1 Install Full Version of VIM

Your CentOS Minimal Installation comes with a minimal (they call it Tiny) version of the vim text editor named vi that is missing many features and help files. As root, download and install the full (they call it Huge) version of vim as follows:

  1. Log into your new CentOS VM as the root user.
  2. Type the following at the command line to download and install the full Vim editor: yum install vim-enhanced
    • This may not work – yum may hang trying to find mirrors. If yum hangs, do these steps until it works:
      1. If ^C (Ctrl-C) will not interrupt the hung yum command, use ^Z to STOP the yum command and then kill %yum to kill it. (If that doesn’t kill it, use kill -9 %yum)
      2. Make sure your host operating system is not using wireless. Change your host O/S to use a wired connection and disable your wireless so that it is not used. (Never use wireless if wires are available!)
      3. As root type: service network restart and try yum again.
        • You can try ping, but Algonquin College blocks most ICMP traffic so it may not work as a diagnostic tool
      4. If yum still hangs on the wired network:
        1. kill yum and then try:
        2. Go to VM and Settings and Hardware and Network Adapter
        3. Change your networking from Bridged to NAT
        4. Save the settings.
        5. Type: service network restart and try yum again.
    • When it works, you may need to accept a security key: say yes
  3. Start the newly-installed full version of vim (not vi)
    • In vim type :version and verify that it says compiled Jan 8 2013 (or later).
  4. The programs vi and vim are different in CentOS!
    • You may find your non-root account comes with an alias: alias vi=vim
    • In which system directory is the minimal (Tiny) vi program found?
    • In which system directory is full (Huge) enhanced vim program found?
    • What system command makes it easy to answer the above two questions?

8 Suspending and Shutting Down Safely

You can either Suspend or Shut Down (power off) your VM as follows:

8.1 Suspending

This is the fastest way to save your machine state. Most times you will want to suspend your Virtual Machine so that you can resume it quickly where you left off:

  1. Go to VM and Power and choose Suspend
  2. Wait until VMware fully saves the state of the machine.
  3. Safely close VMware.

8.2 Resuming

When you resume your Virtual Machine, you may need to refresh the network settings for your new location by running (as root): service network restart

8.3 Shutting Down (Power Off)

If you need to reconfigure most parts of the Virtual Machine running Linux, you need to shut down Linux before you can do that. Here’s how:

  1. Log in as root (or login in as a user and then become root, if you have disabled root logins)
  2. As root run: shutdown -h now or halt (if available)
    • you can also schedule a shutdown at a later time; see the man page
  3. Wait until the Virtual Machine fully shuts down and stops.
  4. Safely close VMware.

9 Switching Consoles

Most Linux machines running in console mode (run level 3) allow you to have multiple consoles active by typing ALT+F2 (hold down ALT and simultaneously push Function Key 2) to switch to the second console, ALT+F3 to the next one, etc. The default, first, console is of course ALT+F1.

Multiple consoles allow you to multi-task even without all the overhead of a graphical user interface.

Another way to kill a hung yum session is to switch to a second console, log in as root, find the process ID of the hung yum process, use kill to send that process ID a SIGTERM termination signal, then switch back to the first console again.

When you log out of a server console, make sure you check all the alternate consoles and log them out, too! Don’t leave an open root login session active when you walk away from the machine!

10 Network Problems

Know as a system technician what kinds of network problems cause what kinds of errors. Some basic points:

10.1 Check IP address

Start by making sure your Virtual Machine has been given an IP address by running ifconfig and looking at the eth0 network device. You are looking for a valid IP address beside inet addr:, e.g.

# ifconfig eth0
eth0  Link encap:Ethernet  HWaddr 00:04:75:8d:6e:52  
      inet addr:192.168.9.250  Bcast:192.168.9.255  Mask:255.255.255.0
...

Does the IP address given to your machine seem reasonable for the network you are on? If not, try restarting the network by running (as root): service network restart

If that doesn’t work, you might try switching your VMware machine from Bridged Networking to NAT (Network Address Translation) and then restarting your networking again.

You should be able to ping your own IP address successfully:

# ping -c 4 192.168.9.250
PING 192.168.9.250 (192.168.9.250) 56(84) bytes of data.
64 bytes from 192.168.9.250: icmp_req=1 ttl=64 time=0.036 ms
64 bytes from 192.168.9.250: icmp_req=2 ttl=64 time=0.067 ms
64 bytes from 192.168.9.250: icmp_req=3 ttl=64 time=0.057 ms
64 bytes from 192.168.9.250: icmp_req=4 ttl=64 time=0.053 ms
--- 192.168.9.250 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2997ms
rtt min/avg/max/mdev = 0.036/0.053/0.067/0.012 ms

If you don’t have a working IP address, nothing else will work. You must have an IP address.

10.2 Check default gateway

Once you have a valid IP address for the network you are on (please, not wireless!), check your default gateway. Run the command ip route and look at the gateway address in the default line, e.g.

# ip route
...
default via 192.168.9.254 dev eth0

Try pinging that gateway:

# ping -c4 192.168.9.254
PING 192.168.9.254 (192.168.9.254) 56(84) bytes of data.
64 bytes from 192.168.9.254: icmp_req=1 ttl=64 time=0.882 ms
64 bytes from 192.168.9.254: icmp_req=2 ttl=64 time=0.760 ms
64 bytes from 192.168.9.254: icmp_req=3 ttl=64 time=0.615 ms
64 bytes from 192.168.9.254: icmp_req=4 ttl=64 time=0.663 ms
--- 192.168.9.254 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 0.615/0.730/0.882/0.102 ms

(Note that Algonquin College, ping may be blocked.)

If you don’t have a working default gateway, nothing else will work. You must have a working gateway.

10.3 Check DNS resolution

If you have an IP address and a working gateway, but see failure in name resolution, then your system is not able to use a DNS to turn host names into IP addresses.

If you can’t ping the DNS servers, your DNS won’t work and you can’t use host names. Try restarting your networking or switching from Bridged to NAT networking. Don’t use wireless!

Plain Text - plain text version of this page in Pandoc Markdown format


Campaign for non-browser-specific HTML   Valid XHTML 1.0 Transitional   Valid CSS!   Creative Commons by nc sa 3.0   Hacker Ideals Emblem   Author Ian! D. Allen