Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Ostc Unit 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 56

Paavai Institutions

Department of CSE

UNIT 2

CONFIGURING ADDITIONAL HARDWARE

UNIT-II

2. 1

Paavai Institutions
TECHNICAL TERMS
SMTP

Department of CSE

Simple Mail Transfer Protocol (SMTP) is an Internet standard for electronic mail (email) transmission across Internet Protocol (IP) networks. SMTP was first defined by RFC 821 (1982, eventually declared STD 10), and last updated by RFC 5321 (2008) which includes the extended SMTP (ESMTP) additions, and is the protocol in widespread use today. SMTP uses TCP port 25. FTP File Transfer Protocol (FTP) is a standard network protocol used to transfer files from one host or to another host over a TCP-based network, such as the Internet. USB Universal Serial Bus (USB) is an industry standard developed in the mid-1990s that defines the cables, connectors and communications protocols used in a bus for connection, communication and power supply between computers and electronic devices. IMAP Internet message access protocol (IMAP) is one of the two most prevalent Internet standard protocols for e-mail retrieval, the other being the Post Office Protocol (POP). POP The Post Office Protocol (POP) is an application-layer Internet standard protocol used by local e-mail clients to retrieve e-mail from a remote server over a TCP/IP connection. POP and IMAP (Internet Message Access Protocol) are the two most prevalent Internet standard protocols for e-mail retrieval.

UNIT-II

2. 2

Paavai Institutions

Department of CSE

SAMBA Samba is a free software re-implementation of the SMB/CIFS networking protocol, originally developed by Andrew Tridgell. As of version 3, Samba provides file and print services for various Microsoft Windows clients and can integrate with a Windows Server domain, either as a Primary Domain Controller (PDC) or as a domain member. It can also be part of an Active Directory domain. PROXY SERVER A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource available from a different server and the proxy server evaluates the request as a way to simplify and control their complexity. HTTP The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed, collaborative, hypermedia information systems.[1] HTTP is the foundation of data communication for the World Wide Web. CUPS CUPS (formerly an acronym for Common Unix Printing System, but now with no official expansion) is a modular printing system for Unix-like computer operating systems which allows a computer to act as a print server. A computer running CUPS is a host that can accept print jobs from client computers, process them, and send them to the appropriate printer. FOOMATIC Foomatic is a configurable printing filter. It uses PPD files as configuration to generate appropriate output for a given printer. It is intended to be used with the Common Unix Printing System (CUPS). It uses ghost script in the background, using options according to the PPD file of the printer.

UNIT-II

2. 3

Paavai Institutions
CONTENTS

Department of CSE

2.1. Configuring additional hardware 2.1.1. Sound cards 2.1.2. Displays & display cards 2.1.3. Network cards 2.1.4. Modems 2.1.5. USB drives 2.1.6. CD writers 2.2. Understanding the OS boot up process 2.3. Performing everyday tasks using gnu/Linux 2.3.1. Accessing the Internet, playing music, editing documents and spreadsheets, 2.3.2. Sending and receiving email, copy files from disks and over the network 2.3.3. Playing games, writing CDs 2.4. X Window system configuration and utilities 2.4.1. Configure X windows 2.4.2. Detect display devices 2.4.3. Installing software from source code as well as using binary packages. 2.5. Setting up email servers 2.5.1. Using postfix (SMTP services) 2.5.2. Courier (IMAP & POP3 services) 2.5.3. Squirrel mail (web mail services) 2.6. Setting up file services 2.6.1. Using samba ( file and authentication services for windows networks) 2.6.2. Using NFS ( file services for gnu/Linux /Unix networks) 2.7. Setting up proxy services - Using squid ( http / ftp / https proxy services) 2.8. Setting up printer services 2.8.1. Using CUPS (print spooler) 2.8.2. Foomatic (printer database) 2.9. Question bank
UNIT-II 2. 4

Paavai Institutions
2.10. Reference Link

Department of CSE

UNIT-II

2. 5

Paavai Institutions

Department of CSE

2.1. CONFIGURING ADDITIONAL HARDWARE: 2.1.1 Sound Card Multimedia has received a lot of attention in the computer industry recently. Unix systems traditionally have not provided much support for multimedia in general, and sound in particular, except for some expensive professional systems. Workstation vendors are now scrambling to introduce multimedia-ready systems. With the availability of Linux and low-cost sound hardware for Intel-based PCs, a soundcapable UNIX system is within the reach of most computer hobbyists. Possibly because sound support was lacking in UNIX systems, many new users are confused by the technical jargon specific to sound and electronic music, and the many sound cards available. This article will to explain what can be done with sound under Linux, unravel some of the technical terms, and point the reader to sources of more information. What can a Sound Card do? The typical sound card hardware provides the capability for one or more of the following functions: playing and recording digitized sound samples playing music from an audio Compact Disc in a CD-ROM drive generating sounds using an internal FM synthesizer controlling external MIDI (Musical Instrument Digital Interface) devices miscellaneous functions, such as providing a joystick interface, SCSI disk interface, volume and tone controls, and facilities for mixing of inputs Different Types of Sound Cards For digitized sounds, there are two basic parameters that determine the sound quality: sampling rate and sample size. The sampling rate is the speed at which the analog waveform is converted to digital samples. This is expressed in samples per second, or more often (and less accurately), Hertz. The sample size indicates the number of data bits which are stored for each sample; the more bits, the more accurately the sample represents the original waveform. Sounds can also be

UNIT-II

2. 6

Paavai Institutions

Department of CSE

recorded with one channel (mono) or two channels (stereo). Various coding schemes are used to represent the sample as a numerical value. As an example, a low-cost sound card can produce single channel, 8-bit samples at 8000 samples per second. This provides sound quality comparable to the telephone network. A 16-bit sound card producing stereo sound at 44100 samples/second is equivalent to Compact Disc audio quality (ignoring issues such as noise and distortion). Some sound cards also provide hardware for producing sounds using FM synthesis. This technique is based on modifying sine waves. The advantage of this scheme is that the hardware is reasonably simple and not much computing power is required. The disadvantage is that it is difficult to determine the parameters needed to produce specific sounds (e.g., a piano). Sound cards also typically provide other miscellaneous features, including joystick ports, CD-ROM interface, SCSI interface, MIDI port, facilities for sound input and output, and volume and tone controls. Supported Sound Cards The Linux kernel currently supports the following sound cards: Roland MPU-401 MIDI interface AdLib SoundBlaster and compatibles (including Thunder Board and Ati Stereo F/X) SoundBlaster Pro SoundBlaster 16 ProAudioSpectrum 16 Gravis Ultra Sound The Linux kernel also supports the SCSI port provided on some sound cards (e.g., ProAudioSpectrum 16) and the CD-ROM interface provided on the SoundBlaster Pro and SoundBlaster 16. For those who do not (yet) have sound hardware, there are a couple of other options. With a little hardware, a sound interface can be built using the parallel printer port. For a zero-

UNIT-II

2. 7

Paavai Institutions

Department of CSE

cost solution, there is even a sound driver for the internal speaker of your PC. The driver is compatible with the sound card driver, but the quality may leave something to be desired. Configuring Linux for Sound Setting up Linux to support a sound card involves the following steps: 1. installing the sound card 2. configuring and building the kernel with the sound drivers 3. creating the sound device files 4. testing the installation The first requirement, if you have not already done so, is to install the sound card. Follow the instructions provided by the manufacturer. Be sure to note down the jumper settings for IRQ, DMA channel, and so on; if you are unsure, use the factory defaults. Try to avoid conflicts with other devices (e.g., Ethernet cards) if possible. You will also need speakers, and a microphone if you want to do any recording. A math co-processor is also useful for some sound applications (e.g., changing file formats, adding effects or speech synthesis), but not necessary. The next step is to configure the Linux kernel. If you are using a recent version (0.99 patch level 14 or later), the sound drivers are included with the kernel release. Follow your usual procedure for building the kernel. When you configure the kernel, enable the sound driver, and answer the questions about sound card settings when prompted by the configure program. Once the kernel is configured, you need to create the sound device files. The easiest way to do this is to cut the short shell script from the end of the file /usr/src/linux/drivers/sound/Readme.linux, and run it as root. These are the files that will be created: /dev/audio- Sun workstation compatible audio device (read/write) /dev/dsp- digital sampling device (read/write) /dev/mixer- sound mixer /dev/sequencer- MIDI, FM, and GUS synthesizer access /dev/midi- MIDI device (not yet implemented in current sound driver) /dev/sndstat- displays sound driver status when read /dev/audio1- for second sound card
UNIT-II 2. 8

Paavai Institutions

Department of CSE

/dev/dsp1- for second sound card If you are using the PC speaker sound driver, then it will use the following devices: /dev/pcaudio- equivalent to /dev/audio /dev/pcsp- equivalent to /dev/dsp /dev/pcmixer- equivalent to /dev/mixer Now that the kernel is configured and the device files created, you can verify the sound hardware and software. Follow your usual procedure for installing and rebooting the new kernel. (Keep the old kernel around in case of problems, of course.) Verify that sound card is recognized during kernel initialization. You should see a message such as the following on powerup: snd2 <SoundBlaster Pro 3.2> at 0x220 irq 5 drq 1 snd1 <Yamaha OPL-3 FM> at 0x388 irq 0 drq 0 This should match your sound card type and jumper settings. The driver may also display some error messages and warnings during boot up. Watch for these when booting the first time after configuring the sound driver. If no sound card is detected when booting, there are a couple of possible reasons. The configuration of the driver could be incorrect and the driver was not able to detect your card in the given I/O address. Another common error is not having the sound driver in the kernel, because you booted with an old kernel instead of the one that was just compiled. Reading the sound driver status device file provides additional information on whether the sound card driver initialized properly. Sample output should look something like this: % cat /dev/sndstat Sound Driver:2.4 (Sun Feb 13 14:49:20 EST 1994 root@fizzbin.mitel.com) Config options: 1aa2 HW config: Type 2: SoundBlaster at 0x220 irq 5 drq 1 Type 1: AdLib at 0x388 irq 0 drq 0 PCM devices: 0: SoundBlaster Pro 3.2
UNIT-II 2. 9

Paavai Institutions

Department of CSE

Synth devices: 0: Yamaha OPL-3 Midi devices: 0: SoundBlaster Mixer(s) installed If the cat command displays No such device, then the sound driver is not active in the kernel. If the printout contains no devices (PCM, Synth or Midi), then your sound card was not detected. Verify that you entered the correct information when configuring the sound driver. Now you should be ready to play a sample sound file, and send it to the sound device as a basic check of sound output, for example, % cat endoftheworld >/dev/dsp % cat crash.au >/dev/audio Some sample sound files can be obtained from the file snd-data-0.1.tar.Z, available on many Linux archive sites. If you have sound input capability, you can do a quick test of this using command such as the following: # record 4 seconds of audio from microphone % dd bs=8k count=4 </dev/audio >sample.au # play back sound % cat sample.au >/dev/audio 2.1.2 Display Card 1. Install a second graphics card (optional). 2. Attach one monitor to the video connector of each graphic card, and boot the system. The system outputs to PCI-E slot 2 (default). You can modify this in the BIOS Graphic Adapter screen, located under the Advanced menu and the Initiate submenu. 3. When the system boots, insert the Tools and Drivers DVD, and change directory to the following location: / cdrom/ T&D_disk_name/drivers/linux/OS

UNIT-II

2. 10

Paavai Institutions

Department of CSE

T&D_disk_name The name of the Tools and Drivers disk OS Either redhat or suse. 4. Run the install.sh script. 5. Reboot system after the install.sh script has finished successfully. 6. Log in to run the Nvidia settings in a terminal window. 7. Set up multi-display mode under X Server Display Configuration. 8. Click Apply to update the X Server with the new configuration. 9. Click Save to X Configuration File to save the display configuration to the /etc/X11/xorg.conf file. 2.1.3 Network Card: Table 2.1: Linux TCP/IP Network Configuration Files: File Description /etc/resolve.conf List DNS servers for internet domain name resolution. Manual page for: /etc/resolv.conf /etc/hosts Lists hosts to be resolved locally (not by DNS). Manual page for: /etc/hosts /etc/nsswitch.conf List order of host name search. Typically look at local files, then NIS server, then DNS server. Manual page for: /etc/nsswitch.conf Red Hat/Fedora/CentOS: Specify network configuration. Eg. Static IP, DHCP, NIS, etc. /etc/sysconfig/network Red Hat/Fedora/CentOS: /etc/sysconfig/networkSpecify TCP network information. scripts/ifcfg-device Ubuntu/Debian: Specify network configuration and devices. Eg. Static IP and info, /etc/network/interfaces DHCP, etc.

UNIT-II

2. 11

Paavai Institutions

Department of CSE

Domain Resolution Configuration Files: File: /etc/resolv.conf - host name resolver configuration file search name-of-domain.com - Name of your domain or ISP's domain if using their name server nameserver XXX.XXX.XXX.XXX - IP address of primary name server nameserver XXX.XXX.XXX.XXX - IP address of secondary name server 127.0.0.1 your-node-name.your-domain.com localhost.localdomain local host XXX.XXX.XXX.XXX node-name File: /etc/hosts - locally resolve node names to IP addresses Note when adding hosts to this file, place the fully qualified name first. (It helps send mail identify your server correctly) i.e.: XXX.XXX.XXX.XXX superserver.yolinux.com super server This informs Linux of local systems on the network which are not handled by the DNS server. (or for all systems in your LAN if you are not using DNS or NIS) The file format for the hosts file is specified by RFC 952. Red Hat/Fedora configuration GUI: /usr/sbin/system-config-network (select tab "Hosts"). File: /etc/nsswitch.conf - System Databases and Name Service Switch configuration file hosts: files dns nisplus nis This example tells Linux to first resolve a host name by looking at the local hosts file(/etc/hosts), then if the name is not found look to your DNS server as defined by /etc/resolv.conf and if not found there look to your NIS server. In the past this file has had the following names: /etc/nsswitch.conf, /etc/svc.conf, /etc/netsvc.conf, ... depending on the distribution. Fedora / Red Hat Network Configuration Files: /etc/sysconfig/network Red Hat network configuration file used by the system during the boot process. File: /etc/sysconfig/network-scripts/ifcfg-eth0 Configuration settings for your first ethernet port (0). Your second port is eth1.
UNIT-II 2. 12

Paavai Institutions

Department of CSE

File:

/etc/modprobe.conf (kernel 2.6) /etc/modules.conf (kernel 2.4) (or for older systems: /etc/conf.modules) Example statement for Intel ethernet card: Use full Linux networking commands: /etc/rc.d/init.d/network start - command to start, restart or stop the network netstat - Display connections, routing tables, stats etc List externally connected processes: netstat -punta -a: Show both listening and non-listening sockets. -p: Show PID of process owning socket -u: Show UDP -t: Show TCP -n: Show IP addresses only. Don't resolve host names -g: Show multi-cast group membership info -c: Continuous mode - update info every second -v: Verbose -e: Extended information -o: show network timer information List all connected processes: netstat -nap Show network statistics: netstat -s Display routing table info: netstat rn $ netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.1.0 0.0.0.0 255.255.255.0 U 00 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 00 0 eth0 0.0.0.0 192.168.1.1 0.0.0.0 UG 00 0 eth0

UNIT-II

2. 13

Paavai Institutions

Department of CSE

2.1.4 Modems Your modem is a peripheral device to Linux, like a CD-ROM drive, hard drive, or a mouse. Your modem will be connected to a serial port, which means that one of the serial devices in the /dev directory actually points to your modem. We may notice that there's also a file, /dev/modem, which serves as a placeholder for your modem. Initially this file doesn't point to anything. To simplify your operations, so that applications like minicomand seyon need only refer to /dev/modem, you can create a symbolic link from the serial device connected to your modem to /dev/modem. To do so, login as root and issue the command: ln -sf /dev/ttyS X /dev/modem where X is replaced by the number corresponding to the serial device that points to your modem. shows how the proper command corresponds to the device by which your modem is known user DOS and Linux. Command to Create /dev/modem DOS Modem Device Linux Modem Device COM1 ttyS0 COM2 ttyS1 COM3 ttyS2 COM4 ttyS3

Command ln -sf /dev/ttyS0 /dev/modem ln -sf /dev/ttyS1 /dev/modem ln -sf /dev/ttyS2 /dev/modem ln -sf /dev/ttyS3 /dev/modem

2.1.5 USB Drives Detecting USB hard drive After you plug in your USB device to your USB port, linux will add new block device into /dev/ directory. At this stage you are not able to use this device as the USB file system needs to be mounted before you are able to retrieve any data. To find out what name your block device file have you can run fdisk command: # fdisk -l
UNIT-II 2. 14

Paavai Institutions
You will get output similar to this: Disk /dev/sdb: 60.0 GB, 60060155904 bytes 255 heads, 63 sectors/track, 7301 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x000b2b03 Device Boot /dev/sdb1 Start End Blocks Id System 1 7301 58645251 b W95 FAT32

Department of CSE

Creating mount point Create directory where you want to mount your device: mkdir /mnt/sdb1 Edit /etc/fstab To automate this process you can edit /etc/fstab file and add line similar to this: /dev/sdb1 /mnt/sdb1 vfat defaults 0 0 Run mount command to mount all not yet mounted devices. Keep in mind that if you have more different USB devices in you system, device name can vary!!! # mount -a 2.1.6 CD Writers First, you need a compatible CD burner. Linux works with SCSI CD-burners, IDE CDburners (through ide-scsi emulation), and USB CD burners. In all cases, the device appears as a SCSI device. If you can see your device with the command 'cdrecord -scanbus', then you are ready to burn. Configuring CD writer Often, people have a IDE cd-writer, but don't have the ide-scsi emulation turned on. This is best done by editing the /etc/lilo.conf on your computer, and adding an entry to your current boot option:
UNIT-II 2. 15

Paavai Institutions
image=/boot/vmlinuz-STD-current label=linux read-only root=/dev/device append="hdb=ide-scsi"

Department of CSE

(NOTE: this is just an example, your root partition and CD-writer device might be different. ) Using cdrecord The output of 'cdrecord -scanbus' will look something like this: # cdrecord -scanbus Cdrecord 1.9 (i686-pc-linux-gnu) Copyright (C) 1995-2000 Jrg Schilling Linux sg driver version: 3.1.22 Using libscg version 'schily-0.1' scsibus0: 0,0,0 0) 'TOSHIBA ' 'DVD-ROM SD-R1202' '1020' Removable CD-ROM 0,1,0 1) * 0,2,0 2) * 0,3,0 3) * 0,4,0 4) * 0,5,0 5) * 0,6,0 6) * 0,7,0 7) *

The CD writer is the device labeled '0,0,0' in this example. You can now use cdrecord to burn an audio or data CD, using that device number. Here's an example of how to burn an ISO image to a cd, using cdrecord:
UNIT-II 2. 16

Paavai Institutions
# cdrecord -v speed=2 dev=0,0,0 -data cdimage.iso

Department of CSE

Read the man page for 'cdrecord' for more options and examples. Making ISO images we may want to generate a CD image containing data. You can do this with the comand 'mkisofs'. mkisofs -r -o cd_image private_collection/ `---------' `-----------------' | | write output to take directory as input we can then use cdrecord to write cd_image to a CD. Performing Every Day Tasks Using Gnu/Linux: Accessing the Internet: Note that should DNS not be configured correctly on your machine, you need to edit "/etc/resolv.conf" to make things work...host Performs a simple lookup of an internet address (using the Domain Name System, DNS). Simply type: host ip_address or host domain_name dig The "domain information groper" tool. More advanced then host... Give a host-name as an argument to output information about that host, including it's IP address, hostname and various other information. For example, to look up information about "www.amazon.com" type: dig www.amazon.com To find the host name for a given IP address (ie a reverse lookup), use dig with the `-x' option. dig -x 100.42.30.95

UNIT-II

2. 17

Paavai Institutions

Department of CSE

This will look up the address (which may or may not exist) and returns the address of the host, for example if that was the address of http://slashdot.org then it would return "http://slashdot.org". dig takes a huge number of options (at the point of being too many), refer to the manual page for more information. whois (now BW whois) is used to look up the contact information from the "whois" databases, the servers are only likely to hold major sites. Note that contact information is likely to be hidden or restricted as it is often abused by crackers and others looking for a way to cause malicious damage to organisation's. wget (GNU Web get) used to download files from the World Wide Web. To archive a single web site, use the -m or --mirror (mirror) option. Use the -nc (no clobber) option to stop wget from overwriting a file if you already have it. Use the -c or --continue option to continue a file that was unfinished by wget or another program. Simple usage example: wget url_for_file This would simply get a file from a site. wget can also retrieve multiple files using standard wildcards, the same as the type used in bash, like *, [ ], ?. Simply use wget as per normal but use single quotation marks (' ') on the URL to prevent bash from expanding the wildcards. There are complications if you are retrieving from a http site (see below...). Advanced usage example, (used from wget manual page): wget --spider --force-html -i bookmarks.html This will parse the file bookmarks.html and check that all the links exist. Advanced usage; this is how you can download multiple files using http (using a wildcard...).

UNIT-II

2. 18

Paavai Institutions

Department of CSE

Notes: http doesn't support downloading using standard wildcards, ftp does so you may use wildcards with ftp and it will work fine. A work-around for this http limitation is shown below: wget -r -l1 --no-parent -A.gif http://www.website.com[1] This will download (recursively), to a depth of one, in other words in the current directory and not below that. This command will ignore references to the parent directory, and downloads anything that ends in ".gif". If you wanted to download say, anything that ends with ".pdf" as well than add a -A.pdf before the website address. Simply change the website address and the type of file being downloaded to download something else. Note that doing -A.gif is the same as doing -A "*.gif" (double quotes only, single quotes will not work). wget has many more options refer to the examples section of the manual page, this tool is very well documented. 2.3 Performing everyday tasks using gnu/Linux 2.3.1 Editing Documents and Spreadsheets: GNumeric : GNumeric is a SpreadSheet program that is part of the GNOME Free Software Desktop Project. Gnumeric version 1.0 was released December 31, 2001. Gnumeric is distributed as free software under the GNU GPL license . it is intended to replace proprietary and other spreadsheet programs such as Microsoft Excel which it broadly and openly emulates. Gnumeric was created and developed by Miguel de Icaza but he has since moved on to other projects. The current maintainer is Jody Goldberg. LibreOffice : LibreOffice is a free software office suite developed by The Document Foundation as a fork of OpenOffice.org
UNIT-II 2. 19

Paavai Institutions

Department of CSE

That is compatible with other major office suites, including Microsoft Office . and available on a variety of platforms. Its developers' goal is to produce a vendor-independent office Suite with ODF Support and without any copyright assignment requirements. The name is a hybrid word with the first part Libre, which means free (as in freedom) in both Spanish French and the English word Office. The Document Foundation intends to release new major versions of LibreOffice once every six months and to eventually align with the March / September schedule of the other major free software projects Playing a Sound File The play tool distributed with sox (a sound file translation tool) can recognize and play many audio formats, including WAV, VOC, AU, AIFF, and SND format files, as well as audio CDformat files and various raw binary files; just about the only common audio formats it can't handle are MP3 and MIDI files, which are discussed in the sections to follow. To play the file `pentastar.aiff', type: $ play pentastar.aiff RET 2.3.2 Sending and Receiving Email The primary means of sending plaintext messages (or binaries in attachment files) between users across computer networks and systems on the Internet is called electronic mail, or email (and more often than not these days, just "mail"). The number of email applications (called mail user agents, or MUAs) available for Linux is large, and you could spend endless hours exploring the details of all of them. Instead of guiding you toward this route, this chapter attempts to do three things: give a brief intro to using the default mail agent; give an overview of other
UNIT-II 2. 20

Paavai Institutions

Department of CSE

wellsupported mail agents, with pointers on where to go for more info; and show how you can use other tools on the system to manipulate your email. The mail tool is the default mail agent on Debian and most other Linux systems. It comes without many bells and whistles that are standard with most MUAs, and any user who sends and receives email more than occasionally will certainly want to learn a more advanced system Sending Mail To send an email message with mail, give the email addresses to which you are sending as arguments, and then type the message proper in the lines that follow; type Cd on a line by itself to signify the end of the message body, and to send the message. To send an email message to lisa@example.com, type: $ mail lisa@example.com RET Subject: Hello RET Hi there, long time no talk! I'm just learning how to use RET Linux and thought I'd show you how easy it is to send email! RET Cd Cc: RET The text you type on the `Subject:' line is displayed as the subject of your email message, and the lines of text you type after that is the body text of the message. Type Cd on a line alone to end the message. Then, mail prompts for `Cc:' addresses; a "carbon copy" of the email message is sent to any addresses you give here, if any (just type RET for none, and separate multiple addresses with commas). Receiving Mail On Linuxbased systems, the INBOX is a text file on the system where your incoming mail is written to. Its location is always given by $MAIL, a special shell variable (see section Changing the Shell Prompt).
UNIT-II 2. 21

Paavai Institutions
To output the location of your INBOX, type: $ echo $MAIL RET

Department of CSE

Usually, the INBOX location is in the `/var/spool/mail' directory, and has the same name as your usernameso if your username is mrs, your INBOX is likely `/var/spool/mail/mrs'. You shouldn't directly edit this file, because doing so can inadvertently cause you to lose incoming mail. To see if you have any mail waiting in your INBOX, type mail. If you don't have any mail, mail will indicate this and exit; if you do have mail waiting, mail outputs a list of message headers, one line per message, each containing the status of the message (`N' for new messages, blank for previously read messages), the message number, the name of the sender, the date and time the message was received, and the number of lines and characters in the message. To see if you have mail, type: $ mail RET Mail version 8.1 6/6/93. Type ? for help. "/var/spool/mail/m": 3 messages 3 new 62;N 1 mrs Mon Sep 6 17:29 13/345 "Re: A modest proposal" N 2 Ray Tue Sep 7 04:20 15/694 "Latest news" N 3 lisa@example Tue Sep 7 09:35 19/869 "Re: Hello" 38; In this example, the user has three messages waitingone from mrs, one from Ray, and one from lisa@example.com. The mail prompt is an ampersand (`&') character; from there, you can read, delete, reply to, and save messages. When you type RET at the `&' prompt, mail outputs the next unread message to the screen. You can also type a number to output that message.
UNIT-II 2. 22

Paavai Institutions
To read the next unread message in mail, type: 38; RET Copying Files from Disk:

Department of CSE

Change to the root of the tree you wish to copy. Then, duplicate the directory structure using Code: find . -depth -type d -exec mkdir -p -- '/where/to/copy/{}' ';' Then copy the desired files using Code find . -depth -name '*.m' -or -name '*.mat' -exec cp -vi -- '{}' '/where/to/copy/{}' ';' If you want to remove any empty directories afterwards, run Code find /where/to/copy/ -depth -type d -exec rmdir -- '{}' ';' it'll complain about not being able to remove the directories with files, but that's okay; just ignore the warnings. It will only remove the empty directories. The double dashes above tell the commands that even if the file or directory names begin with a dash, they're still names, not options 2.3.3 Playing games in Linux Games a have been a mixed bag with Linux, and still needs perfecting, however companies like id software and others are releasing their top titles for Linux as well as Windows these days, and is helping the overall popularity of Linux as a gamin platform no end. Games such as the Quake, Doom and Wolfenstein series are available 'natively' for Linux (that is, the software is written to work in Linux). Other games which will also

UNIT-II

2. 23

Paavai Institutions

Department of CSE

work with Linux such as the Soldier of Fortune series have been ported from their Windows base. However, the majority of games software for the PC is still released for Windows only. There is a solution, however - a company called Tran gaming Technologies has a product called Cedega which allows the user to play most of the Windows games titles within Linux. This software is not free, but is fairly priced, and offers a good degree of ease of use. There are a great number of games which are also freely available Linux software which you can see at places such as linuxgames.com or happypenguin.org. Tux Games have done a great job of porting commercial games to Linux which you can buy for great prices. Writing CDs and DVDs Over the last two years, burning media in Linux has become a whole lot easier for the average user. If you are a GNOME user, Gnome Baker, Serpentine and the GNOME file manager (Nautilus) will burn CDs for you. KDE users can use the excellent K3B software, and if all of that choice isn't good enough for you, Nero software are now producing Nero Burning ROM for Linux. Burning data CDs or DVDs using GNOME is as simple as placing a blank CD in your burner. The gnome file explorer (Nautilus) pops up a file window, where you can drag and drop your files into. Once you are ready to burn, simply click the 'Write to CD' button. If you have .iso images on your hard drive, you can burn these easily too, by simply right clicking on them in the file manager and selecting 'Write to CD'. Ubuntu 5.10 ships with 'Serpentine', an audio CD burner, which will burn audio CDs, converting all your MP3s or OGGs into the CD Audio format for you automatically.
UNIT-II 2. 24

Paavai Institutions

Department of CSE

K3B is the best tool to use if you have KDE, and is similar in nature to Nero burning ROM. Creation of CDs, DVDs and Audio Discs can all be made from a simple menu. 2.5 Setting up email servers using postfix (SMTP Services) Configuring Mail Servers How to setup SMTP, POP3 and IMAP servers on GNU/Linux Scope of this section Understand the basics of Mail Servers Setup and configure the Postfix MTA (SMTP Server) Setup and configure the Courier IMAP / POP3 Servers Using Linux mail clients History of SMTP SMTP stands for Simple Mail Transfer Protocol. Defined in RFCs Is the de facto standard for email receipt and delivery Has constantly evolved to serve challenges of modern day email systems Many SMTP servers for Linux - Sendmail, Postfix, qmail,Exim are the major ones Today SMTP servers not only accept, relay and deliver email, but also perform other functions like Authentication, SPAM filtering and Access Control Base protocol defined in RFC 821 in 1982 Further refined and extended in RFCs: 822, 1425, Flow of Email Step 1: Mail client connects to the SMTP server saying that it has an email to send Step 2: SMTP server authenticates the client to ensure that it is allowed to relay through it Step 3: SMTP server accepts the message and gives a success code to the mail client as well as a message ID
UNIT-II 2. 25

Paavai Institutions

Department of CSE

Step 4: SMTP server checks the recipient(s) of the message and does a local delivery if the recipient(s) are local; if the recipient(s) are not local, then the SMTP server initiates a remote mail delivery Step 5: SMTP server connects to the remote mail server and tries to deliver the email Step 6: Remote mail server authenticates the delivery and accepts the email if it is authorized to receive email for the recipient(s) Step 7: The remote mail server delivers the email to the recipient(s) mailbox Step 8: Recipient(s) open the mailbox (using protocol like IMAP or POP3 or locally on the shell) and read the email Role of DNS in Mail Delivery DNS plays a very important role in delivering email To be able to deliver an email to a remote mail server, a SMTP server has to use DNS to query the mail server of a specific recipient Mail server information is stored in the DNS using the MX record A DNS server could have multiple MX records for redundancy or load distribution On receiving information of the destination mail server from the MX record, a SMTP server will initiate a connection as soon as possible If the connection fails, then the SMTP server will keep trying again and again until it get a permanent error. The SMTP server can also query the DNS to get information about other mail servers that are available for the recipient and then try to initiate a mail delivery through them. Installation Plan Install Postfix MTA to host a local email domain. Configure Postfix for some basic form of relay access control and test out mail delivery to a Users mailbox.
UNIT-II 2. 26

Paavai Institutions

Department of CSE

Understand how mail delivery happens and lookup emails in the users mailbox. Study logs to see what information is given by the mail server while delivering email. Install and configure a IMAP & POP3 server so that we can lookup email using a standard mail Client. Postfix as an MTA Postfix is a SMTP server written as replacement for Send mail It is designed to be secure and easy-to-use yet powerful SMTP server Postfix can run on Linux, Unix and most Unix-like systems Ships under the IBM Public License - Version 1.0 Is available as source code as well as binary packages under most distributions Is a very flexible and advanced SMTP server - can be used to run a simple single domain mail server as well as very busy and high traffic mail servers. Installing Postfix Using the Debian repository: apt-get install postfix Using source code: Download and uncompress the source code Chdir to the source directory Before compiling, ensure that libdb-dev (Berkley DB development package) is installed since Postfix needs that Configure the software and generate the Make files -make -f Make file.in MAKELEVEL= Make files Compile the software using: make Install Posfix: make install Postfix is now ready to use!

UNIT-II

2. 27

Paavai Institutions

Department of CSE

The Postfix Directory Structure Postfix uses the following directories for storing configuration, data and binaries: /etc/postfix - for configuration files /usr/sbin - for server / system binaries /usr/bin - for user level binaries (like mailq) /var/spool/postfix - for storing the mail queue Postfix, by default, delivers email into /var/spool/mail/<username> file. However, we will change this behavior to deliver email to a users mailbox in his/her home directory itself. Postfix is very specific about these paths - these are Compile time options and are there too, they are very difficult and cumbersome to change. Postfix Configuration Files /etc/postfix/main.cf - This is the major Postfix configuration file. It controls all the settings and details of the Postfix MTA /etc/postfix/master.cf - Master process configuration file; controls how different Postfix components are initiated and run /etc/aliases - Email and system aliases for email delivery /etc/postfix/access - The Postfix access table; configures Postfix to selectively accept or reject email /etc/postfix/relocated - Handles bounce messages for users who have moved Basic Postfix Configuration Configure the main.cf file for the following options: myorigin - Value = Domain; will be used for all outgoing email mydestination - Value = Domains; what domains to receive emails for. These domains are considered to be hosted on Postfix and Postfix will accept all email meant for these domains
UNIT-II 2. 28

Paavai Institutions

Department of CSE

my networks - Value = Network subnets; what networks can clients relay from emails from these networks configured here are accepted unconditionally - irrespective to whom they are addressed relay host - Value = host ; This configuration is not mandatory - configures Postfix to relay outgoing email through the configured host. Basic Postfix Configuration Configure the main.cf file for the following Options: smtpd banner - Value = string ; Specifies what sort of banner to show for SMTP connections my hostname - Value = hostname ; Specifies what the machine running postfix will be identified as home mailbox - Value = Mailbox / Maildir ; Specifies the format and location of a users mailbox local recepient maps - configures how to look up valid local recepients and deliver email to them; empty value disables recepient lookups The Maildir Mailbox Format Maildir format invented by Prof DJ Bernstein, the author of the qmail MTA Replaces the mbox format mbox format stores all mailbox messages in a single file; each message is separated by a delimiter Maildir format stores all messages in a directory with each message being stored in a separate file The filename is a timestamp - the time at this the message was delivered Maildir mailboxes are fast, dont need to be locked during operation, can be operated on Simultaneously, are NFS-safe and very easy to use! Using latest file sytems such as ReiserFS, which can efficiently store thousands of files in a single directly, Maildir becomes even more useful
UNIT-II 2. 29

Paavai Institutions

Department of CSE

Testing Mail Delivery The socket / telnet method Use basic SMTP protocol to send email by connecting to port 25 A sample transaction is shown in the next slide Using the mail command Linux ships with a mail command that allows one to send emails We can also use this command to test out mail delivery to local system users Using a mail client which supports the SMTP protocol 2.5.2 Courier (IMAP & POP3 Services) The IMAP & POP3 Protocols Mailbox access protocols Standards via RFCs IMAP run on port 143 (TCP) while POP3 runs on port 110 (TCP) POP3 is a very simple protocol that allows you to connect to a mailbox, list emails in the INBOX and then fetch those emails one-by-one IMAP is a more complex protocol - allows you to access other mail folders apart from the INBOX as well - can be used to store email on the server and only keep a copy on the local machine Installing & Running Courier-IMAP /POP3 apt-get install courier-pop courier-imap Not much configuration required - default configuration will work just fine Configuration stored in /etc/courier directory Steps to start the IMAP & POP3 Services: Start Courier Authentication Service: /etc/init.d/courier-authdaemon start Start Courier IMAP Service: /etc/init.d/courier-imap start Start Courier POP3 Service: /etc/init.d/courier-pop start Test out using a mail client or by telnetting to ports 143(IMAP) or 110 (POP3) Introduction to Squirrel Mail (Webmail):

UNIT-II

2. 30

Paavai Institutions

Department of CSE

Squirrel Mail (Webmail) is a web-based e-mail program used by the DCSD. It is the recommended means for email. Webmail has all the functionality you would want from an email client, including spell check, calendar, address books, and folder manipulation. Webmail is a web interface designed to allow email access through your server from anywhere in the world via the Internet. HOW TO ACCESS WEBMAIL/SQUIRRELMAIL After accessing the internet from Netscape 7.2 or almost any browser (do not use Netscape Communicator 4.8), type https://webmail.dubuque.k12.ia.us/mail/src/login.php for the log in screen. A message might prompt you about a certificate and if so, accept the certificate permanently. We have added a link onto CenterPoint at Lincoln so that you can open up webmail from there.

At the logon screen, type your mail login and password and click the Login button. Your mail login is the prefix to your email address your first initial and entire last name i.e. John Johnson would be jjohnson. (***Please Note: Your default Password was communicated to you in a separate communication.)
UNIT-II 2. 31

Paavai Institutions

Department of CSE

New accounts in Webmail will not contain your old emails or folders. Unfortunately, there is no way for IT to transfer emails from your old account to your new Squirrel Mail account. You can still access your old email account to reference those previous emails through Netscape Communicator. The Basics Webmail is laid out in two main sections called frames. The left frame lists the current folders. On the right is where most of the action will take place. At the top of the page is a menu bar. Sign out will safely log you out of the program when you are finished. The Current Folder displays which of the folders listed in the left frame you are currently in. Right after you log in, by default your INBOX will be shown.

Under the top bar is a row of menu choices: 1. Compose - Make and send an email which may include attachments. 2. Addresses - Holds a list of addresses that are contained in your personal address book. 3. Folders - All folder manipulation takes place under this. You can delete, create and rename. 4. Options - Change settings of how Webmail responds and looks. 5. Search - With this tool, you can search through a mailbox for given criteria. 6. Help Gives you a bit of additional information. 7. Calendar This is your very on personal calendar for reminders, to do lists etc.
UNIT-II 2. 32

Paavai Institutions

Department of CSE

EMAIL To receive mail, click on the CHECK MAIL link located at the top left corner of your folders list. Then click the INBOX (found directly below the CHECK MAIL link) to refresh the inbox view.

2.6.1 Setting up File Service using Samba: Sharing files with other Linux & Windows computers Scope of this section File sharing and file services Using Samba to provide file services to windows networks. Using NFS to provide file services to Linux/ Unix networks . Essence of file sharing File sharing lets you share files on your machine with others on the network File sharing also lets you access files that are shared by others File services enable organizations to create and maintain central data stores File servers also allow complex access control to be applied to the data stored on the server - so that only those who should have access to the data can access it A file server could be used to share data with a Windows network or a Linux / Unix network - Linux contains software to do both these things.
UNIT-II 2. 33

Paavai Institutions

Department of CSE

File sharing services on Linux Linux-with-Linux file sharing is implemented with a set of protocols called NFS (Network File Service). NFS is basically a UDP based protocol that allows Linux and Unix systems to access Files stored on other machines. However, NFS, today, also support TCP-based file services. Linux-with-Windows file sharing is implemented using the Samba package. Samba is Free Software that implements the SMB and NetBIOS protocols. It lets a Linux user create shares so that the files can be accessed over the network from a Windows machine. Introduction to Samba Project home page: www.samba.org - Opening Windows to a Wider World Samba was developed by Andrew Tridgell, an Australian developer who basically wanted to access files stored on a Unix machine from his Windows machine Samba has been developed by reverse-engineering Microsoft's CIFS (Common Internet File System), SMB (Server Message Block) and NetBIOS protocols. These are not standardized protocols and are solely under the control of Microsoft. However, Samba developers have managed to ensure that Samba remains abreast and upto- date with Windows development. Samba implements the complete suite of Microsoft server protocols for file sharing, domain Controllers and membership and authentication. Installing Samba - Binaries Samba is divided into multiple packages on Debian: samba / samba-common - main server packages samba-doc - Samba documentation smbclient / libsmbclient - Samba client utilities and libraries winbind - For enabling username lookups against Windows smbfs - For mounting Windows shares on Linux
UNIT-II 2. 34

Paavai Institutions

Department of CSE

swat - Samba Web Administration Tool Saying apt-get install samba smbclient samba-doc swat should be good for the purpose of our discussion here - it will also take care of all the dependencies Start Samba using: /etc/init.d/samba start Installing Samba - From Source Download source code from a Samba mirror (details at www.samba.org) Uncompress source code and read the README file and other required docs Using the configure utility to configure Samba -you might want to change the prefix to something like /usr/local/samba/ so that you have all Samba related stuff in one place Then run the make command to compile the software make the binaries Samba has to be manually started - Eg. smbd -D, nmbd D Samba Binaries Some useful Samba binaries are listed below smbd - The SMB / CIFS daemon [samba] nmbd - The NetBIOS server daemon [samba] smbpasswd - The Samba Password tool [samba-common] net - Multipurpose tool for administering Samba[samba-common] smbclient - Linux-based Samba client [smbclient] testparm - Tests whether the Samba config files are correct [samba-common] nmblookup - Resolves a NetBIOS name into its IPaddress [samba-common] Samba Configuration & Data Files and Logs Main configuration is smb.conf. Binaries expect to find this file as /etc/samba/smb.conf Samba maintains its configuration in /var/lib/samba/ and other cached configuration in /var/cache/samba/ Default Samba logs - log.smbd and log.nmbd - can be found in /var/log/samba/ Samba also maintain a file called smbpasswd which stores information about SMB user
UNIT-II 2. 35

Paavai Institutions

Department of CSE

accounts and their passwords. Configuring Samba :: Global Configuration Global configuration manages the behavior of the Samba server and its role in the network Minimal Options include: (M = Mandatory, O = Optional, s= string, m = multiple options, b = boolean) workgroup : M,s : The workgroup or domain that the Samba server will be a part of netbios name : O,s : How the server will be known on the network server string : O,s : Description of the Samba server security : O,m : The server role that the Samba server will perform - can be one of user (domain controller is enabled), share (only per-share level access control and authentication is enabled), domain (authentication information is picked up from another domain controller or server). encrypt passwords : M,b : Whether passwords sent by a client should be encrypted or not passdb backend: M,s : What type of database to use for picking up user accounts printing: O,m : Printing system to use log level : O,s : Verbosity of the log messages preferred master : M,b : Is the server going to be the master browser of the workgroup? local master : M,b : Should nmbd try to become the local master of the workgroup? domain master : M,b : Primary domain controller? domain logons : M,b : Enable domain logons? logon home : M,s : The network path for the logon home share [global] workgroup = NRCFOSS netbios name = laptop server string = Samba Test Server security = user
UNIT-II 2. 36

Paavai Institutions

Department of CSE

encrypt passwords = yes passdb backend = smbpasswd:/etc/samba/smbpasswd printing = cups log level = 1 preferred master = yes local master = yes domain master = yes domain logons = yes logon home = \\laptop\homes logon drive = x: Configuring Samba Shares Samba shares export Linux files / directories and make them available on other machines Basic Samba share options are: comment - Description of what the share is about path - Absolute path of the directory being shared read only - Whether the share is read-only or read-write guest ok - Should unauthenticated users be allowed to view the share? browseable - Should the share show up while "browsing" the Samba server? valid users - List of users who are allowed to see this share force user - The user on the behalf of which all directory operations are done More Samba share options: read list - Users who has read-only access to the share's data; this is generally used in Conjugation with the force user option. If this option is given, file system based access control is not used. Write list - Users who have full read-write access to the share's data Lookup man smb.conf for more
UNIT-II 2. 37

Paavai Institutions
Sample Samba Share [mydata] comment = MyData Share path = /mydata read only = no guest ok = no browseable = yes [homes] comment = Home Directory of %U path = /home/%U read only = no guest ok = no browseable = no force user = %U

Department of CSE

Managing Samba Users Samba can only authenticate users against passwords stored in its own database; it can not authenticate users again the Linux passwd file However, it is necessary to have a mapping between Linux system users and Samba users - for each Samba user, a valid system user with the same name should also exist; otherwise Samba will not be able to lookup the user In the simplest of scenarios, Samba can store its accounts in the smbpasswd file. The smbpasswd utility can be used to manipulate the smbpasswd file. To add a user: smbpasswd -a <username> To change a user's password: smbpasswd <username> To delete a user: smbpasswd -x <username> Lookup man smbpasswd for help Samba Clients Testing out Samba authentication and configuration with the smbclient utility
UNIT-II 2. 38

Paavai Institutions

Department of CSE

smbclient usage I: smbclient -Llocalhost -U<username> smbclient usage II: smbclient \\\\<machine>\\<share-name> -U<username> smbclient can be used to talk to a Samba server or even a Windows destop / server A very versatile utility that can help debug most basic samba configuration problems Lookup man smbclient for help 2.6.2 Introduction to NFS NFS is a file sharing protocol primarily used on the Linux / Windows world NFS is completely transparent for a user or application -there is no change in the way a user or application would access a file on disk or over NFS NFS is commonly implemented over UDP; it depends on RPC to perform most of its functions On Debian, the NFS server package is called: nfs-kernel-server. Installing this package will install NFS on your Linux system. Kernel Support for NFS To run NFS kernel services, your Linux kernel needs to have NFS support Kernel level NFS support is implemented at both the server and client end Without this kernel support, you will not be able to use NFS at all Unlike NFS, Samba is implemented completely in userspace and does not depend on the kernel at all Each Linux and Unix / Unix-like system has a NFS client and server implementation Setting up NFS Exports NFS shares are configured through the /etc/exports file Format of NFS share configuration is a follows: <DIRECTORY> MACHINE_NAME(OPTIONS) Eg. /data/debian *(ro,sync,no_root_squash)
UNIT-II 2. 39

Paavai Institutions

Department of CSE

A MACHINE_NAME could be any of the following: Single host (192.168.1.1) A network or subnet (192.168.1.0/24) Wildcards (* or *.test.in) OPTIONS can ba any of the following: ro / rw - for read-only or read-write access sync / async - use synchronous or asynchronous disk access root squash - don't map root on client machine to rooton the server all squash - don't map any user on the client machine to its respective user on the server; in both these cases, users are mapped to the 'anonymous' user -nobody by default anonuid / anongid - use the configured UID and GID for the anonymous user Mounting NFS Exports To use NFS exports on the client, we need to mount the NFS export from the server. The mount command can be used for this Syntax for NFS exports is: mount -t nfs <SERVER-IP>:<SHARE-NAME> <MOUNT-POINT> Eg. mount -t nfs 192.168.6.42:/data/debian /mnt For this to work successfully on the client, the client needs to kernel NFS support and the portmap utility should be running. You can do thisby first ensuring the portmap is installed on your system (Debian package: portmap) and then starting portmap as: /etc/init.d/portmap restart . 2.7 Setting up Proxy Services: Introduction Squid proxy server is designed to cache web content as clients requests, it checks for presence of local copy of request, if found servers it directly. This not only saves bandwidth usage but accelerates web speed.

UNIT-II

2. 40

Paavai Institutions

Department of CSE

Duane Weasels of the National Laboratory for Applied Network Research (funded by the National Science Foundation) leads code development. Squid is free, licensed under the GNU Public License. Squid runs on nearly all flavors of Unix, including Linux. Internet object caching Internet object caching is a way to store requested Internet objects (i.e., data available via the HTTP, FTP, and gopher protocols) on a system closer to the requesting site than to the source. Web browsers can then use the local Squid cache as a proxy HTTP server, reducing access time as well as bandwidth consumption. Supported OS Linux FreeBSD NetBSD OpenBSD BSDI Mac OS/X OSF/Digital Unix/Tru64 IRIX SunOS/Solaris NeXTStep SCO Unix AIX HP-UX OS/2 System Requirements A web proxy cache requires a generous amount of memory and a fast disk I/O subsystem. Memory is needed to maintain lists of cached objects, and disks must be
UNIT-II 2. 41

Paavai Institutions

Department of CSE

capable of keeping up with a steady flood of random reads and writes. Typically processor speed is not a limiting factor, and a modest processor can make a satisfactory proxy server given the appropriate I/O and memory configuration. Downloading Squid You must download a source archive file of the form squid-x.y.z-src.tar.gz (eg, squid1.1.6-src.tar.gz) from the following sites, ftp://ftp.squid-cache.org/pub/ http://www.squid-cache.org/mirrors.html Patch programs are available from the GNU FTP site ftp://ftp.gnu.org/gnu/patch for upgrading to new versions. Compiling Squid To compile Squid, you will need an ANSI C compiler. Almost all modern Unix systems come with pre-installed compilers which work just fine. The old SunOS compilers do not have support for ANSI C, and the Sun compiler for Solaris is a product this must be purchased separately. If you are uncertain about your system's C compiler, The GNU C compiler is available at the GNU FTP site ftp://ftp.gnu.org/gnu/gcc In addition to gcc, you may also want or need to install the binutils package. You will need Perl installed on your system. Compiling Squid For Squid-1.0 and Squid-1.1 versions, you can just type make from the top-level directory after unpacking the source files. For example: % tar xzf squid-1.1.21-src.tar.gz % cd squid-1.1.21 % make For Squid-2 you must run the configure script yourself before running make: % tar xzf squid-2.0.RELEASE-src.tar.gz
UNIT-II 2. 42

Paavai Institutions
% cd squid-2.0.RELEASE % ./configure % make

Department of CSE

Configuring Squid The configure script can take numerous options. The most useful is --prefix to install it in a different directory. The default installation directory is /usr/local/squid/. To change the default, you could do: % cd squid-x.y.z % ./configure --prefix=/some/other/directory/squid To see all available options, type %. /configure --help If there is a mismatch between the header files and DNS library that Squid has found. There are a couple of things you can try. First, try adding -lbind to XTRA_LIBS in src/Makefile. If -lresolv is already there, remove it. If that doesn't seem to work, edit your arpa/inet.h file and comment out the following: #define inet_addr __inet_addr #define inet_aton __inet_aton #define inet_lnaof __inet_lnaof #define inet_makeaddr __inet_makeaddr #define inet_neta __inet_neta #define inet_netof __inet_netof #define inet_network __inet_network #define inet_net_ntop __inet_net_ntop #define inet_net_pton __inet_net_pton #define inet_ntoa __inet_ntoa #define inet_pton __inet_pton
UNIT-II 2. 43

Paavai Institutions
#define inet_ntop __inet_ntop #define inet_nsap_addr __inet_nsap_addr #define inet_nsap_ntoa __inet_nsap_ntoa

Department of CSE

Installing Squid After compiling Squid, you can install it with this simple command: % make install If you have enabled the ICMP features then you will also want to type % su #make install-pinger After installing, you will want to edit and customize the squid.conf file. By default, this file is located at /usr/local/squid/etc/squid.conf. Basic Configuration Some basic Configuration is to be done in Configuration file. By default this file is in the following path "usr/local/squid/etc/squid.conf" In the configuration file uncomment and edit the following lines. cache_dir Set cache_dir to an area that has a large amount of hard disk space in order to devote to caching. Cache_dir ufs /usr/local/squid/cache 100 16 256 is common. http_port Check http_port, 3128 is a default. http_access By default http_access is denied to all. You have to set ACL rules as per your requirements. This is important
UNIT-II 2. 44

Paavai Institutions

Department of CSE

because it prevents people from stealing your network resources cache_effective_user & cache_effective_ group Set cache_effective_user and cache_effective_ group to a user and group. This user should have the permission to read and write in the cache directory and in the log files. Configuring squid for proxy By default, squid is configured in proxy mode. In order to cache web traffic and to use the squid system as a proxy, you have to configure your browser, which needs at least two pieces of information: the proxy server's host name the port that the proxy server is accepting requests on Configuring squid for transparency Using squid transparently is a two part process. First that squid be configured properly to accept non-proxy requests (performed in the squid module) Second that web traffic gets redirected to the squid port (achieved in three ways namely policy based routing, Using smart switching or by setting squid Box as a gateway). Getting transparent caching to work requires the following steps: For some operating systems, you have to configure and build a version of Squid which can recognize the hijacked connections and discern the destination addresses. For Linux this seems to work automatically. Configuring squid for transparency For BSD-based systems, you probably have to configure squid with the --enable-ipftransparent option, and you have to configure squid as: httpd_accel_host virtual httpd_accel_port 80 httpd_accel_with_proxy on httpd_accel_uses_host_header on
UNIT-II 2. 45

Paavai Institutions

Department of CSE

Next you have to configure your cache host to accept the redirected packets - any IP address, on port 80 and deliver them to your cache application. This is typically done with IP filtering/forwarding features built into the kernel. In Linux they call this ipfilter (kernel 2.4.x), ipchains (2.2.x) or ipfwadm (2.0.x). Configuring squid for Reverse Proxy To run Squid as an accelerator, you probably want to listen on port 80. And you have to define the machine you are accelerating for. This is done in squid module, http_port 80 httpd_accel_host visolve.com httpd_accel_port 81 httpd_accel_single_host on httpd_accel_with_proxy on If you are using Squid as an accelerator for a virtual host system, then instead of a 'hostname' here you have to use the word virtual as: http_port 80 httpd_accel_host virtual httpd_accel_port 81 httpd_accel_with_proxy on httpd_accel_single_host off Verification of Config. file To verify your configuration file you can use the -k parse option % /usr/local/squid/sbin/squid -k parse If this outputs any errors then these are syntax errors or other fatal misconfigurations and needs to be Corrected before you continue. If it is silent and immediately gives back the command prompt then your squid.conf is syntactically correct and could be understood by Squid.

UNIT-II

2. 46

Paavai Institutions

Department of CSE

Starting Squid After you've finished editing the configuration file, you can start Squid for the first time. First, you must create the swap directories. Do this by running Squid with the -z option: /usr/local/squid/sbin/squid -z NOTE: If you run Squid as root then you may need to first create /usr/local/squid/var/logs and your cache_dir directories and assign ownership of these to the cache_effective_user configured in your squid.conf. Once that completes, you can start Squid and try it out. Probably the best thing to do is run it from your Terminal and watch the debugging output. Use this command: /usr/local/squid/sbin/squid -NCd1 If everything is working okay, then your console displays: "Ready to serve requests" If you want to run squid in the background, as a daemon process, just leave off all options: /usr/local/squid/sbin/squid Check the cache.log file in your logs directory. This file generates run time error messages that Squid generates. Checking the run status of Squid You can use the squidclient program: % squidclient http://www.netscape.com/ > test There are other command-line HTTP client programs available as well. Two that you may find useful are wget and echoping. Another way is to use Squid itself to see if it can signal a running Squid process: % squid -k check
UNIT-II 2. 47

Paavai Institutions

Department of CSE

And then check the shell's exit status variable. Also, check the log files, most importantly the access.log and cache.log files. 2.8 Setting up printer services 2.8.1 Using CUPS Configuring Printing Services Setting up your GNU/Linux system to print: Scope of this section Overview of printing on Linux Introduction to the CUPS printing system Installing and using CUPS About CUPS printer drivers Sharing your printer over the network Printing on Linux Linux & Unix has a long history of printing Most printing, traditionally, has been handled through the Berkley Line Printer Daemon (lpd) Over time, as printing technology advanced, Linux based printing system also became more diverse People designed modern printing system to correct major problems in lpd. LPRng, CUPS, OmniPrint are some examples of modern Linux printing systems All printing systems on Linux make use of the excellent PostScript system called GhostScript (www.ghostscript.org). Role of PostScript in Linux Printing Linux printing is more complicated than it seems Most printing systems today use a combination of multiple tools (postscript interpreters, filters, rasterisers etc) to process and print documents
UNIT-II 2. 48

Paavai Institutions

Department of CSE

The printing system converts PostScript into a raster format and then converts that into a printer Specific language to send commands to the printer Ghostscript is a PostScript interpreter that is most commonly used on Linux Implements an excellent PostScript engine that can take as inputs formats like JPEG, TIFF, PS & Text and output data in formats like X Windows output, raster formats and PDF. Also handles conversion of PS output for non-PS printers; can also be used a basic, spoolerless printing System . Printing Systems on Linux Berkley Line Printer Daemon (lpd) the oldest LPRng are compatible replacements to the Berkley lpd CUPS is a very new (comparitively) and modern printing system that we will use as a base for our discussion here Vendor-specific printing systems (like EPS from HP) OmniPrint - IBMs initiative to support a wide variety of printers using Ghostscript Postscript and Ghostscript Application specific printing engines (Eg. Gimp-Print) Introduction to CUPS (Common Unix Printing System) Was design as a common printing system for Linux, UNIX and compatible systems Designed on the IPP/1.1 (Internet Printing Protocol) standard of the IETF PWG (Printer Working Group) Robust and moders, CUPS can be extended to support more printers, devices and protocols Rich documentation and extensive feature set Available on most distributions as the default printing system CUPS Features IPP/1.1 Support Supports banner pages, authentication, print accounting and quota

UNIT-II

2. 49

Paavai Institutions

Department of CSE

Supports parallel, serial, usb, IPP and JetDirect-based printers as also printers shared through other Printing systems such as CUPS, lpd and Windows TLS (encryption) support Portable command set compatible with LPRng and LPD Excellent web-based interface for printer administration, configuration and management PPD-based drivers, rich API and imaging libraries Foomatic Printer database (from linuxprinting.org) has good support for CUPS CUPS Architecture The scheduler is a server application that handles HTTP requests - the HTTP server servers print

Requests as well as prin ter / CUPS administration requests Filters are what convert input into intermediate formats and finally to a printer specific format (Like text tops) Backbends are what allow CUPS to communicate to the actual printer - through a hardware port or the network Installing CUPS Using binary packages -CUPS is divided into multiple packages: cupsys , cupsys-bsd , cupsys-client
UNIT-II 2. 50

Paavai Institutions

Department of CSE

-It is also recommended to install the foomatic packagesfor additional CUPS printer drivers: cupsomatic-ppd,foomatic-db, foomatic-filters Using source code - Download source code from: www.cups.org -Use the supplied configure script to configure and then compile the package - Source only ships with the most basic drivers - you can download the rest from the linuxprinting.org web site If installed form binary, cups can be started as: /etc/init.d/cupsys start CUPS Configuration Files CUPS is configured through the /etc/cups/cupsd.conf config file The file format is very similar to the Apache configuration file format This file manages the following things: - Server Identity - Server Options - Network and Browsing Options - Security and Access Control Options CUPS will function just fine with the default server options Printer configuration is stored in the /etc/cups/printers.conf file - we will look at this file in detail printers.conf Sample <Printer myprinter> Info Laser Printer Location anokha DeviceURI parallel:/dev/lp0 State Idle Accepting Yes
UNIT-II 2. 51

Paavai Institutions
JobSheets none none PageLimit 0 KLimit 0 </Printer>

Department of CSE

CUPS Drivers CUPS drivers are stored in the /usr/share/cups/model/ directory This directory contains PPD (PostScript Printer Definition) files that define the specific features and details of a printer A new PPD downloaded from the Internet could be copied here and would be available for use inside CUPS after it is restarted. If the PPD is a foomatic-based PPD, then it will need the cupsomatic filter stored in the /usr/lib/cups/filter/ directory. Administering CUPS Cups can be administered very easily through its web based administration page By default on the localhost has permission to acess this page To configure CUPS, just type: http://localhost:631/ in your web browser to open the CUPS management interface Some screenshots are provided separately. Using CUPS Configured Printers To use a printer configured through CUPS, we can use the lpr command Syntax for the lpr command is: lpr P <destination> <filename> <filename> can be any text, PostScript or graphic file A destination is the name of the printer that you want to print to. If you want to print to the default Printer, then it is not necessary to give a destination; the default printer will be automatically selected. Sharing Printers
UNIT-II 2. 52

Paavai Institutions

Department of CSE

Sharing printers is very easy with CUPS As long as network browsing support is enabled correctly in the configuration files, the printers on other Machines will be detected automatically. This simplifies the mapping of printers in a network you just have to configure the printer in one machine and as long as all other machines support and enable the CUPS browse protocol, the configured printer will automatically show-up in the network nodes On the server where the printer is configured, you may wish to introduce a separate section to allow only specific machines to print to the attached printer.

2.9. QUESTION BANK


PART-A 1. Give steps for Configuring Linux System. 2. Define IMAP. Define POP. 3. POP3 VS IMAP 4. What are the two things used in Secure Socket Layer 5. What Problems occur with SMTP SERVER? 6. What is Samba? 7. What is SMB? 8. What is CIFS? 9. Give the most popular e-mail server 10. Mention some distributions of Linux. 11. What is the hardware requirements need for installing the LINUX? 12. What is process in LINUX? 13. Define Daemon. 14. Why is IP Masquerading HOT? 15. Can you distinguish on PID & PPID? 16. Give the Components of SMB. 17. What is a main objective of file sharing? 18. Give two File sharing services on Linux.
UNIT-II 2. 53

Paavai Institutions
19. Why we need SAMBA? 20. List any 3 practical applications of SAMBA. 21. How to Test the Samba from Windows? 22. How to manage the SAMBA users? 23. What is NFS? 24. What are things needs during sending the E-mail? 25. List the features of SMTP. 26. What is the Role of DNS in Mail Delivery? 27. How mail is delivered? 28. What are the Features of LINUX Printers? 29. Define CUPS. 30. List the Features of CUPS. 31. What is the use of Sharing Printers? 32. Define Proxy Server. 33. Define Squid? 34. List the salient features of Squid 35. What is Caching Proxy 36. Can you discuss the Squid supports?
Part -B 1. Explainconfiguringadditionalhardware suchas i. Soundcards ii. Displays&display cards iii. Networkcards iv. m odem s v. USBdrives vi. CDwriters 2. ExplainaboutUnderstanding the OSboot upprocess?
UNIT-II

Department of CSE

2. 54

Paavai Institutions
3. Explainperformingeveryday tasksusinggnu/Linux i. Accessing the Internet ii. Playingm usic iii. Editingdocum entsand spreadsheets iv. Sendingand receivingem ail v. Copy files fromdisksandover the network vi. Playinggam es vii. W ritingCDs 4. Explain:XW indowsystemconfigurationandutilities i. ii. Configure Xwindows Detect displaydevices

Department of CSE

5. Installing software fromsource code aswell asusingbinarypackages. 6. Explain:Settingupem ail servers i. usingpostfix (SM TPservices) ii. courier (IM AP&POP3services) iii. squirrelm ail (webm ail services) 7. Explain:Settingupweb serversusingapache (HTTPservices) 8. Explainandgive anexam ple programforphp (server-side scripting)? 9. W hat isperl (CGI support)? 10. ExplainaboutSettingup file services -- using sam baandNFS? 11. Settingupproxyservices -- using squid?
UNIT-II 2. 55

Paavai Institutions
12. Settingupprinter services - usingCUPSand foom atic?

Department of CSE

2.10. REFERENCE LINK 1. GNU Autoconf, Automake and Libtool, Gary V. Vaughan, Ben Elliston, Tom Tromey and Ian Lance Taylor. URL: http://sources.redhat.com/autobook/ 2. Open Source Development with CVS, Third Edition, Karl Fogel and Moshe Bar. URL: http://cvsbook.red-bean.com/ 3. http://www.youtube.com/watch?v=yAjHWdiNPEQ 4. http://www.youtube.com/channel/HC7lQftNxO5F0

UNIT-II

2. 56

You might also like