|
Tutorial: Set Up a Linux Internet Server Part 1 |
|
By Paul Dunne
See that old 25MHz, 386-based PC? Yes, that's right, the one gathering dust over in the corner of the office. It can't run Windows 95, but it still boots -- surely it's not quite ripe for use as that proverbial boat anchor? In this series of articles, I will show how such a modest box can do sterling work on your network -- providing Internet access, file and print services, and even firewall protection -- simply by add ing Linux. So to start with, lets get Linux up and running and connected to the Net. It will be presumed throughout that our attempt is very much a budget one: a simple dialup account to the nearest ISP, a no-name modem, and so forth.Questions regarding this article should be directed to the author at paul@tiny1.demon.co.uk Other installments of this Linux Internet server tutorial series include: IntroductionA previous article in UnixWorld Online has already covered Linux background issues, and contain s plenty of useful resources. If you're not sure quite what Linux is, it might be helpful to take a look there first. InstallationInstalling Linux is straightforward nowadays -- just pick a distribution and run the install program. Before we go anywhere, though, we must check that we CAN install Linux. Hardware requirementsLinux is modest in its hardware requirements when compared to those of most other modern OSes. Any Intel 386 or later CPU will do. In a pinch we can get by with 40 megabytes or so of hard disk space. Though it will run in only two megabytes of memory, the minimum practical RAM required is four megabytes. Even that can be a tight squeeze for some distribution's installation programs, including Slackware's, so eight megabytes is the practical base line. Linux supports a very wide range of PC hardware, so most PCs will work without further ado. To find out if a particular piece of hardware is supported, see the Linux Hardware HOWTO . Installation can be via floppy diskettes, from a CDROM, or by NFS over the local network or the Internet. My choice of Linux distribution (Slackware) explainedIn this article, I will be using the Slackware distribution for my examples. Why Slackware? It was for long the ``standard'' distribution. It remains the easiest to adjust to one's needs, as long as one is not afraid to ``get one's hands dirty,'' so to speak. It is also in my experience the quickest to install. Slackware installation routineThe Slackware setup program is simple and takes the user through all the stages of installation and even does some basic configuration. Rather than simply describe what the install program does, step by step, which would be superfluous, I will concentrate on explaining what is going on ``behind the scenes.'' However, first let's back up a step and make boot and root
diskettes. You will most
probably be doing this from DOS, with
the
Secondly, reboot the computer with the boot diskette in the ``A:'' drive. If all goes well, Slackware will present you with a prompt to enter additional parameters. Usually, you can just ignore this and continue by pressing Enter. Sometimes, however, you may need to pass parameters to the Linux kernel to tell it what I/O address your CD-ROM drive uses, for example. A full explanation of all the options is available from the Linux BootPrompt HOWTO . Your computer will then be booted into the Linux operating system, and when the boot process is complete, you will be prompted to replace the boot diskette with the root diskette. The root diskette contains an image of a basic root file system, a minimal system from which the rest of the Linux distribution can be installed. Once this file system is mounted, you can login as root, and type ``setup'' on the command line to start installing the system. To start with, the
A more sophisticated procedure, particularly if the PC has two
or more hard drives, is to create several more partitions. A good
basic split is five partitions:
Once the partitions have been set up, you select the installation media and the destination media. Most commonly, these will be respectively the CD-ROM drive and the hard disk that you have just prepared. But, you do have the option of installing from floppy disks, or over a network using NFS. The installation process formats your chosen partition(s), using the Ext2 file system, by default. You have no good reason to chose any other file system. Formatting may be quick, or complete (that is, including checking for bad blocks); it is advisable to chose the latter. The time this takes will var y according to the size of hard disk, of course; it is somewhat slower than the DOS format program, but then it is serving a rather more sophisticated file system. With the hard disk ready, we may choose which of the sets of applications to install. Some are mandatory, others are recommended, and others still are purely optional extras. For our purposes, the ``A'' series should be installed in toto, together with the ``N'' series. A minimal installation will fit comfortably on a 40 megabyte partition; everything takes about 150 megabytes; however, you will want to allow considerably more than that as working space. ConfigurationOnce Linux is installed, the Slackware setup program does several of the simpler configuration tasks. Here's the low-down on what it does. Local keyboard mapFor anyone save U.S. readers, a keymap other than the default
U.S. keymap is preferable. An alternative keyboard map file is
loaded by the
loadkeys /usr/lib/kbd/keytables/uk.map By the way, the Linux keyboard is fully remappable. The
MouseLinux supports most sorts of mouse.
Although we won't be running X on this box, a mouse is still
useful, as Linux supports mouse-assisted cut-and-paste between
virtual text consoles. The
ModemModem configuration is usually a matter of making an optional
link from the actual device file to
Host NameGive the machine a name. You'll probably have local naming conventions to follow, so that the new machine fits in with the existing network. Basic Network ConfigurationThere is a wealth of information on Linux networking, in a variety of sources, including The Linux Journal and The Linux Documentation Project. EthernetConfiguring the Ethernet link is simple, and is done for us by the setup program. Here, I will run through what that program does ``"behind the scenes.'' There are two scripts,
HOSTNAME=`hostname` This sets the host name by running
/bin/hostname `cat /etc/HOSTNAME` Next, we configure a special device called ``lo'', short for ``loopback''. The loopback device is like a dummy network, in which the machine talks to itself. It has the standard address of 127.0.0.1, and is always required. We use: /sbin/ifconfig lo 127.0.0.1 /sbin/route add -net 127.0.0.0 Now an optional part, that can be useful if the internet connection is a dial-up one, and is thus intermittent. We don't want the Internet host name to be unusable when the link is down; the special Linux ``dummy'' interface is designed specifically with this in mind. /sbin/ifconfig dummy ourhost /sbin/route add ourhost Rather then typing in these values over and over, we set them once here. IPADDR="192.168.1.1" # REPLACE with YOUR IP address! NETMASK="255.255.255.0" # REPLACE with YOUR netmask! NETWORK="192.168.1.0" # REPLACE with YOUR network address! BROADCAST="192.168.1.255" # REPLACE with YOUR broadcast address, if you # have one. If not, leave blank and edit below. Set up the Ethernet device:
/sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
Add a route to the local network to the routing table:
/sbin/route add ${NETWORK}
Finished!
The other networking configuration file,
Name ServiceSeveral files in
The
|
Print This Page Send as e-mail |
Best of the Web
Data deduplication: Declawing the clones
Data deduplication is emerging as a critically important new arrow in the storage administrator's quiver to answer hard questions about the increasing problem in storage growth costs.
Compression, Encryption, Deduplication, and Replication: Strange Bedfellows
One of the great ironies of storage technology is the inverse relationship between efficiency and security: Adding performance or reducing storage requirements almost always results in reducing the confidentiality, integrity, or availability of a system.
WAN Optimization Whitelists and Blacklists
Optimization is a fantastic way of saving money and creating really happy customers at the same time, but it doesn't work flawlessly for all applications.
WAN Optimization as a Managed Service: It's Not About the Cost
This insight examines how organizations outsourcing their WAN optimization initiatives to a third-party go about achieving their goals for application performance, reducing operational costs, and streamlining enterprise infrastructure.






