Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Network Plus 2005 In Depth

.pdf
Скачиваний:
85
Добавлен:
12.02.2015
Размер:
17.39 Mб
Скачать

422 Chapter 9 NETWORKING WITH UNIX-TYPE OF OPERATING SYSTEMS

NET+

3.1

Table 9-1 Minimum hardware requirements for Solaris 10

Component

Requirement

Notes

Platform

Sun UltraSPARC 64-bit and Fujitsu

 

SPARC64 or AMD or Intel Pentium class

 

processor

Memory

512 MB RAM

Solaris x86 also supports AMD Opteron and Intel 64-bit processors.

Consider adding more RAM for better system performance.

Hard disk

5 to 7 GB

NIC

A NIC supported by Solaris (included with

 

SPARC systems)

CD-ROM/

 

DVD-ROM

A CD-ROM or DVD-ROM drive supported

 

by Solaris (included with SPARC systems)

 

 

Linux Hardware Requirements

Linux hardware requirements vary to some extent based on the version of Linux you are installing. However, all Linux servers adhere to certain minimum hardware requirements, as shown in Table 9-2. You may find more current lists of supported hardware on the HCL (Hardware Compatibility List) at www.tldp.org/HOWTO/HOWTO-INDEX/hardware.html.

Adding high-performance video cards, sound cards, and other I/O devices to your Linux server is also optional.

Table 9-2 Minimum hardware requirements for a Linux server

Component

Requirement

Notes

Processor

Intel-compatible x86

Recent versions of the Linux kernel (2.0

 

 

and later) include support for as many as 32

 

 

Intel processors.

Memory

64 MB RAM

Consider adding more RAM for better per-

 

 

formance; most network administrators opt

 

 

for 256 MB of RAM or more for servers.

Hard disk

A hard drive supported by Linux

Most server implementations require

 

with a minimum of 2 GB of free

additional free hard drive space; 10 GB of

 

space

free space is recommended.

NIC

A NIC supported by Linux

 

NET+

3.1

 

A CLOSER LOOK AT UNIX

Chapter 9

 

423

 

 

Table 9-2 Continued

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Component

Requirement

Notes

 

 

 

 

 

 

 

 

 

 

CD-ROM

A CD-ROM drive listed on

Recent versions of Linux support SCSI,

 

the HCL

IDE, and ATAPI CD-ROM drives.

Floppy disk

One or two 3.5-inch floppy disks,

Floppy disks can be useful for creating

 

if no bootable CD-ROM drive is

emergency repair disks during installation.

 

available

 

 

 

 

 

Pointing device

Optional

A pointing device is only necessary if you

 

 

install the GUI component.

 

 

 

 

 

 

 

Mac OS X Server Hardware Requirements

Mac OS X Server runs only on Apple hardware. As with Solaris and Linux, your choices of RAM, secondary storage, and other hardware considerations are driven by the number and type of applications you will run on the server. Table 9-3 shows Apple’s recommended hardware for Mac OS X Server.

Table 9-3 Apple hardware recommendations for Mac OS X Server

Component

Requirement

Notes

System

Xserve Power Mac G3, G4,

 

 

or G5, iMac or eMac

 

Memory

256 MB RAM

Consider adding more RAM for servers per-

 

 

forming multiple tasks.

Hard disk

4 GB available disk space

Consider using larger hard drives for server

 

 

applications.

NIC

Included with all Mac servers

 

CD-ROM/

Included with all Mac servers

 

DVD-ROM

 

 

 

 

 

A Closer Look at UNIX

NET+

UNIX is the second major network operating system discussed in this book. In some ways, it

3.1is similar to NetWare (discussed in the next chapter) and Windows Server 2003, and in some ways it differs. This section compares UNIX-type of systems with these other network operating systems.

424 Chapter 9 NETWORKING WITH UNIX-TYPE OF OPERATING SYSTEMS

NET+ UNIX Multiprocessing

3.1As you have learned, a process represents an instance of a program running in memory (RAM). In addition to processes, UNIX-type of systems also support threads, which are self-contained subsets of a process. Any modern NOS must handle multiple processes and threads in an efficient manner. UNIX-type of systems allocate separate resources (such as memory space) to each process as it is created. They also manage all programs’ access to these resources. This approach enables partitioning of processes in memory, thereby preventing one program from disrupting the operation of the entire system. When one program ends unexpectedly on a UNIX-type of system, it doesn’t cause the whole computer to crash.

Like Windows Server 2003, modern UNIX-type of systems support SMP (symmetric multiprocessing). Different flavors of UNIX support different numbers of processors:

Solaris supports up to 128 processors per server (although Sun does not make any hardware containing that many processors).

Linux supports SMP using a maximum of 32 processors per server.

Mac OS X Server supports up to two processors per server.

You must know how your servers will be used and plan for multiprocessing servers according to your estimated application-processing loads.

The UNIX Memory Model

From early on, UNIX-type systems were created to use both physical and virtual memory efficiently. Like Windows Server 2003, UNIX-type of systems allocate a memory area for each application. They attempt to decrease the inefficiency of this practice, however, by sharing memory between programs wherever they can. For example, if five people are using FTP on your UNIX server, five instances of the FTP program will run. In reality, only a small part of each FTP program (called the private data region—the part that stores the user name, for example) will receive its own memory space; most of the program will remain in a region of memory shared by all five instances of the program. In this case, rather than using five times the memory required by one instance of the program, a UNIX-type of system sets aside only a little more memory for five FTP users than it does for one FTP user.

Most current UNIX-type of systems use a 32-bit addressing scheme that enables programs to access 4 GB of memory. Most of these systems also run on CPUs that employ 64-bit addresses, enabling programs to access more than 18 exabytes (264 bytes) of memory. That’s more than 18 billion billion bytes of data—by one estimate, three times the total number of words ever spoken by human beings! Virtual memory in a UNIX server can take the form of a disk partition, or it can be in a file (much like the virtual memory file pagefile.sys in Windows Server 2003).

The UNIX Kernel

The core of all UNIX-type of systems is called the kernel. The kernel is loaded into memory and runs when you turn on your computer. Its primary function is to coordinate access to all

A CLOSER LOOK AT UNIX

Chapter 9 425

NET+

your computer’s hardware, such as the disks, memory, keyboard, and monitor. You can add or

3.1remove functionality on a running UNIX-type of system by loading and unloading kernel modules. A UNIX kernel module is a file that contains instructions for performing a specific task such as reading data from and writing data to a hard drive.

The Solaris kernel is derived from the original AT&T UNIX software from Bell Labs. The Linux kernel is the software Linus Torvalds wrote and released to the public in 1991. The Mac OS X Server kernel (called XNU) is derived from an operating system called Mach, which was developed at Carnegie Mellon University in the 1990s.

UNIX System File and Directory Structure

The UNIX system was one of the first operating systems to implement a hierarchical file system (a method of organizing files and directories on a disk in which directories may contain files and other directories). The notion of a file system organized in this way was considered revolutionary at the time of UNIX’s inception. Today, most operating systems, including all Microsoft operating systems and Novell NetWare, use hierarchical file systems. Figure 9-1 shows a typical UNIX file system hierarchy.

FIGURE 9-1 UNIX file system hierarchy

On a UNIX-type of system, the /boot directory contains the kernel and other system initialization files. Applications and services are stored in the /bin and /sbin directories. (The applications and services in the /sbin directory support the system initialization process; you’ll rarely use these programs.) The /var directory holds variable data (such as log files, users’ unread e-mail, and print jobs waiting to be printed). The file /var/log/messages, for example, stores system log messages, such as a notification of a disk drive that is running out of space. Users’ login directories typically appear in /home. Mac OS X Server creates users’ login directories in /Users. When you create a new user account, the system assigns a directory in /home to that user (/Users in Mac OS X Server). The login (or home) directory matches the account’s user name. Thus, /home/jones is the login (or home) directory for the user name jones on a UNIX system. /Users/jones is the login (or home) directory for the user jones on a Mac OS X Server system.

426 Chapter 9 NETWORKING WITH UNIX-TYPE OF OPERATING SYSTEMS

NET+ UNIX System File Services

2.13UNIX file services fall into two broad categories: disk file systems and network file systems.

3.1Disk file systems are used to organize the information on a hard drive. Network file systems enable users to access files on other servers via the network.

Disk File Systems

The UNIX disk file system is the operating system’s facility for organizing, managing, and accessing files through logical structures and software routines. Just as Windows Server 2003 supports FAT, NTFS, and other file systems, UNIX-type systems also support multiple file system types. The native file system type on Linux, called ext3, is the “third extended” file system for Linux. Solaris employs the file system called UFS (for “UNIX File System”) for its native file system type. Apple’s HFS+ (for hierarchical file system) is the native file system for Mac OS X Server. On UNIX-type of systems, you can access disk partitions formatted with the DOS FAT file system as well as Windows Server 2003 NTFS. This applies to partitions on disks that are physically attached to computers that are running a UNIX or UNIX-type of system. UNIX systems have access to nonnative file system types, such as NTFS, over the network with network file systems.

Network File Systems

UNIX-type of systems also support network file systems, which are analogous to Windows shares or NetWare network volumes. From a UNIX-type of host, the network file system allows you to attach shared file systems (or drives) from Windows, NetWare, or other UNIX servers and share files with users on other computers. Sun Microsystems’ NFS (Network File System) is a popular remote file system type supported by UNIX. Sun Microsystems published the specification for NFS, and most vendors of UNIX and UNIX-type systems include NFS applications for sharing and accessing files over a network. Another network file system, called Samba, is an open source application that implements the Windows SMB and CIFS file system protocols. Samba is included with Solaris, most Linux distributions, and Mac OS X Server systems by default.

Apple’s Macintosh computers have long had a built-in network file system called AFP (AppleTalk Filing Protocol or Apple File Protocol). Though Mac OS X Server includes complete support for NFS and Samba network file systems, AFP remains its primary network file system. You must use AFP on a Mac OS X Server system to share files with computers running older versions of the Macintosh operating system.

A UNIX Command Sampler

NET+

The command line is the primary method of interacting with a UNIX-type of system. Even

3.1when you’re running a GUI, the GUI actually executes commands in response to your mouse clicks. This section discusses some of the basics of the UNIX user interface, interaction with the UNIX command line, and some fundamental UNIX commands.

A UNIX COMMAND SAMPLER

Chapter 9 427

NET+

The program that accepts the commands you type on the keyboard and runs the commands

3.1for you is called a command interpreter. Also known as a shell, a command interpreter translates your typed commands into machine instructions that a UNIX-type of system can understand. In other words, the command interpreter is a program that runs other programs. UNIX command interpreters also perform file globbing (described later) and keep track of what commands you’ve entered previously. The primary UNIX command interpreter is the file /bin/sh. To use the shell effectively, you should be familiar with at least some basic commands.

Every UNIX-type of system contains full documentation of UNIX commands in the manual pages (or man pages). The manual pages describe each command’s function and proper execution. Although their organization differs slightly in various flavors of UNIX, manual pages are typically arranged in nine sections:

Section 1 covers the commands that you most typically enter while typing in a command window.

Sections 2 through 5 document the programmer’s interface to the UNIX system.

Section 6 documents some of the amusements and games that are included in the UNIX system.

Section 7 describes the device drivers for the system.

Section 8 covers the commands used by administrators to manage the system.

Section 9 documents the UNIX kernel functions programmers use when writing device drivers.

You can access manual pages by entering the man command in a UNIX command window. For example, to read the manual page entry for the telnet command, you would type man telnet in a command window, and then press Enter.

Although the UNIX manual pages are accurate and complete, UNIX newcomers often complain that they can’t find the appropriate manual page if they don’t know the name of the command they want to use. That’s why the apropos command exists. It enables you to find possible manual page entries for the command you want to use. For example, you might type apropos list to search for a command that lists files. The apropos command would then display all commands and programming functions that include the keyword list in their manual page entries. Type man <command> (where <command> is a command name displayed by apropos), and press Enter when you find a command name that looks like it might do what you want.

Commands function in much the same way as sentences in ordinary language. Some of these sentences are one-word directives to the system requesting that it perform a simple task on your behalf (such as date for “tell me the current date and time”). Other sentences are detailed instructions to the system containing the equivalent of nouns, adjectives, and adverbs and creating a precise description of the task you want the system to perform. For example, to instruct the system to “display the names of all files in the current directory that have been accessed in the past five days,” you would type: find . –type f –atime -5 -print.

428 Chapter 9 NETWORKING WITH UNIX-TYPE OF OPERATING SYSTEMS

NET+

3.1

NET+

2.10

2.13

3.1

NOTE

Commands, command options, and filenames in UNIX are all case sensitive. Be certain to use uppercase and lowercase as appropriate each time you type a command in a UNIX command window.

A few rules exist to guide your use of UNIX commands and, as you might expect, exceptions to most of the rules also exist. Most commands (though not all) are lowercase alphabetic characters. Using the analogy of a sentence, the command itself would be the verb—that is, the action you want the system to take (for example, ls to list information about files). The things on which you want the system to operate (often files) would be the nouns. (So, for example, you would type ls index.html to list a file named index.html.) Options to the commands are analogous to adjectives and adverbs—that is, modifiers that give more specifics about the command. To specify an option, you usually type a hyphen (-) followed by a letter. (For example, if you want to list files in a directory and also list details about the files, such as their size and creation date, you type ls -l.) You can make commands even more specific by using file glob- bing—the equivalent to using wildcards in Windows and DOS. On a UNIX-type system, this operation is also called filename substitution. (For example, ls -la* would produce a detailed listing of all files beginning with the letter “a”.)

A significant (and perhaps initially confusing) difference between the UNIX and Windows command-line interfaces relates to the character you use to separate directory names when you type in a command window. The Windows separator character is “\” (backslash). The equivalent UNIX directory separator character is “/” (forward slash). For example, in a Windows Command Prompt window, you type the telnet command as \windows\system32\ telnet.exe. The telnet command in UNIX is /usr/bin/telnet.

Table 9-4 lists some common UNIX commands and provides a brief description of each.

Table 9-4 Commonly used UNIX commands

Command

Function

date

Display the current date and time.

ls -la

Display with details all the files in the current directory.

ps -ef

Display details of the current running programs.

find dir filename -print

Search for filename in the directory dir and display the path to the

 

filename on finding the file.

cat file

Display the contents of file.

cd /d1/d2/d3

Change the current directory to d3, located in /d1/d2.

NET+

2.10

2.13

3.1

Table 9-4 Continued

A UNIX COMMAND SAMPLER

Chapter 9

 

 

429

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Command

Function

 

 

 

 

 

 

 

 

 

 

 

cp file1 file2

Make a copy of file1, named file2.

 

 

 

 

rm file

Remove (delete) file. (Note that this is a permanent deletion; there

 

 

 

is no trash can or recycle bin from which to recover the deleted file.)

 

mv file1 file2

Move (or rename) file1 to file2.

 

 

 

 

mkdir

dir

Make a new directory named dir.

 

 

 

 

rmdir

dir

Remove the directory named dir.

 

 

 

 

who

 

Display a list of users currently logged on.

 

 

 

 

vi file

Use the “visual” editor named vi to edit file.

 

 

 

 

lpr file

Print file using the default printer. lpr actually places file in the

 

 

 

printer queue. The file is actually printed by lpd (line printer dae-

 

 

 

mon), the UNIX printer service.

 

 

 

 

grep "string" file

Search for the string of characters in string in the file named file.

 

ifconfig

Display the network interface configuration, including the IP address,

 

 

 

MAC address, and usage statistics for all NICs in the system.

 

netstat -r

Display the system’s TCP/IP network routing table.

 

 

 

 

sort filename

Sort alphabetically the contents of filename.

 

 

 

 

man "command"

Display the manual page entry for "command".

 

 

 

 

chmod

rights file

Change the access rights (the mode) of file to rights.

 

chgrp

group file

Change the group to which the file belongs to group.

 

telnet

host

Start a virtual terminal connection to host (where host may be an

 

 

 

IP address or a host name).

 

 

 

 

ftp host

Start an interactive file transfer to (or from) host using the FTP

 

 

 

protocol (where host may be an IP address or a host name).

 

startx

 

Start the X Window system.

 

 

 

 

kill process

Attempt to stop a running program with the process ID process.

 

tail file

Display the last 10 lines of file.

 

 

 

 

exit

 

Stop the current running command interpreter. Log off the system if

 

 

 

this is the initial command interpreter started when logging is on.

 

 

 

 

 

 

 

 

 

430 Chapter 9 NETWORKING WITH UNIX-TYPE OF OPERATING SYSTEMS

NET+

3.1

NOTE

The developers of the original UNIX system worked at AT&T, then the largest public corporation in the world. Two features of communication within large corporations are a tendency to abbreviate words and a reliance on acronyms. The command names in the UNIX system reflect this culture in that they drop vowels and syllables (cp for copy, cat for concatenate, and so on), and name commands with the “initials” of their intended use (grep for general regular expression parser and ftp for File Transfer Protocol). Refer to the relevant manual pages when you encounter command names that you don’t understand. The synopsis section usually indicates the origin of the command name.

The most frequently used UNIX command is ls. By entering ls (and specifying -l, the detailed listing option), you learn everything about a file except its contents. UNIX-type of systems keep quite a bit of information about each file, including:

The filename

The file size (in bytes)

The date and time that the file was created

The date and time that the file was last accessed (viewed or printed)

The date and time that the file contents were last modified (created, edited, or changed in any way)

The number of “aliases” or links to the file

The numeric identifier of the user who owns the file

The numeric identifier of the group to which the file belongs

The access rights for the owner, the group, and all others

For each file, the system stores all of this information (except the filename) in a file i-node (information node). The beginning of each disk partition contains reserved space for all i- nodes on that partition. I-nodes also contain pointers to the actual file contents on the disk. The file’s name is stored in the directory that contains the file. To learn about the i-node information, use the ls command. Figure 9-2 shows a sample list generated by ls -l.

In Figure 9-2, the letters in the leftmost column (for example, “drwxr-xr-x”) make up the access permissions field. The first character in the access permissions field (on the far left) indicates the file type. Files type designations include the following:

“d” for directories

“-” for regular files, such as word-processing files or spreadsheet files—that is, those which, as far as the operating system is concerned, contain unstructured data

“l” for symbolic link files (much like Windows shortcuts)

NET+

3.1

A UNIX COMMAND SAMPLER

Chapter 9 431

“b” for block device files (such as disk partitions)

“c” for character device files (such as serial ports)

The remaining letters in the access permissions field (for example, “rwxr-xr-x”) represent the permissions that users and groups have to access each file. The meaning of these letters is described in Figure 9-3’s interpretation of the output of ls -l.

Windows and UNIX-type of systems share the powerful ability to direct output from one command to the input of another command. In UNIX, you combine commands using a pipe, which is entered as a vertical bar “|”. (Think of data “flowing” through a pipe from one command to another.) Two or more commands connected by a pipe are called a pipeline. UNIX pipes make it possible to create sequences of commands that might require custom programming on other systems. For example, you can learn the process ID number assigned to a running program by combining two simple UNIX commands as follows: ps-ef|grep "/bin/sh". In UNIX, most commands that display output in a command window allow you to direct the output to another

FIGURE 9-2 Example of output from ls -l

FIGURE 9-3 Anatomy of ls –l output

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]