Tuesday, March 2, 2010

Red Hat Linux 9.0 Configurations ( testing purpose


INTRODUCTION. This article consists of a detailed, step-by-step, clean install and testing of Red HAT (RH) Linux 9.0.  The steps performed to install, configure, and test Samba, SWAT, host tables, telnet, FTP, Apache, a virtual intranet web server, MySQL, PHP, and Perl are described.  The text from the various configuration and test files is included for convenience and as examples.

HARDWARE DESCRIPTION.  This install of RH Linux was done on an older, in-house computer with an AMD 500 Mhz K6-2 processor, 256 MBytes of Memory, a Maxtor 30 GByte ATA/100 hard disk drive, and a Linksys LNE100TX Ethernet Adapter.  It is used to power a Samba file server for shared data for QuickBooks Pro  accounting, backups, and a web site, php, MySQL development and testing system.  It has all the power we really need for a file and intranet web server for Mom 'n Pop computer shop/office.  Linux is efficient and runs fast as a server on rather meager hardware.  Put the heavy computing horsepower and dollars into your client computers (user PCs) where it is needed. 

A description of the network is in our comprehensive article on How to Network Red Hat Linux and Microsoft Windows.

Red Hat Linux 9.0 Install Log 5/21/03

DOWNLOAD THE ISO FILES AND MAKE THE CDs

Downloaded the three CD Image ISO files and corresponding md5sum checksum files from linuxiso.org.

The md5sum files are html files. Copied the lines in all of the html files to individual lines in a single text file using wordpad.

Used md5summer on a Windows 2000 Pro computer to verify the three iso file checksums (CRCs).  md5summer is much easier to use than the Windows/dos-based md5sum I have used in the past.  It's free.

Burned the three iso files onto Memorex 700 MByte/80 Minute Music CD-R’s at 16X and verified the written data with a Memorex 52MAXX CD-RW drive and Nero 5.  Got 3 out 3 good CD's.  Labeled them and put them in CD envelops. The Memorex CD-RW drive is one of the fastest CD-RW drives currently on the market.  Many CD-RW drives cannot burn CDs reliably at 16X or even 8X.  Previously, with a slower drive and computer, I would burn Linux CD's at 4X and would still get a bad burn often enough that it was irritating.

PREPARE THE HARD DISK DRIVE

Started with a used Western Digital WD300BB, 7,200 RPM, ATA/100, 30 GByte hard disk drive. While downloading the RH iso files on another computer, took the drive down to bare metal (it had failed Windows XP on it) by writing zeros to the entire drive with the diagnostic utilities included in version 10.0 of Western Digital's Lifeguard Tools and then ran the extensive diagnostics.  No errors were reported.  Both of these operations take quite a bit of time, but they reduce the probability of hardware, boot track, and partition problems later on.  That is, the installation starts with a clean (and tested) slate.

Went into the motherboard CMOS Set-up and changed the boot sequence to boot to the CD-ROM drive.

INSTALL THE OPERATING SYSTEM
Booted to the first RH CD.
Pressed Enter to choose first item in the first menu: Install or Upgrade in the Graphical Mode.
The resulting menu states that it found the CD and prompts to test it or not. I opted not to as the CDs had already been tested. Skip
It checked the hardware and correctly identified the display adapter, etc.
Welcome Screen - Next
Language Selection - English (default) - Next
Keyboard Selection - U.S. English - Next
Mouse Configuration - Generic 2 Button Mouse (PS/2) - Next
Install Type - Custom - Next
Disk Partitioning Setup - Manually partition with Disk Druid - Next
Warning about data loss - Yes to continue initializing drive
Partitions
Highlighted Free under /dev/hda - has 28624 MBytes of Free space
Clicked the New button
Mount Point = /
File System Type = ext3 (default)
Allowable drives = default - just the one in the computer
Size MB = 28112 (aprox. 28624 - 512 for swap)
(RH says the swap partition should be twice the memory or 32 Mbytes, which ever is larger. 256 MByte Memory => 512 MBytes swap space.)
Fixed size
Force to primary partition
Rest (default) unchecked
OK
Warning about making a boot disk, etc. - Continue
Left 510 Free Space (close enough)
Highlighted it
Clicked the New button
Mount Point = blank
File System Type = SWAP
Allowable drives = default - just the one in the computer
Size MB = 1 (left at default)
Fill to maximum allowable size selected
Rest (default) unchecked - OK
hd1 = 28114, 510 to swap, and there is no more Free space - Next
Bootloader Installation - left everything default
Use Grub as the boot loader
Install Boot Loader record on /dev/hda1 Master Boot Record (MBR)
Default Boot Image: Red Hat Linux
Next
GRUB Password - left default = no GRUB password - Next
Network Configuration - left at default (DHCP and activate at boot) - its less overall work to change it after Lunx is up - Next
Firewall Configuration - selected No firewall (the broadband router does that function) - Next
Additional Language Support - English (USA) (already checked) - Next
Time Zone Selection - America/New York Eastern Time (default) - Next
Account Configuration - Entered and Confirmed a password for Root - Next
Authentication Configuration
Left all settings at defaults
Next
Package Group Selection -- Selected (rest unchecked)
X Windows System
GNOME Desktop Environment
Graphical Internet
Web Server - In details added all mysql and php options
Windows File Server
FTP Server
SQL Database Server - In details added mysql-server
Administration Tools
System Tools
Printing Support
Next
Strongly suggest not selecting Windows Networking (samba). It will be added later. One can always (hopefully) install/uninstall stuff later.
About to Install screen - Next
Installing Packages
Later - fed it CD #2 when prompted - OK
Fed it CD #3 - OK
Boot Diskett Creation
Skip boot disk creation = checked (I have one)
Monitor Configuration - Says my shop monitor is an unprobed monitor - Next
Customize Graphics Configuration - left it at default: True color (24-bit), 800X600, Graphical - Next
It ejected the CD
Exit
(If the screen goes bananas like mine did just wait and let the computer reboot.)
It rebooted.
Welcome - Forward
User Account - Created an account for myself - Forward
Date and Time - Did not check Enable network time protocol - Forward
Red Hat Network - Opted not to register - Forward
Additional CDs - Forward
Finish Setup - Forward
It rebooted.
Logged-in as root.
The RH Linux 9.0 is up.

NETWORK CONFIGURATION
Start, System settings, Network (or use the Start Here Window that pops-up right after an install if you haven't closed it--or start it again with the icon at the top, left of the screen.)
eth0 (Linux device for the Ethernet card) was present and highlighted. It was automatically detected and installed during the Linux proper install.
Create a virtual Ethernet device and IP address for a virtual web server...
Network Configuration, Device tab, New+, Ethernet Connection, Forward
The Ethernet Card (eth0) was highlighted. Forward. (Use the same card for everything. It's the only one in the computer. An additional network interface card, NIC, can be installed at this point by selecting Other Ethernet Card.)
Statically set IP addresses
Address: 192.168.123.2
Subnet Mask: 255.255.255.0
Default Gateway Address: 192.168.123.254 (this is the router's IP address)
Forward
Ethernet Device screen, Apply
Network Configuration, Device tab, ehto:1 is highlighted and it's checked and Inactive
Activate, etc.
Created hosts table... Network Configuration, Hosts tab (this builds the hosts table for name/IP address resolution)...

The only entry is 127.0.01 localhost.localdomain localhost... (127.0.0.1 is accessible only by the Linux host itself.

Network Configuration, Hosts, New
Address: 192.168.123.1
Host Name: linux.WORKGROUP.lan
Aliases: linux
(This is the LAN file server, Samba will grab the IP when installed.)
OK
Again... Network Configuration, Hosts, New
Address: 192.168.123.2
Hostname: local.duxcw.lan
Aliases: duxcw
(This is the virtual web server)
OK
(192.168.123.1, which is associated with eth0, is the LAN IP address for the Linux host computer/Samba and its web server. 192.168.123.2, which is associated with eth0:1, is for a virtual web server. All three parts of the host name, which are optional here, can be just about anything within reason you want them to be.)
Although prompted with suggestions that perhaps it might be good idea to restart Linux for LAN settings to take affect, I did not and it wasn't required.
Verified LAN TCP/IP connectivity
Opened a DOS Window in my Windows 2000 Pro computer and...
C:\>ping 192.168.123.1
C:\>ping 192.168.123.2
Got a response (didn't time out) form both IPs; the static IP addresses work on the LAN.

Red Hat Linux 9.0 Clean Install - The Whole Enchilada
Last updated: 5/21/03
USER ACCOUNTS
Entered User Accounts... Start, System Settings, Users and Groups, Add User...
Entered the following additional accounts, entered full names (first name, middle initial, last name), and gave them temporary passwords:
cbyard
jbyard
msql
pcguest
Except as noted below, left everything else default: Login shell /bin/bash, Create home directory = checked; Create a private group for the user = checked; Specify user ID manually = unchecked.
Made the full name of pcguest account, "Guest Account for LAN PC Users.
Changed the pcguest home directory from "pcguest" to "shared."
Clicking Properties and selecting Filter system users and groups to uncheck it, revels the users and groups created by the RH install.
SWAT (Samba Web Administration Tool) is not installed as part of the Red Hat 9.0 Windows Networking selection. Selecting samba-swat as part of the Red Hat 9.0 installation (Check Individual Package Selection in the Package Group Selection, Tree View, Applications, System - added samba-swat) does not produce a working SWAT. The samba-swat RPM on the third Red Hat CD does not fully install.
Also, in a previous install, I installed the Server Configuration Tools and attempted to install Samba with Start, System Settings, Server Settings, Samba Server and encountered all sorts of problems. It insisted on using mygroup as a workgroup name and only implemented one of the user accounts. When I went into /etc/samba and edited smb.conf and manually entered the workgroup name, it showed-up in Windows with both workgroup names (after refreshing, etc.). SWAT is by far the best tool I've seen for configuring Samba and I have looked at most them. Hand editing the configuration file with gedit and entering samba user accounts and passwords at the command line in the terminal is the second best way.
More details on ways to install Samba with screen shots are presented in How to Network Red Hat Linux and Microsoft Windows. However, that article is presently based on RH 7.3 and the following procedures differ somewhat. In particular, see the article for an example of how to set-up a broadband (cable/DSL) router to work with this network configuration of RH Linux 9.0. The router configuration was not changed.
In Nautilus, right-clicked a blank area in /root, made new folder/directory, and named it RPM. Opened RPM and made a new folder: samba.
Used Mozilla to download the latest samba RPM (includes SWAT)...
...to /root/RPM/samba
(This RPM, listed under Red Hat 8.0, works with Red Hat 9.0 and has/had the latest security fixes.)
In Nautilus, double-clicked the file, samba-2.2.8a-1.i386.rpm, to install it. You may have to wait some for a response. Simple enough.
With Nautilus, went into /ect/samba, highlighted smb.conf (the samba configuration file), Edit, Duplicate, to make a back-up copy.
Edited the smb.conf file... In Mozilla highlight the text below starting with [global] and ending with bad user, right-click, copy.
[global]
netbios name = LINUX
workgroup = WORKGROUP
server string = Samba Server
hosts allow = 192.168.123. 127.
guest account = pcguest
security = share
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
unix password sync = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *New*password* %n\n *Retype*new*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*
pam password change = yes
obey pam restrictions = yes
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
[shared]
comment = Shared read/write directory for all LAN users and guests
path = /home/shared
public = yes
only guest = yes
writable = yes
printable = no
[homes]
comment = Home directories
browseable = no
writable = yes
valid users = %S
create mode = 0664
directory mode = 0775
map to guest = bad user
Right-clicked smb.conf and Opened it with gedit, Edit, selected Select All to highlight all of the text in the smb.conf file, right-clicked on the highlighted text, and selected Paste to overwrite it with the above text, and saved the file.
With Nautilus, went into /etc/xinetd.d, highlighted swat (the SWAT configuration file), Edit, Duplicate, to make a back-up copy.
Right-click, Open With, gedit, to edit it, and changed disabled = yes to disabled = no. Remarked-out only_from = 127.0.0.1 by putting a # in front of it like so:
# only_from = 127.0.0.1
...so SWAT can be run from any PC on our LAN.
Saved swat.
Fired-up Services from the gnome panel, highlighted xinetd, Restart, and waited while xinetd finished restarting.
File, Refresh Services, and noted that swat was present and was checked. xinetd starts swat when it starts.
Checked and started smb, which is samba...
Tested swat ... In the Mozilla, entered...
localhost:901
... in the Address box, logged in as root and checked the remember values checkbox while doing so.
If you make a mistake logging-in, you may have to restart xinetd to get rid of the login error and to get the login prompt back.
SWAT is up.
Tested swat from my 2000 Pro computer... In the Windows Explorer, entered...
http://192.168.123.1:901/
... in the IE Address box. It can also be accessed with http://linux:901 once samba is up/host tables are installed (see below). Samba does not have to be running to use SWAT. SWAT modifies configuration files.
Used SWAT on from my Windows 2000 Pro computer to make the following samba accounts:
cbyard
jbyard
pcguest
root
It's like this... Click the PASSWORD icon. You see root already filled-in for the User Name. Enter the password twice, click Add New User, click Enable User, replace root with the next user name, enter the password twice, Add New User, Enable, etc. You will see SWAT respond to each of these actions right under the Change Password button. I leave learning the rest of SWAT as an "exercise for the student." You can use it from any PC on the network, along with the comments in the original samba configuration file you backed-up to modify the example Samba configuration, to suite you needs. Before using it, I would backup my working configuration files.
Test Samba.
Start, Network Servers and you should see WORKGROUP in Nautilus. Double-click WORKGROUP and you should see the PCs that are active on the LAN and properly configured. Double-click a PC to see its shared drives, etc. That may require that you login to the PC. Another way to bring-up WORKGROUP in Nautilus is to type smb: in the Location box.
Right-click a text file on one of the disc shares, Copy File, pick a blank spot on the gnome desktop, right-click, Paste Files, and you should see its icon on the gnome desktop.
Went to Windows 2000 Pro computer opened My Network Places, Entire Network, Microsoft Windows Network, Workgroup with the Windows Explorer and linux was in the right window pane. Double-clicked and became listed in the left pane. It works the same way the first time for Comptuers Near Me. From Windows Me, the process is... Restart, Windows Explorer, My Network Places, Entire Network, Workgroup, and you should see linux. My Windows 2000 Pro computer did not require restarting. If this is the first login you will be prompted for your Samba Account/Password. You should not have to login in again after that.
Samba is up and the Linux host computer is networked with the other computers on the LAN. And that's cool!
HOST TABLES
Copied /etc/host to /home/shared
The file was made when the network was set-up and looks like this:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain linux
192.168.123.2 local.duxcw.lan duxcw
192.168.123.1 linux.WORKGROUP.lan linux
I edited it (the one in /etc/shared) to look like this (which you can further edit and use directly):
127.0.0.1 localhost
192.168.123.2 local.duxcw.lan duxcw
192.168.123.1 linux.WORKGROUP.lan linux
... for name to IP resolution--so you can browse to local.duxcw.lan entering duxcw in the browser instead of http://192.168.123.2. This file should be copied with the same name (and no extension; e.g., .txt) to C:\windows\ on the Windows 9x/Me computers and C:\WINNT\system32\drivers\etc\ on Windows NT, 2000, and XP computers.
The host tables have been installed.
TELNET
With Nautilus, went into /etc/xinetd.d, highlighted telnet (the telnet configuration file), Edit, Duplicate, to make a back-up copy.
Right-click, Open With, gedit, to edit it, and changed disabled = yes to disabled = no. Saved and closed the file.
In the Service Configuration, checked telnet Restarted xinetd.
If restarting xinetd produces errors, it's probably because you still have the telnet configuration file open in gedit.
At a Windows computer opened a DOS window and typed...
C:\>telnet 192.168.123.1
telnet linux will also work if samba is up or if host tables are installed on the client PCs.
Logged in the resulting Window.
For some reason (probably the tty security configuration), it would not let me login as root, but the other accounts do work. So, execute su (super user = root) after logging in if you need root power. Or, see how to allow root for telnet.
Closed the connection with the logoff command.
telnet is up.
FTP (vsftp)
In the Service Configuration checked and Started vsftp (very secure ftp daemon)
Opened a DOS Window in one of the Windows computers and typed...
C:\>ftp linux
It will not permit a login from root.
Typed bye to exit ftp.
FTP is up.
APACHE WEB SERVER
My virtual server is a local prototype for this web site/domain (duxcw.com). To make it look similar to the way it looks on my hosting service, but without the complicated directory structure, the directory is directly off my home directory on the linux computer. I may move it later and that isn't hard to do once one understands some of the Apache configuration file (httpd.conf) basics.
Made a directory at /home/lbyard/duxcw for the virtual server,
Made a simple web page for testing with qedit (copy and paste as before), like so...

< head>

< title>Test
< /head>
< body>
< p>This is the Test WEB Page on the virtual server

< /body>
< /html>
And saved it as...
/home/lbyard/duxcw/index.html
To avoid any permission problems during the Apache setup and testing, noted and changed the permissions on the file, and the duxcw, lbyard, and home directories to 777. The group and owner for lbyard, duxcw, and, and index.html should be lbyard, in this case. (On my LAN it makes no real difference--everyone is family).
Start Apache... Service Configuration, check and save httpd (that is Apache, the http daemon), File, Save Changes, Start, wait, OK
Test 192.168.123.1 and 192.168.123.2 on the LAN with a browser in Windows, e.g.
http://192.168.123.2, which should result in:
"Test Page
This page is used to test the proper operation of the Apache Web server..."
(We do not see our virtual server test page yet, because the virtual server isn't configured.)
Apache is listening and responding to the LAN IP addresses.
Apache is up on the LAN.
< Previous | Contents | Top | Next - Apache Web Server >
VIRTUAL INTRANET SERVER
Duplicated and then edited /etc/httpd/conf/httpd.conf.
Pasted the following at the very end of the file (below #):

ServerName local.duxcw.lan
DocumentRoot /home/lbyard/duxcw/
ErrorLog /home/lbyard/error_log
DirectoryIndex index.html
ScriptAlias /cgi-bin/ /home/lbyard/duxcw/cgi-bin/
< Directory /home/lbyard/duxcw/cgi-bin/>
AllowOverride All
Order allow,deny
Allow from all
Options +ExecCGI
AddHandler cgi-script .cgi .pl
< /Directory>
< /VirtualHost>
Yes, /home/lbyard/duxcw/cgi-bin/ does not have quotes around it, .cgi and .pl do have periods in front of them, and it's cgi-script, not cgi-scripts. Copy this one, and modify it for you particular configuration; it works. Better yet, do it my way first, know that it works, and then change things a step at a time.
If security is a concern, the home directories with virtual servers, any directories below it, and the public diirectory (e.g., duxdcw, which in more sophisticated directory structures is often public_html) should be set to at 755 (read and execute bits set for all and owner has write privileges).
If you want another virtual host, simply copy the whole thing you pasted at the end of httpd.conf, including the tags, paste it immediately following it, and edit.
Saved and closed the file.
Restarted httpd.
Browsed to http://192.168.123.2 from a Windows computer.
You should see the test page we made for the virtual web host. If so...
The virtual intranet web server is up.
MYSQL
(version 3.23.54a)
Set the password for the MySQL root user.
/usr/bin/mysqladmin -u root password 'new-password’
(You won’t be able to create databases with phpMyAdmin, etc. if you don’t do this.)
Opened a terminal window and entered the following at the prompt.
mysql -uroot -p
Entered the above password when prompted.
Went to /etc, duplicated the MySQL configuration file my.cnf file.
Added the following line the [mysqld] section:
skip-innodb
If this isn't done and you are not using innodb, mysql will repeatedly add entries to its log suggesting that it be done. If you can't edit the file, the MySQL server may already be running. Stop it in the Service Configuration.
Started the MYSQL server in the Service Configuration.
Opened a terminal window and entered the following at the prompt.
mysql -uroot -p
Entered the above password when prompted.
MySQL is up.
MySQL Notes:
If you want to play with/optimize the MySQL variable, etc. settings, example my.cnf files (my-small-cnf, my-medium-cnf, my-large-cnf, and my-huge-cnf) are located in /usr/share/doc/mysql-server-3.23.54a.
To import the database dumped into a text file as a collection of SQL queries (MySQL Dump command, etc.) into an empty mysql database, do the following in the Terminal :
mysql -uUsername -p dbname < dbname.sql
Or use a MySQL utility program to do it, such as those described in Open Source/Free Graphical Management Utilities for the MySQL Database Server.
PHP
Duplicated php.ini in /etc.
Used gedit to change post_max_size and upload_max_filesize to 200M. You may want to set different values or leave the defaults to suite your requirements.
Here's my test page:

< head>
< title>PHP Test
< /head>
< body>
< ?php echo "This is a PHP script and, by the way, PHP is UP!"; ?>
< /body>
< /html>
Copied and pasted the above into a file named /home/lbyard/duxcw/test.php, changed the group and owner to lbyard, and assigned 777 permissions.
Went to a browser window on the Windows Me computer and entered the following in the Address box:
http://192.168.123.2/test.php
... and got:
This is a PHP script and, by the way, PHP is UP!
Perl
Made the following directory with owner lbyard, group lbyard, and 755 permissions:
/home/lbyard/duxcw/cgi-bin
(You could configure Apache to put the cgi-bin directory directly off lbyard or elsewhere for greater security.)
Made (copy and paste) the following test file with gedit and save it in your cgi-bin (mine is /home/lbyard/duxcw/cgi-bin/).
Changed the permissions to 777 (It won't work if it can't at least be read and executed). The owner of the file must be the same as the owner of the directory it is in. I made owner and group lbyard. Named it test.pl
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "";
print "Perl/CGI Test";
print "";
print "Perl and CGI scripts work!";
print "";
(Perl is very fussy about text files. If this doesn't work, paste it into a pure text editor and save it again. Always use the ftp ASCII transfer mode when moving Perl files across the Internet, etc.)
Tested the script at the prompt as root in the terminal window on Linex with...
cd /home/lbyard/duxcw/cgi-bin
/usr/bin/perl /home/ test.pl
It produced this:
Perl and CGI scripts work!
Tested it from a browser on the Windows Me computer typing the following in the Address box:
That produced this:
Perl and CGI scripts work!
Perl is up!
If you see the actual code, it didn't work. Have fun (start here: http://httpd.apache.org/docs/). I certainly did for longer than I will admit in previous attempts (one of the reasons I wrote the RH 7.3 install log). I can absolutely assure you that what you see above is the actual configuration and text.pl file that works on my server--regardless of what else you may see on the Internet. The rest of the httpd.conf was as it was when the install was done (virgin).
Shutdown Linux
Power-up
Logged-in as lbyard
Believe me and what you read about routinely logging in as root to use Linux. It is easier than most think to wipe-out a working Linux install with one user error. Login in as root only when it is absolutely necessary.
(Don't forget to go back into the CMOS Setup and change the boot sequence to floppy, hard disk, etc.)
For more "fun" and to "properly" complete the installation see https://rhn.redhat.com/errata/rh9-errata.html.
Larry