LINUX GAZETTE

[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]

"Linux Gazette...making Linux just a little more fun!"


Mark's Web/Database Installation

Zope, Apache, Mysql, PostgreSQL, Perl, Python, PHP

By Mark Nielsen


  1. Introduction
  2. Mark's opinion of the useful free software
  3. The installation script
  4. Conclusion
  5. References

Introduction

I find it easier to install services without using rpms, because I might install different versions. I am a firm believer in never using rpms when you have services that use custom made binary programs. The only exception is using the Debian GNU/Linux distribution which has some neat features.

Why does Mark go through the trouble of installing all these web and database services? It is a learning tool which has been useful at all his jobs. When the opportunity strikes to use free software, it is handy to have live demonstrations of the capabilities of the free software. All of the skills associated with the software below have been very useful at various jobs.

Mark's opinion on the free software

The software Mark uses is all you need to become a top notch web/database programmer. Look at Dice.com and other webpages. Almost of the skills you need for commercial software can be learned first through the free software listed below. The power of the free software is that you can use it anywhere with unlimited possibilities. Put it on your laptop -- you don't have to pay a license. Learn the skills you need with the free software -- you can always get it and you can always learn it. You don't have to wait to get a stupid license. These skills are transferable to other webservers, databases, and most likely you will use the free languages mentioned below at any company.

Hopefully, you will be able to convince your bosses and/or companies to use the free software. Free software is critical to save lots of money and to create an environment where your limitations are just people and hardware. Usually, I find it takes less people to manage well designed large networks than all the goof-balls who install commercial software.

Here is a list of reasons why Mark considers this setup very valuable:

  1. Python -- I was a die-hard Perl fanatic. Until Python came along. It took me months of other people telling me to switch to Python before I decided to do it. Now, unless I need a specific Perl module, I use Python. I am going to see what I can do to help port Perl Modules to Python with the mod_snake module for Apache. Python is the language to use for rapid application development and is a key critical language for the Zope webserver. Learn Python now, and you will be a valuable employee or consultant later. When the market booms for Python programmers, it will be easier to get a job in Python rather than Perl. Where Perl was 5 years ago, Python is today. It is gaining ground in the corporate world slowly. You can create Python binaries so that you don't need Python installed in order to run a Python program. Python is an object-oriented language. The nice thing about Python is that it will make JAVA binaries, and hence, I can passby writing JAVA code. I really wish another language that was free and open would replace JAVA in browsers. To me, JAVA needs to be replaced, or fully open-sourced before I would consider it ethically-wise and business-wise. As long as it is not GNUed, or some similar deal, I consider putting your life in the hands of corporations (when you don't have to) to be skeptical.
  2. Perl -- The standard of web development. It is the most powerful language out there for web/database development. It is not as user-friendly as PHP, but I like it better because Perl can do more than just Web/Database stuff. Perl and Python are the two languages I use for scripting.
  3. PHP -- A nice language for people who just want to do web/database development. I don't use it much because I want to be really good and Perl and Python and I don't want to spread my skills out too much.
  4. Apache -- The best webserver in the world. I don't need to explain it. You can use Apache and SSL as a front end and put Zope behind Apache and SSL. Thus, Zope can also be encrypted indirectly.
  5. Zope -- A very powerful webserver that offers security, database, and html scripting all in one. It is truly the webserver to learn for rapid application development. Zope and Apache are separate beasts that can work together nicely with the Apache rewrite module. Apache and Zope compliment each other and serve different purposes. If you learn Zope and Apache both, you don't ever need to learn another webserver.
  6. PostgreSQL -- The best free database server in the world. I have noticed that PostgreSQL is based on elegance and is somewhat similar to Oracle for an SQL programmer. PostgreSQL has PL/pgSQL (like PL/SQL in Oracle), it has stored procedures, its counters are similar to Oracles,  and you can embed Perl commands in side SQL statements if you compile Perl into PostgreSQL. The only thing I don't like about PostgreSQL is its bad handling of large objects. If PostgreSQL had an easy method to use Large Objects like MySQL has, I would never use MySQL for private work.
  7. MySQL -- A great fast database server that a lot of companies use in combination with PHP. I like it, but I prefer PostgreSQL because MySQL lacks a lot of things. I don't want to spread my skills out over to many database servers, and thus, PostgreSQL and Oracle are my choices because they have many features. MySQL is good for fast simplistic databases. Its easy handling of large objects is really nice, which is why I still use it. I think MySQL and PostgreSQL serve different purposes and both are good. I like goofing around and experimenting and trying new things, so PostgreSQL will always be it for me.

Installation script

#### Before anything is done, goto the apache/src
#### directory and edit Configuration.tmpl add uncomment info and so.  
#### Answer y to just configure apache with mod_perl,
###      but don't let mod_perl build apache. 
### Add
#       AddModule modules/mod_snake/libmod_snake.a
# to the end of src/Configuration.tmpl in apache. 

### Then do this stuff. 

cd mysql-3.22.32
mkdir /usr/local/mysql-3.22.32
./configure --prefix=/usr/local/mysql
make
make install

cd ../postgresql-7.0.2/src
mkdir /usr/local/postgresql
./configure --prefix=/usr/local/postgresql --with-perl -with-odbc
make
make install
chown -R postgres /usr/local/postgresql

### Just configure apache, but don't build it
cd ../apache_1.3.12
make clean
./configure --prefix=/usr/local/apache

cd ../mod_snake-0.2.0
./configure  --prefix=/usr/local/mod_snake --with-apache=/usr/local/src/apache_1.3.12
make
make install

### Do not have perl build apache, just let is configure apache 
cd ../mod_perl-1.24
make clean
perl Makefile.PL EVERYTHING=1 APACHE_PREFIX=/usr/local/apache
make test
make install

### Build apache
cd ../apache_1.3.12
make
make install

### For those of you who might try to get php3 working with php4, 
### you can try to get the stuff installed, but I got the error
#Syntax error on line 208 of /usr/local/apache/conf/httpd.conf:
#Cannot load /usr/local/apache/libexec/libphp3.so into server: /usr/local/apache/libexec/libphp3.so: undefined symbol: dlst_first
#/usr/local/apache/bin/apachectl start: httpd could not be started
### Thanks to Chad Cunningham for metioning you can get both php3 and php4
### working in Apache at the same time. I still had some errors, 
### so I just abandoned php3. 

#cd ../php-3.0.16
#./configure  \
#--enable-versioning \
#--with-pgsql=/usr/local/postgresql \
#--with-mysql=/usr/local/mysql \
#--with-config-file-path=/usr/local/apache/ --enable-track-vars \
#--with-apxs=/usr/local/apache/bin/apxs --with-xml
#make
#make install

cd ../php-4.0.1pl2
./configure  \
--enable-versioning \
--with-pgsql=/usr/local/postgresql \
--with-mysql=/usr/local/mysql \
--with-config-file-path=/usr/local/apache/ --enable-track-vars \
--with-apxs=/usr/local/apache/bin/apxs --with-xml
make
make install

cd ..
mv Zope-2.2.0-src /usr/local/Zope
chown -R nobody /usr/local/Zope
cd /usr/local/Zope
### Setup the password and remember this password
su - nobody 'python wo_pcgi.py
### My hack to get a password I can remember, very bad security risk
su - nobody 'python zpasswd.py -u mark -p Something'

### Start the web servers
su -c nobody '/usr/local/Zope/start' & 
chown -R nobody /usr/local/apache
/usr/local/apache/bin/apachectrl start

#### Execute this command so that php can find the mysql libraries

ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.6.0.0 /usr/lib/libmysqlclient.so.6

### Put this in your startup script for apache.
### this gets PHP working. 

LD_LIBRARY_PATH=/usr/local/postgresql/lib
export LD_LIBRARY_PATH
PATH=$PATH:/usr/local/postgresql/bin
export PATH
export LIBDIR=/usr/local/postgresql/lib

/usr/local/apache/bin/apachectl start


### REMEMBER to initialize the database for postgresql and mysql.
### Execute the shell commands above
### For postgresql,

mkdir /usr/local/postgresql/data
chown -R postgres /usr/local/postgresql
cd /usr/local/postgresql
su postgresql -c '/usr/local/postgresql/bin/initdb -D /usr/local/postgresql/data'
/usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data start

### To initialize MySQL 
cd /usr/local/src/mysql-3.22.32
chown -R postgres  /usr/local/mysql
su postgres -c 'scripts/mysql_install_db'
su postgres -c '/usr/local/mysql/bin/safe_mysqld' &
### Remember to change the password for the server and to setup
### permissions for other users. 

#### Remember to setup permissions in MySQL and PostgreSQL for
#### the username that Zope and Apache un under. 

#### Here are some httpd.conf file option I put at the bottom

 
 SetHandler perl-script
 PerlHandler Apache::OutputChain Apache::SSIChain Apache::Registry 
 PerlSendHeader On
 Options ExecCGI
 

AddType application/x-httpd-php4 .php4 

### I haven't yet done anything with the mod_snake module. 

#### These are my files and directgries in /usr/local/src
Apache-OutputChain-0.07           Zope-2.2.0-src
Apache-OutputChain-0.07.tar.gz    Zope-2.2.0-src.tgz
Apache-SSI-2.13                   apache_1.3.12
Apache-SSI-2.13.tar.gz            apache_1.3.12.tar.gz
ApacheDBI-0.87                    mod_perl-1.24
ApacheDBI-0.87.tar.gz             mod_perl-1.24.tar.gz
DBD-CSV-0.1023.tar.gz             mod_snake-0.2.0
DBD-ODBC-0.28.tar.gz              mod_snake-0.2.0.tar.gz
DBD-Oracle-1.06.tar.gz            mysql-3.22.32
DBD-Pg-0.95.tar.gz                mysql-3.22.32.tar.gz
DBD-XBase-0.161.tar.gz            php-3.0.16
DBI-1.14                          php-3.0.16.tar.gz
DBI-1.14.tar.gz                   php-4.0.1pl2
Install                           php-4.0.1pl2.tar.gz
Install~                          postgresql-7.0.2
Msql-Mysql-modules-1.2214         postgresql-7.0.2.tar.gz
Msql-Mysql-modules-1.2214.tar.gz

Conclusion

Well, there is no conclusion, just comments.
Combining these programs with CVS, and storing any changes you make to your database with CVS (like writing down stored procedures, formatting of tables, webpages, etc), can be a very powerful combination for newbies and experienced dudes.

I have been telling people for years to get into the technologies above. I have noticed an explosion of jobs requiring these skills in the past few years. Even if you won't be using this stuff in the future, these programs have all the tools to get you familiar with the concepts which are transferable to any related commercial software package. The biggest threat that I had to learning these skills, to get relatively good jobs, was the lack of practice and lack of software to goof around on (years ago, when I wanted to get into web/database design, to get an MS system would have cost me well over $10,000 even as a student. Linux was around. It was all free. It had all the stuff. It had all the programming languages, web servers, database stuff, and networking capabilities. So here I am).

The key to being a web/database developer, is getting good at one scripting language, Javascript, HTML, generic SQL, Apache, and managing one free database server and also CVS. From there, learn the other scripting languages, Zope, and other database servers. If you learn all of these skills on Linux, a lot of the software, like Apache, PostgreSQL, Perl, Python, and Zope, are ported to NT and many Unices. Thus, you can learn it easily on the other platforms.

Hope this helps for beginners and don't hurt me for my opinions!

References

  1. apache.org
  2. zope.org
  3. php.net
  4. python.org
  5. perl.com
  6. postgresql.org
  7. mysql.com

Mark works as a computer guy at The Computer Underground and also at ZING and also at GNUJobs.com (soon).


Copyright © 2000, Mark Nielsen
Published in Issue 57 of Linux Gazette, September 2000

[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]