Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

Server Requirements for Postfix

  • Print
  • + Share This
The Postfix email software package enables you to to install and configure a full featured Internet email system with a minimum amount of expense. But first you need a server available for it to run on. This chapter from Postfix walks you through the server requirements.
This chapter is from the book

This chapter is from the book

Before you can get your feet wet with Postfix, you must have a server available for it to run on. The Postfix package was written specifically for the Unix platform. Postfix requires several features of the Unix operating system to operate properly. This prevents Postfix from running on a standard Microsoft Windows workstation (even Windows 2000). Fortunately, many Unix implementations are available that can support Postfix.

Novice mail administrators often are not familiar with the operating system that is used for the mail server. This chapter presents a brief description of the Unix operating system that Postfix requires. It also describes one popular free Unix implementation that is available for Postfix: Linux. If you are new to the Unix world and have not yet chosen an operating system to run Postfix on, you may want to read this chapter before deciding.


The Postfix package is an extremely robust software package that can run under any Unix operating system. I stress that the operating system used must be an implementation of Unix. Several features of the Postfix system utilize Unix features that are not present on other operating systems. Also, while this chapter discusses only Linux, you have many different Unix systems to choose from that can fully support Postfix.

The Unix Operating System

The core of the Unix operating system is the kernel. The kernel must control the hardware and software on the system, allocating hardware when necessary and executing software when required. The kernel is primarily responsible for system memory management, software program management, hardware management, and filesystem management. The following sections describe each of these functions in more detail.

Memory Management

One of the primary functions of the operating system kernel is memory management. Not only does the kernel manage the physical memory available on the server, it can also create and manage virtual memory, or memory that does not physically exist in RAM.

It does this by using space on the hard disk, called the swap space, and swapping memory locations back and forth from the hard disk to the actual physical memory. This allows the system to think there is more memory available than what physically exists as RAM. The memory locations are grouped into blocks called pages. Each page of memory is located either in the physical memory or the swap space. The kernel must maintain a table of the memory pages that indicates which pages are where.

The kernel automatically copies memory pages that have not been accessed for a period of time to the swap space area on the hard disk. When a program wants to access a memory page that has been "swapped out," the kernel must swap out a different memory page and swap in the required page from the swap space. To use virtual memory, you must explicitly create swap space on the hard disk or indicate a special file to be used for swap. This is often done during system installation. The fdisk command partitions the installed hard drive on the system. During the partition time, you can create special swap partitions on the disks. The format of the fdisk command is

fdisk [option] [device]

where device is the hard disk device that is being partitioned. Unix systems use different naming standards for hard disk devices. Table 3.1 shows the Linux hard disk naming standard.

Table 3.1 Linux Hard Disk Devices




IDE disk drives


SCSI disk drives


ESDI disk drives


XT disk drives

The first available drive of a particular type is labeled as drive "a," the second one drive "b," and so on. Within a particular drive, partitions are numbered starting at partition 1. Listing 3.1 shows a sample partition from a Linux system.

Listing 3.1 Sample fdisk Partition Listing

[root@shadrach]# /sbin/fdisk /dev/sda

 Command (m for help): p

 Disk /dev/sda: 64 heads, 32 sectors, 521 cylinders
 Units = cylinders of 2048 * 512 bytes

 Device Boot Start  End Blocks Id System
 /dev/sda1    1  460 471024 83 Linux native
 /dev/sda2   461  521 62464 5 Extended
 /dev/sda5   461  521 62448 82 Linux swap

 Command (m for help): q

The first line shows the fdisk command being run on the first SCSI disk on the Linux system: /dev/sda. fdisk is an interactive program that allows the system administrator to manipulate the partition table on the disk drive. You enter the p command to print the current partition table. The /dev/sda5 line shows the partition that is available on the hard drive for the Linux swap area.

After a swap area has been created on a hard drive, the kernel must know that it is available and activate it. The swapon program activates memory page swapping. The swapon command sets up the virtual memory information in the kernel. This information is lost when the server is rebooted. This requires that the swapon command be executed at every boot time. Most Unix distributions allow the swapon command to be run from a startup script when the system boots.

On Linux systems, the current status of the virtual memory can be determined by viewing the special /proc/meminfo file. Listing 3.2 shows a sample /proc/meminfo entry.

Listing 3.2 Sample /proc/meminfo File

[root@shadrach]# cat /proc/meminfo
  total: used: free: shared: buffers: cached:
 Mem: 31535104 29708288 1826816 31817728 3051520 15773696
 Swap: 63942656 2838528 61104128
 MemTotal:  30796 kB
 MemFree:  1784 kB
 MemShared: 31072 kB
 Buffers:  2980 kB
 Cached:  15404 kB
 SwapTotal: 62444 kB
 SwapFree:  59672 kB

The first line shows the Linux command used to view the /proc/meminfo file. The third line shows that this Linux server has 32MB of physical memory. It also shows that about 18MB is not currently being used. The next line shows that there is about 64MB of swap space memory available on this system. This corresponds with Listing 3.1, which showed a 64MB swap space partition on the /dev/sda hard drive.

By default, each process running on the Unix system has its own private memory area. One process cannot access memory being used by another process. No processes can access memory used by the kernel processes. To facilitate data sharing, you can create shared memory segments. Multiple processes can read and write to a common shared memory area. The kernel must maintain and administer the shared memory areas. You can use the ipcs command to view the current shared memory segments on the system. Listing 3.3 shows the output from a sample ipcs command.

Listing 3.3 Sample ipcs Command Output

[root@shadrach]# ipcs -m

 ------ Shared Memory Segments --------
 key  shmid  owner  perms  bytes  nattch status
 0x00000000 0   rich  600  52228  6   dest
 0x395ec51c 1   oracle 640  5787648 6

This shows the ipcs command using the -m option to display just the shared memory segments. Each shared memory segment has an owner who created the segment. Each segment also has standard Unix permissions that set the availability of the segment to other users. The key value allows other users to gain access to the shared memory segment.

Process Management

The Unix operating system handles programs as processes. The kernel controls how processes are managed in the system. The kernel creates the first process, called the init process, to start all other processes on the system. When the kernel starts, the init process is loaded into virtual memory. As each process is started, it is given an area in virtual memory to store data and code that the system will execute.

Some Unix implementations contain a table of terminal processes to start automatically on bootup. On Linux systems, when the init process starts, it reads the file /etc/inittab to determine what processes it must start on the system.

The Unix operating system uses an init system that utilizes run levels. A run level can direct the init process to run only certain types of processes. There are multiple run levels in the Linux operating system and each one can be configured to start different processes.

At run level 1, only the basic system processes are started, along with one console terminal process. This is called single user mode, which is most often used for filesystem maintenance. The standard init run level is 3. At this run level, most application software such as network support software is started. Another popular run level in Unix is run level 5, which is where the graphical X Window System software is started for GUI terminals. Notice how the Unix system can control the overall system functionality by controlling the init run level. By changing the run level from 3 to 5, the system can change from a console-based system to an advanced graphical X Window System.

To view the currently active process on the Unix system, you can use the ps command. The format of the ps command is

ps [options]

where options is a list of options that can modify the output of the ps command. Table 3.2 shows the options that are available.

Table 3.2 ps Command Options




Uses the long format to display


Uses user format (shows user name and start time)


Uses job format (shows process gid and sid)


Uses signal format


Uses vm format


Displays memory information


Uses "forest" format (displays processes as a tree)


Shows processes of other users


Shows processes without a controlling terminal


Shows child CPU and time and page faults


Command name for task_struct


Shows environment after command line and a +


Uses wide output format


Does not display the header


Shows running processes only


Shows numeric output for USER and WCHAN


Shows the processes that are controlled by terminal ttyxx


Orders the process listing using sort keys k1, k2, and so on


Shows only the specified pids

Lots of options are available to modify the ps command output. Listing 3.4 shows a sample output.

Listing 3.4 Sample ps Command Output

[rich@shadrach]$ ps ax
 1 ?  S  0:03 init
 2 ?  SW  0:00 [kflushd]
 3 ?  SW  0:00 [kupdate]
 4 ?  SW  0:00 [kpiod]
 5 ?  SW  0:00 [kswapd]
 243 ?  SW  0:00 [portmap]
 295 ?  S  0:00 syslogd
 305 ?  S  0:00 klogd
 320 ?  S  0:00 /usr/sbin/atd
 335 ?  S  0:00 crond
 350 ?  S  0:00 inetd
 365 ?  SW  0:00 [lpd]
 403 ttyS0 S  0:00 gpm -t ms
 418 ?  S  0:00 httpd
 423 ?  S  0:00 httpd
 424 ?  SW  0:00 [httpd]
 425 ?  SW  0:00 [httpd]
 426 ?  SW  0:00 [httpd]
 427 ?  SW  0:00 [httpd]
 428 ?  SW  0:00 [httpd]
 429 ?  SW  0:00 [httpd]
 430 ?  SW  0:00 [httpd]
 432 ?  S  0:02 /usr/local/jdk1.2.2/bin/i386/green_threads/java org.a
 436 ?  SW  0:00 [httpd]
 437 ?  SW  0:00 [httpd]
 438 ?  SW  0:00 [httpd]
 470 ?  S  0:02 xfs -port -1
 485 ?  SW  0:00 [smbd]
 495 ?  S  0:00 nmbd -D
 533 ?  SW  0:00 [postmaster]
 538 tty1  SW  0:00 [mingetty]
 539 tty2  SW  0:00 [mingetty]
 540 tty3  SW  0:00 [mingetty]
 541 tty4  SW  0:00 [mingetty]
 542 tty5  SW  0:00 [mingetty]
 543 tty6  SW  0:00 [mingetty]
 544 ?  SW  0:00 [prefdm]
 548 ?  S  2:23 /etc/X11/X -auth /usr/X11R6/lib/X11/xdm/authdir/A:0-u
 549 ?  SW  0:00 [prefdm]
 559 ?  S  0:02 [kwm]
 585 ?  S  0:06 kikbd
 594 ?  S  0:00 kwmsound
 595 ?  S  0:03 kpanel
 596 ?  S  0:02 kfm
 597 ?  S  0:00 krootwm
 598 ?  S  0:01 kbgndwm
 611 ?  S  0:00 kcmlaptop -daemon
 666 ?  S  0:00 /usr/libexec/postfix/master
 668 ?  S  0:00 qmgr -l -t fifo -u
 787 ?  S  0:00 pickup -l -t fifo
 790 ?  S  0:00 telnetd: [vt100]
 791 pts/0 S  0:00 login -- rich
 792 pts/0 S  0:00 -bash
 805 pts/0 R  0:00 ps ax

The first line shows the ps command as entered on the command line. Both the a and x options are used for the output to display all processes running on the system. The first column in the output shows the process ID (or PID) of the process. The third line shows the init process started by the kernel. The init process is assigned PID 1. All other processes that start after the init process are assigned PIDs in numerical order. No two processes can have the same PID.

The third column shows the current status of the process. Table 3.3 lists the possible process status codes.

Table 3.3 Process Status Codes




Uninterruptible sleep


Process has pages locked into memory


Low priority task




The process has asked for a page replacement (sleeping)


Traced or stopped


A defunct (zombie) process


Process has no resident pages


High priority process

The process name is shown in the last column. Processes that are in brackets ([ ]) have been swapped out of memory to the disk swap space due to inactivity. You can see that some of the processes have been swapped out, but most of the running processes have not.

Device Driver Management

Still another responsibility for the kernel is hardware management. Any device that the Unix system must communicate with needs driver code inserted inside the kernel code. The driver code allows the kernel to pass data back and forth to the device. Two methods are used for inserting device driver code in the Unix kernel.

Previously, the only way to insert a device driver code was to recompile the kernel. Each time a new device was added to the system, the kernel code needed to be recompiled. This process became more inefficient as Unix kernels supported more hardware. A better method was developed to insert driver code into the running kernel. The concept of kernel modules was developed to allow driver code to be inserted into a running kernel and also removed from the kernel when the device is no longer being used.

Hardware devices are identified on the Unix server as special device files. There are three different classifications of device files:

  • Character
  • Block
  • Network

Character device files can only handle data one character at a time. Most types of modems are character devices. Block device files can handle data in large blocks at a time, such as disk drives. Network devices use packets to send and receive data. This includes network cards and the special loopback device that allows the Unix system to communicate with itself using common network programming protocols.

Device files are created in the filesystem as nodes. Each node has a unique number pair that identifies it to the Unix kernel. The number pair includes a major and a minor device number. Similar devices are grouped into the same major device number. The minor device number identifies the device within the major device numbers. Listing 3.5 shows an example of device files on a Linux server.

Listing 3.5 Sample Device Listing from a Linux Server

[rich@shadrach /dev]$ ls -al sda* ttyS*
 brw-rw---- 1 root  disk  8, 0 May 5 1998 sda
 brw-rw---- 1 root  disk  8, 1 May 5 1998 sda1
 brw-rw---- 1 root  disk  8, 10 May 5 1998 sda10
 brw-rw---- 1 root  disk  8, 11 May 5 1998 sda11
 brw-rw---- 1 root  disk  8, 12 May 5 1998 sda12
 brw-rw---- 1 root  disk  8, 13 May 5 1998 sda13
 brw-rw---- 1 root  disk  8, 14 May 5 1998 sda14
 brw-rw---- 1 root  disk  8, 15 May 5 1998 sda15
 brw-rw---- 1 root  disk  8, 2 May 5 1998 sda2
 brw-rw---- 1 root  disk  8, 3 May 5 1998 sda3
 brw-rw---- 1 root  disk  8, 4 May 5 1998 sda4
 brw-rw---- 1 root  disk  8, 5 May 5 1998 sda5
 brw-rw---- 1 root  disk  8, 6 May 5 1998 sda6
 brw-rw---- 1 root  disk  8, 7 May 5 1998 sda7
 brw-rw---- 1 root  disk  8, 8 May 5 1998 sda8
 brw-rw---- 1 root  disk  8, 9 May 5 1998 sda9
 crw------- 1 root  tty  4, 64 Nov 29 16:09 ttyS0
 crw------- 1 root  tty  4, 65 May 5 1998 ttyS1
 crw------- 1 root  tty  4, 66 May 5 1998 ttyS2
 crw------- 1 root  tty  4, 67 May 5 1998 ttyS3

This shows the ls command being used to display all of the entries for the sda and ttyS devices. The sda device is the first SCSI hard drive, and the ttyS devices are the standard IBM PC COM ports. The listing shows all of the sda devices that were created on the sample Linux system. Not all are actually used, but they are created in case the administrator needs them. Similarly, the listing shows all of the ttyS devices created.

The fifth column is the major device node number. Notice that all of the sda devices have the same major device node, 8, and all of the ttyS devices use 4. The sixth column is the minor device node number. Each device within a major number has its own unique minor device node number.

The first column indicates the permissions for the device file. The first character of the permissions indicates the type of file. Notice that the SCSI hard drive files are all marked as block (b) files, whereas the COM port device files are marked as character (c) files.

To create a new device node, you can use the mknod command. The format of the mknod command is


where NAME is the filename and TYPE is the filetype (character or block). The OPTION parameter has only one usable option. The -m option allows you to set the permissions of the file as it is created. You must be careful to select a unique major and minor device node number pair.

Filesystem Management

Unlike some other operating systems, the Unix kernel can support different types of filesystems to read and write data to hard drives. Currently 16 different filesystem types are available on Linux systems. The kernel must be compiled with support for all types of filesystems that the system will use. Table 3.4 lists the standard filesystems that a Unix system can use to read and write data.

Table 3.4 Unix Filesystems




Amiga filesystem


Linux Extended filesystem


Second extended filesystem


OS/2 high performance filesystem


ISO 9660 filesystem (CD-ROMs)


MINIX filesystem


Microsoft FAT16


Netware filesystem


Network file system


Access to system information


Samba SMB filesystem


Older Unix filesystem


BSD filesystem


Unix-like filesystem that resides on top of MS-DOS


Windows 95 filesystem (fat32)


Similar to ext2, not used

Any hard drive that a Unix server accesses must be formatted using one of the filesystem types listed in Table 3.4. Formatting a Unix filesystem is similar to formatting an MS-DOS type disk. The operating system must build the necessary filesystem information onto the disk before the disk can be used to store information. The command that Linux uses to format filesystems is the mkfs command. The format of the mkfs command is

mkfs [ -V ] [ -t fstype ] [ fs-options ] filesys [ blocks ]

where fstype is the type of filesystem to use, and blocks is the number of blocks to use. The default filesystem type for Linux systems is ext2, and the default block count is all blocks available on the partition.

The Linux kernel interfaces with each filesystem using the Virtual File System (VFS). This provides a standard interface for the kernel to communicate with any type of filesystem. VFS caches information in memory as each filesystem is mounted and used.

  • + Share This
  • 🔖 Save To Your Account