<--YBC
Technical Documents and Other Useful Information - Intro to Linux
Last Reviewed 03/07/06


Linux - Easy as Pie...Almost

SSHD | DHCPD | Apache Web Server

Abstract

This presentation will give an overview of some common network services offered on the Linux platform. Learn how to easily set up a simple Apache Web Server, DHCP service, SSH, and the Squid Proxy Server. Also discussed will be various command line tips and tricks to make life with Linux easier. Finally, learn about ways to make your Linux server secure. This presentation will be based on The Red Hat Linux 7.2 distribution.

Introduction

There are many reasons to choose the Linux operating system for use on a network. In Linux there is a software package to meet almost any need. Common Linux services include web, proxy and caching, domain name service, email, file and print servers, cross platform networking with SMB, routing, and multiple firewall utilities. There are also distributions of Linux made for single purposes such as routing, or firewalls. The many open source and commercial applications for desktop productivity have made Linux on the desktop possible.

Costs for implementation of a Linux solution may also be lower than working with an alternative operating system. Most, if not all of the software required for a successful Linux installation does not have a cost attached to it. One of the few costs that may arise is service and support contracts, should they be necessary.

The learning curve to the Linux operating system is something many people voice concern about. A computer networking background in nearly any other computer operating system can be helpful when learning Linux. A familiarity with MS DOS may help some people become comfortable with the command line interface of Linux. Knowledge of Novell Netware may assist in configuring menu-based options and editing text files in Linux. Even a general knowledge of TCP/IP and other networking protocols can help a person understand Linux concepts. Finally, the combination of command-line and graphical interface in Linux can complement each other in helping a new user navigate through and configure various programs.

The following pages will demonstrate the ease of setup of many Linux services. Most services can be configured by modifying a text file either at the command line or with a simple graphical text editor. Some of the more common Linux services also have graphical interfaces that make configuration a snap. Please see the additional information section at the end of this document, including common definitions, commands, and resources for further study.

Setting up a SSH Server (SSHD) [top]

Setting up a Secure Shell (SSH) server can allow users secure access to a server. SSH is often used as a secure replacement for the telnet protocol. End users will need a client SSH program to access the SSH server. The rpm (Red Hat Package Manager, an install file) to be installed is the openssh- 2.9p2-7.i386.rpm.

Installation

Log in as root. Find and download the stable version of openssh to the /tmp directory.

Once you have the rpm in your /tmp directory run it with this command:

rpm -ivh openssh-2.9p2-7.i386.rpm

The rpm starts to install and may display error messages about missing dependencies. This is where the fun starts. Before the main rpm can be installed, all of the dependencies listed need to be installed as well. However, they may need to be installed in a certain order. It is almost a hit and miss process to install all of the dependencies and the main rpm successfully.

There are 3 options at this point.

  1. Install each dependency until the install is successful.
  2. Use a configuration tool such as the Gnome RPM tool, or the KDE Package Manager. Both have the capability of listing the dependencies of files and also have the ability to install dependencies at the same time.
  3. Boot from a Linux Install CD and select the upgrade path. This will allow individual packages to be installed and the dependencies will be installed automatically.

Option 2 is usually the easiest option in terms of meeting dependencies and having the SSH package successfully install.

Configuration

The default configuration should work fine for allowing users with an account on the server (including root) to establish a secure encrypted connection.

The sshd_conf file can be found by default in the /etc/ssh/ directory if settings need to be changed in the future.

Starting the SSH Server

Typing this command as root:

/etc/init.d/sshd start or service sshd start

will start the SSH server.

Setting up a DHCP Server (DHCPD) [top]

This Dynamic Host Configuration Protocol (DHCP) server is capable of serving up any number of IPs and other network information to computers on a network. The DHCP server is also capable of retaining current network settings if it is reset or shut down.

Installation
Log in as root. Find and download the stable version of the DHCPD server to the /tmp directory. At the time of this writing, this rpm is dhcp-2.0pl5- 4.src.rpm.

Run the rpm with this command:

rpm -ivh dhcp-2.0pl5-4.src.rpm

Configuration
The DHCPD configuration file is installed to the /etc directory. There is a sample dhcpd.conf.sample file located in the /usr/share/doc/dhcp-2.0p15/ directory.

A duplicate of this file can be made, renamed, and copied to the /etc/ directory with this command:

cp /usr/share/doc/dhcp-2.0p15/dhcpd.conf.sample /etc/dhcpd.conf

(make sure there is a space between dhcpd.conf.sample and /etc/dhcpd.conf)

This new dhcpd.conf file can then be configured to meet the needs of a specific network.

The dhcpd.conf file is a text file that is made up of scopes. Each scope is composed of information about the various subnets that may be served in a network. Each subnet must have its own scope even if no IP addresses are assigned in that subnet.

Modifying a dhcpd.conf file

Open the dhcpd.conf file with a basic editing program such as pico or vi with the following command:

pico /etc/dhcpd.conf

Here is a sample dhcpd.conf file scope:

subnet 192.168.0.0 netmask 255.255.0.0 {

#default gateway option routers 192.168.0.1;
option subnet-mask 255.255.0.0;
option domain-name "myschool.k12.mo.us";
option domain-name-servers 192.168.0.1, 24.12.195.15
range 192.168.0.20 192.168.0.30;
default-lease-time 21600; max-lease-time 43200; }

The subnet and netmask are listed first followed by a "{" symbol. All of the scope comments go between the "{" and "}" symbols. Any option that is put in the scope will be served to the computers on the network who request it. If an option is left out, it will need to be manually configured on the client computers. The lease times are written in seconds.

Starting the DHCP server

While logged in as root run:

/etc/init.d/dhcpd or service dhcpd

This will display all the options to start or shut down the dhcpd server:

Usage: /etc/init.d/dhcpd {start|stop|restart|condrestart|status}

The same line can then be typed with the appropriate tag at the end. For example:

/etc/init.d/dhcpd start or service dhcpd start

Setting up an Apache Web Server (HTTPD) [top]

The Apache Web Server is a powerful and robust web server. Netcraft[1] reports that as of December 2001 Apache composed at least 63% of the total web server market share. Apache supports features such as modular, customizable architecture, virtual hosts, password protected pages, customized error messages, and detailed error logs.

Installation
Log in to your Linux server as root. Find and download the stable version of Apache to the /tmp directory. The stable version at this writing is apache-1.3.22-1.7.1.src.rpm.

Once you have the rpm in your /tmp directory run it with this command:

rpm -ivh apache-1.3.22-1.71.src.rpm

In the Red Hat distribution the most widely used apache components are installed in four main directories:

/var/www/html - html pages, and images

/etc/httpd/conf - configuration files

/etc/httpd/logs - log files

/etc/httpd/modules - modules to add extended functionality to Apache

Configuration
The main configuration file for Apache is the httpd.conf file. This file will not be in the /etc/httpd/conf folder upon initial installation. There will be a sample httpd.conf.rpm.new file instead. Make a copy of this file and rename the copy to httpd.conf with this command:

cp httpd.conf.rpm.new httpd.conf

There are two secondary legacy configuration files (access.conf, and srm.conf) that are included with the Apache rpm. These two files are no longer used. The text inside these files directs the user to use the httpd.conf file instead.

Open the httpd.conf file with a basic editing program such as pico or vi with the following command:

pico /etc/httpd/conf/httpd.conf

Modifying the httpd.conf file
There are at least 5 configuration lines to pay attention to.

DocumentRoot /var/www/html
The html directory holds web documents and images to be served.

ServerRoot /etc/httpd
Config, log files, and other common Apache components are located in this directory.

Listen
The IP address or the Apache Web Server, port, or a combination of both can be stored here. For example 17.254.0.91:80

ServerName server name
Place the name of your server here, such as myschool.k12.mo.us

ServerAdmin email address
Specifies the email address that will show on the error pages generated by the server.

Starting the Apache server
Typing this command as root:

/etc/init.d/httpd or service httpd

will display this list of choices to manage the Apache program:

Usage: httpd {start|stop|restart|reload|condrestart|status}

Therefore you can type in the same line and add the appropriate tag at the end. For example:

/etc/init.d/httpd start or service httpd start

will start the Apache server.

Logs

Logs for Apache can be configured in many ways. In the base Red Hat distribution, two log files are activated: error_log and access_log. The error_log monitors errors such as server reload messages, authentication violations, document access failures, and network errors. Here you can also see the various non-Linux viruses and worms trying to access your web server to no avail! The access_log can show you information about where users are coming from, what they are looking at, and how long they are at the web site. The Apache log files are located in the /etc/httpd/logs directory by default.

 

 


Quick Links:

Techdocs Home

Resume

Sites Maintained

Published Pages

Bookmarks

Security

Linux

Mandrake

Squid

Web Servers

Macintosh

Windows

 


Problems with this site? Contact the webmaster