Red Hat Linux 6.0 or Greater Recommended

only for RuBoard - do not distribute or recompile

Red Hat Linux 6.0 or Greater Recommended

The version of Red Hat 6.x that you can download over the Internet contains only GNU GPL-licensed software, or software that can be freely distributed. All the software in this project falls in this category. Even the Linux version of MySQL is freely distributed, requiring a modest licensing payment for its use under a limited set of circumstances. I assume the unofficial Red Hat 6.1 release as the base platform. Unofficial means it was not manufactured by Red Hat and is not supported by them.

NOTE

The company doing MySQL recently formed a strategic alliance with VA Linux. The MySQL versions 3.23 and greater have been released under the GPL license. As of this writing, MySQL version 3.23 is in Alpha test and is not yet ready for full deployment. I fully expect it will be stable and suitable for production by the time you read this book.


The latest version of PHP is most easily customized on Red Hat Linux 6.0 or later. Because of this, this book uses Red Hat Linux 6.1. I initially installed IMP on Red Hat Linux version 6.0. The two versions have very few differences as far as this project is concerned .

Whenever Red Hat Linux displays the login prompt, it tells you which version of software and which version of kernel you have. If your system starts in graphical mode, you are running the X Window System by default. In this case, you don't see the information displayed by the login prompt.

To see the information displayed by the login prompt, switch to a console mode. To do this, press the Ctrl, Alt, and F1 keys simultaneously .

NOTE

This will be designated using the plus (+) sign. For example: Ctrl+Alt+F1 indicates to press these keys simultaneously.


This gives you a login screen if you boot into the X Window System by default.

If you run startx to run the X Window System, this will put you into the status screen for the X Window System. If that is the case, you will see several messages that the X Window System outputs because it can or can't find things it would like to have. In this case, you need to press Alt+F2. This will give you a login screen.

You should see something like this:

 Red Hat Linux release 6.1 (Cartman) Kernel 2.2.12-20 on an i686 winbook login: 

NOTE

The keystrokes Ctrl+Alt+F1 through Ctrl+Alt+F4 take you from the X Window System to one of four nongraphical virtual console screens. The first console screen accessed with F1 is where all kernel and debugging messages are printed. To return to the X Window System, press Alt+F7.


This shows we are running Red Hat Linux version 6.1. Let's walk through how this information was generated.

The information displayed comes from the /etc/issue file. The /etc/rc.d/rc.local file creates this file during the boot process. The release information comes from the /etc/redhat-release file, which the Red Hat installation program placed. The kernel information comes from running the uname program with the -r option.

If you don't have Red Hat version 6.0 or greater, many specific details I talk about will not be correct. For that reason, I recommend that you get Red Hat 6.1 and install it. After a successful install, you can try your hand on another platform.

How to Check for the Presence of an Installed Package

To make IMP work, you will need certain software packages. Determining which software packages are installed used to be difficult under the Linux operating system.

Fortunately, the programmers at Red Hat provide a utility to help you manage this: the RPM Package Manager. Every file produced by the package manager ends in .rpm. This program provides an easy way for you to determine what software is on your computer. To execute the package manager program from a command line, enter rpm.

NOTE

It is best to use this program from a command line. Under the Gnome GUI, which is one of the default installs for the Red Hat X Window System environment, a utility called GnomeRPM is found. You can use this utility for graphically determining whether the packages are installed. You can also use it to install packages. It does not give you as much control over the information you obtain. You also cannot manipulate it in a bash script file. You can run the rpm utility from a script.


The rpm utility uses a local database to manage packages. This database enables you to find out what package versions are installed and keeps track of dependencies between packages. It does not enable you to install a package that requires another package. It also does not enable you to remove a package that is required by another package currently installed in your system.

To find out what program is installed on a system, use the rpm's query command. You can query for all packages or for some packages. I find the query for all packages very useful when I almost know the name of what I am looking for.

For example, suppose I am looking for all the packages I have installed for XFree86, but I'm not sure of the names of each of the packages. I can execute rpm and pipe its output to the grep program. For this example, I ran an xterm program and entered the command

rpm “qa grep “I xf

Output

 [root@mail maxfield]# rpm -qa  grep -i xf 

Output

 XFree86-3.3.5-3 XFree86-libs-3.3.5-3 XFree86-xfs-3.3.5-3 XFree86-75dpi-fonts-3.3.5-3 XFree86-SVGA-3.3.5-3 XFree86-devel-3.3.5-3 XFree86-doc-3.3.5-3 xfm-1.3.2-13 [root@mail maxfield]# 

NOTE

The grep program is an acronym for the General Regular Expression Parser. It searches for text strings in text streams piped to it or in files.


As you can see from the output of rpm, it found XFree86 version 3.3.5, matching libraries, fonts, documents, and the super vga driver. It also found the xfm program. Running a quick man xfm shows this is the X file and application manager, so we can safely ignore it.

[root@mail maxfield]# man xfm

Output

 XFM(1)                                                     XFM(1) NAME        xfm - X file and applications manager SYNOPSIS        xfm [options ...] DESCRIPTION        Xfm  is  a file and applications manager program for the X        window system.  It provides virtually all of the  features... 

To query for a single package, you generally ask for the package without the version number attached. Here is a query for XFree86:

 [root@mail maxfield]# rpm -q XFree86 XFree86-3.3.5-3  [root@mail maxfield]# 

The rpm package also enables you to remove a package, install a package, or upgrade a package. To illustrate this, I queried secure shell, looked for all secure shell packages on my system, and then removed and reinstalled the secure shell clients on my system. I also upgraded the ssh clients package in this example.

 [root@mail rpms]# rpm -q ssh ssh-1.2.27-5us  [root@mail rpms]# rpm -qa  grep ssh ssh-clients-1.2.27-5us ssh-1.2.27-5us ssh-server-1.2.27-5us ssh-extras-1.2.27-5us  [root@mail rpms]# rpm -q ssh-clients ssh-clients-1.2.27-5us  [root@mail rpms]# rpm -e ssh-clients  [root@mail rpms]# rpm -i ssh-clients-1.2.27-5us.i386.rpm  [root@mail rpms]# rpm -U ssh-clients-1.2.27-5us.i386.rpm  [root@mail rpms]# 

Note that not all software installed on your Linux system must come from rpm packages. Many open -source developers provide tarballs for you to use for installation. These tarballs generally don't update the rpm database and must be installed differently.

GEEK SPEAK: A tarball refers to the result of the command tar cvf, which wraps up an entire directory and its subdirectories in one huge file. It also preserves the permissions of all the files.

Tar is often used to archive data onto tape or another storage device. Hence the name, taken from Tape ARchiver.

The process of extracting files from a tarball is often called untarring.

To illustrate using a tar file, consider the php tarball. This tarball has been compressed using the GNU Zip program, gzip.

Two ways are available to unzip and untar this tarball. The first way is to run gunzip. To do this, execute the following:

[root@mail /root]#gunzip php-3.0.16.tar.gz

This leaves the tarball in the current directory without the .gz ending. Run an ls command. You will see the following:

 [root@mail /root]#ls php* php-3.0.14.tar 

After this, run the untar command. An interesting feature of the GNU tar program is a command-line option that allows you to unzip and untar in one step.

NOTE

Only the GNU version of tar allows you to use the z option while untarring a file. Other versions of tar, such as the one on Solaris, lack this feature. For those versions, you must first unzip the file before untarring.


To use this option, enter:[root@mail /root]#tar xvzf php-3.0.16.tar.gz

This unzips the tar file and untars it. In this case, the directory php-3.0.16 is created in the current directory. Inside that directory are all the files in the tarball. Note that to untar an already unzipped tarball, you leave the z out of the option list. If you were to untar the unzipped php tarball, you would type

[root@mail /root]#tar xvf php-3.0.16.tar

Finally, to create a tarball from a directory, use the option cvf. To tar the php3 directory, enter the following:

[root@ /root]#tar cvf php-3.0.16.tar php-3.0.16

How to Install a Needed Package from a CD

Unlike DOS or Microsoft Windows, Linux does not have drive letters. Disk drives , including CD-ROMs and floppies, have their contents listed under directories rather than under drive letters . Handling file systems this way gives no practical limit to the number of drives that can be used by Linux at any one time. The following sections guide you through the process of using CD-ROMs under Linux.

Mounting the CD

The packages and tarballs necessary to install this project on your computer are located on the CD. To access the CD, use the mount command and attach the CD underneath a directory on your hard drive. Historically, the proper location to do this is under the /mnt/ cdrom directory.

The standard installation of Red Hat 6.x that includes the Gnome desktop automatically mounts the CD-ROM for you when you insert it. However, this does not happen if you are running in the console mode and not running the X Window System. For that reason, let's review the mount command and how to use it.

The mount command has a manual page. You can examine it by bringing up a terminal window and entering man mount. The options can be a bit confusing, but you generally use only one or two options. To mount the CD-ROM under the /mnt/cdrom directory, enter

[root@mail /root]#mount “t iso9660 /dev/cdrom /mnt/cdrom

This tells the mount program to look for a CD-ROM in the CD-ROM device that is formatted with the iso9660 CD-ROM file system. If it finds that CD-ROM and that file system, it then places all the files on that CD-ROM under the /mnt/cdrom directory. At that point, you can do an ls /mnt/cdrom and see all the files on the root directory of the CD.

To mount a floppy disk in drive A: under the /mnt/floppy directory, you would enter

[root@mail /root]#mount “t vfat /dev/fd0 /mnt/floppy

Another possibility in a dual boot system is to mount a Windows 95 or Windows 98 file system under a directory. If you create a directory called cdrive under the /mnt directory and the Windows drive C: is on /dev/hda1, you can mount it. For example

 [root@mail /root]#mkdir /mnt/cdrive  [root@mail /root]#mount t vfat /dev/hda1 /mnt/cdrive 

After this, you can run ls /mnt/cdrive and list all the files in the root directory of drive C. This works for all the recognized file systems listed on the man page for the mount command.

Installing rpms and Copying Files

After you have the CD mounted under the /mnt/cdrom directory, you are ready to copy the packages and tarballs onto your computer. I recommend you create a directory under your home directory. This directory will hold all of the rpms and tarballs while we work on this project. For the sake of this project, I'll assume the name of this directory is imp.

We have to do a lot of work as root while installing packages and creating and compiling, so put the imp directory under /root. Be sure you are logged in as root when you create the directory.

Copy all of the .rpm and .gz files from the CD into this imp directory. The list of files you will have in the imp directory follows :

Output

 MySQL-3.22.32-1.i386.rpm MySQL-client-3.22.32-1.i386.rpm MySQL-shared-3.22.32-1.i386.rpm apache-1.3.12-1.i386.rpm apache-devel-1.3.9-4.i386.rpm freetype-1.2-7.i386.rpm freetype-devel-1.2-7.i386.rpm horde-1.0.11.tar.gz imap-4.7a-4.i386.rpm imap-devel-4.7a-4.i386.rpm imap-utils-4.7a-4.i386.rpm imp-2.0.11.tar.gz php-3.0.15.tar.gz 

The important rpms here are the Apache, imap, and freetype files. Whenever you install a development rpm, its version must match the standard rpm file's version. If you don't have that exact version of Apache, Imap, or Freetype installed, you must uninstall them first. Then you can install these rpms.

You can obtain all of the latest rpms from the Internet and install them. However, if you do that, you can get a version of software that does not work properly with the other software packages we are about to use.

Standalone Usage: How to Verify Required Services Are Installed and Working

You must have several system services and packages installed to continue. First, check your network functionality. You must at least have the loopback device installed. If you are going to test this over a network, you must also have a network card installed.

As the root user , bring up a terminal window (or log on to a console), and enter the command ifconfig. If you have a network card installed and set up, you will see something displayed similar to the following:

[root@wmaxlaptop root]# ifconfig

Output

 eth0      Link encap:Ethernet  HWaddr 00:E0:98:76:EB:F2           inet addr:172.16.13.70  Bcast:172.16.13.255  Mask:255.255.255.0           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:98094 errors:1 dropped:99 overruns:0 frame:432           TX packets:10214 errors:0 dropped:0 overruns:0 carrier:0           collisions:4662 txqueuelen:100           Interrupt:3 Base address:0x300 lo        Link encap:Local Loopback           inet addr:127.0.0.1  Mask:255.0.0.0           UP LOOPBACK RUNNING  MTU:3924  Metric:1           RX packets:6 errors:0 dropped:0 overruns:0 frame:0           TX packets:6 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0 

You are interested in the lo device. Every machine using TCP/IP has a local loopback adapter, which is an imaginary network card that enables you to test your own TCP/IP stack. The address is always 127.0.0.1. You can ping your computer and connect to services on your computer with this address. You don't have to be connected to a network to test the system we are installing.

If you don't have this adapter installed, you need to go back through the Red Hat install. This time, indicate you are upgrading your system, and select a Server Install.

To verify the loopback adapter, you need to use ping. ping will go on forever, and you can stop it with a Ctrl+C, or you can tell it how many pings to send when you run it. Let's try for five pings .

[root@wmaxlaptop root]# ping -c 5 127.0.0.1

Output

 PING 127.0.0.1 (127.0.0.1) from 127.0.0.1 : 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.0 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0.0 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=255 time=0.0 ms 64 bytes from 127.0.0.1: icmp_seq=3 ttl=255 time=0.0 ms 64 bytes from 127.0.0.1: icmp_seq=4 ttl=255 time=0.0 ms --- 127.0.0.1 ping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max = 0.0/0.0/0.0 ms 

If you get the preceding printout, you are in business. Otherwise, try reinstalling your Red Hat system using the guidelines mentioned previously.

NOTE

ping tests about 95% of a TCP/IP network's connectivity. Generally, if ping works, everything else will work. This rule of thumb applies to all machines and TCP/IP


If you are going to test using only your computer, you need to have XFree86 installed and working. If you have a graphical user interface using Gnome or KDE, you are ready. If you don't, you need to install that package. The best way to do this is reinstall Red Hat and choose a Gnome Workstation Upgrade.

The other packages you need to check for being installed are sendmail and Netscape Navigator:

 [root@wmaxlaptop php-3.0.15]# rpm -q sendmail  sendmail-8.9.3-15  [root@wmaxlaptop php-3.0.15]# rpm -q netscape package netscape is not installed  [root@wmaxlaptop php-3.0.15]# rpm -qa  grep netscape netscape-common-4.61-12 netscape-communicator-4.61-12 

As you can see, I tried to query for Netscape, and I received no answer. So I ran rpm with the -qa option, which gave me everything. I then used grep to locate everything with Netscape in it. If you don't have these packages, install them from the Red Hat installation CD. You don't have to install Netscape if you are not running the X Window System on your computer.

only for RuBoard - do not distribute or recompile


MySQL and PHP From Scratch
MySQL & PHP From Scratch
ISBN: 0789724405
EAN: 2147483647
Year: 1999
Pages: 93
Authors: Wade Maxfield

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net