The Linux CServer Setup for http, ftp and SQL Services


To build a Linux based intranet server, Linux 9.0 was loaded on my 3.0 GHz. P4, hereinafter "CServer". In addition to the basic operating system software, http, ftp and SQL service software is installed.

On my laptop, "vaio", I have a 600MHz P3 running Win2K. Other machines hooked into my LinkSys intranet router switch are all running Win2K, NT 4.0. and Linux.

Directories are installed on CServer to hold html files, as well as server side scripting programs and data files. These are called /var/www/html and /var/www/cgi-bin, respectively.

File transfer (like ftp) and remote terminal access (like telnet) to the files is available to any account owner through the use of the programs WinSCP.exe (a.k.a. scp.exe) and puTTY.exe, respectively. These are free programs and are available for download at http://cc.utulsa.edu . At the onset, a fixed IP address will be defined for CServer, e.g., 192.168.1.52. This will not require the services of DNS, DHCP, etc.

On CServer, using a terminal window, I ran "neat" (to configure the network) I set the value of 192.168.1.52 for the IP address and 255.255.255.0 for the Mask. I used 192.168.1.1 (the LinkSys Router) for Gateway and DHCP. I used 151.164.67.201 and 151.164.1.8 (both Southwestern Bell) for DNS, with DNS enabled.

To make sure that the appropriate services had been installed, type the following:

   rpm -qa | grep httpd
   rpm -qa | grep mysqld  (in /usr/libexec)
   rpm -qa | grep vsftpd

The file "httpd.conf" must be modified to change the value of ServerName to 192.168.1.50. This file must be copied to its proper location by typing the following in a terminal window (as root):

   mount /dev/fd0 /mnt                /* the file is on a floppy disk */
   cp /mnt/httpd.conf /etc/httpd/conf/httpd.conf
   cp /mnt/vsftpd.conf /etc/vsftpd/conf/vsftpd.conf
   cp /mnt/my.cnf /etc
   umount /mnt

To start the http daemon, we type:

   /etc/init.d/httpd start                /* to start the http daemon */
   chkconfig httpd on                     /* at every boot            */

To start the Structured Query Language (SQL) services, we type:

   service mysqld start
   chkconfig mysqld on

To start the network and keep it running, we type:

   /etc/init.d/network restart            /* to (re)start the network */
   chkconfig on         /* to cause the network to start at each boot */

I loaded all of the webpage files that I wanted to be served by typing:

   mount /dev/cdrom /mnt     /* all the html, htm, gif, jpg, au files */
   cp /mnt/TU_WEB/* /var/www/html
    /* all of the files loaded at http://www.johnletcher.com */
   cp /mnt/cgi-bin/*.c  /var/www/cgi-bin          /* the cgi programs */
   umount /mnt

A CGI program, cgi.exe is compiled on CServer by typing (as root):

   cd /var/www/cgi-bin
   cc cgi.c
   rn a.out cgi.exe
   chmod 755 cgi.exe

Finally, Start>System Settings>Security Level Configuration allowed us to choose

   X Customize
       trusted devices: eth0
       allow incoming: www, ftp, ssh, dhcp, telnet

Here the "Start" is the Red Hat icon on the extreme lower left of the Gnome screen of Linux.

By placing http://192.168.1.52/index.html or http://CServer/index.html in the URL Address Box of a browser, the services on CServer delivers (to the local machine) the index.html that had been placed in /var/www/html on CServer.

It is important to configure a 'stored session' in both scp.exe and putty.exe in which the Host Name is 192.168.1.52, Port 22, Protocol SSH, logging as desired, is specified.

putty.exe asks for a username and password. The user should give the username and password that would be used for login to CServer on the keyboard and screen hooked directly to CServer.

mySQL is directly available using putty.exe from any computer of the intranet. The options are specified in /etc/my.cnf. The database files are created in the directory /var/lib/mysql (or whatever is specified in my.cnf)

To add a system administrator to mySQL, we type (as root):

   mysqladmin -u root password letcher1

To start a session with mySQL, you type (as any user):

   mysql -u root -p

and enter the password, letcher1, as above. Following this, any valid SQL commands can be issued, such as:

   create database scios;
   use scios;
   create table emp (
     name varchar(30) not null,
     salary int not null )
   insert into emp values ('John H. Letcher', 1200);
   insert into emp values ('Martin T. Letcher', 2400);
   load data file infile "/tmp/names.txt" into table emp;
     /* names.txt is a tab delimeted file */
   show databases;
   show tables;
   select * from emp;
   quit;

Do not forget the ";" at the end of each command.

To access the CGI program cgi.exe from a form in an html page, the form statement is written thus:

    `form method="POST" action="http://192.168.1.52/cgi-bin/cgi.exe" >
or,
    `form method="POST" action="http://CServer/cgi-bin/cgi.exe" >

How this works is the subject of another document.