In part 1 of this article we
installed CentOS 5.1 on a small desktop machine and got it running with
remote desktop access using VNC. Part 2 of this article will examine
how to setup standard server services such as a web server, Email
servers and file sharing.
Part 2: Setup of Standard Services
Web Service

The Web Service is the standard service that supports HTTP
requests from client machines on tcp/ip port 80. This is the service
that lets you use your web browser to look at files on the server. All
you need to do to active the service is click on System->Administration->Server
Settings->Services.
Fig.
1 Enabling the Web Service (httpd)
While you are certainly free to create your own webpages with pictures
of your pets, etc., I will be setting up this web service to download
files to the local clients using a web browser. Nothing fancy, but a
simple and quick way to get various files that always seem to be needed
whenever a new machine is setup.
The web service serves files from the /var/www/html directory. In order
to get a listing of the available files, you need an HTML file
(index.html) that displays the files and directories on the server.
Take a look as this sample file:
You will need to manually edit the file (as root) to
include the files and directories that reside on your server in the
/var/www/html directory, the sample file has the directories on my
server. Once you've done that, you can use any web browser to access
the files and download them.
Fig.
2 Browsing files on the Server
Fig.
3 The files in the "codecs" directory
Fig.
4 Just click and download!
Full blown web page creation is beyond the scope of this
tutorial. However, if you are looking for a simple "what you see is
what you get" HTML editor program, then I recommend Seamonkey.
Email Services

Most home based users will not have any Email services activated. You
just use your POP3 Email client to get Email from your service provider
and send Email to their SMTP server.
However, some of you might be interested in getting your Email off of
the ISP's server and onto your own local server. This let's you avoid
any storage fees that the ISP might apply to your account, since you
can delete the Email on the ISP's server after you've copied it over to
the local server. You can also send and receive internal Emails on your
LAN. No more walking upstairs to tell your wife things, just send her
an Email on her internal account! :D
There are three pieces to the "get Email from ISP and server it here"
puzzle:
- A Mail Transport Agent (MTA) service
- A POP3 service
- Fetchmail
The default Mail Transport Agent (MTA) for CentOS is the vernerable
"sendmail". You can install postfix/procmail if you desire a more
modern MTA, but sendmail is all configured as the default MTA, so you
only need to activate it.
The MTA service is used to deliver Email to the individual users on the
local server, so you will need an account for each LAN user
administered on the server.
Fig.
5 Activating sendmail MTA
The MTA handle delivery of Email to user mailboxes on the
server. Each mailbox is a file in /var/spool/mail with the same name as
the user. So, for example, user "fred" has his Email in the file
/var/spool/mail/fred. We now need to activate a POP3 service so "fred"
can read his Email on the server with a generic Email client program.
Fig.
6 Activating dovecot IMAP and POP3 Service
OK, we just have one more step to go and "fred" will be able
to read his Email from the ISP's server on the local server. The
program /usr/bin/fetchmail does this last step, transferring Email from
Fred's ISP to the local server. Fetchmail keeps track of which messages
it's downloaded, can delete the messages off the ISP's server, etc. It
logs into the ISP, gets any new messages, hands those messages off to
the MTA for delivery after determining the proper destination mailbox
on the server.
There are two ways to run fetchmail: as individual users and system
wide as a daemon.
Since we are setting up a server, we would like to have fetchmail be
"system wise" on the server and this requires the creation of two files
on the server (CentOS did feel like making fetchmail a "normal" service
for some reason):
/etc/init.d/fetchmail
/root/.fetchmailrc
Here is a sample /etc/init.d/fetchmail
script that lets the system control the fetchmail service. It looks
very much like any of the other scripts in /etc/init.d. You can adjust
the polling interval with the "TIME" variable. Time is measured in
seconds. To register the fetchmail service with the system, open a
console window (as root) and type:
chkconfig
--add fetchmail
You will now be able to activate the fetchmail service
with the GUI tools.
Fig
7. Activating the Fetchmail Service
The file /root.fetchmailrc has a single line for each
Email account that fetchmail is supposed to poll. Each line looks like
this:
poll mail.isp.com
protocol pop3 user "user" there with password "***" is fred here
The portion "poll mail.isp.com"
tells fetchmail to connect with the mail server at "isp.com". You would
naturally change this for the mail server at your ISP.
Fetchmail supports multiple protocols, POP3 is the most widely used,
hence the portion of the line with "protocol
pop3".
The next section, "user "user" there
with password "***" is the user ID and password for the account
AT
THE ISP. It is NOT
the local user ID and password! You would naturally change "user" and
"***" to the ID and password of the desired ISP account.
The final portion, "is fred here"
indicates the local ID of the user. Thus, the Email is transfered to
/var/spool/mail/fred on our local server.
Fetchmail has a large number of options, such as SSL to securely
transfer the Email, whether to keep or delete the Email messages at the
ISP account, etc. It's a good idea to do a "man fetchmail" and read
through the options and google for online examples. I use the "ssl keep" options on my server.
File Sharing
-
SMB (aka Samba, aka CIFS)
SMB stands for Server
Message Block and is used to share files over a LAN with Microsoft
Windows. It is a type of NAS (Network Attached Storage) in as far as it
provides a filesystem over the LAN.
NFS stands for Network File
System. It's been the standard NAS for Unix style operating system for
man decades.
SFTP offers secure file
transfers using the SSH service. While much slower that other file
transfer protocols (as much as 70% less), it securely encrypts the data
being transfered.
FTP offers insecure file
transfers, but does so over the LAN at speeds that are much closer to
the "wire speed" of the network.