Theo Chakkapark
theo [at] entetel.com
Copyright © 2004 by Theo Chakkapark
Revision History
| Revision 1.5 | 2004-06-02 | Revised by: Theo |
|
| Revision 1.2 | 2004-05-24 | Revised by: Theo |
|
| Revision 1.1 | 2004-05-24 | Revised by: Theo |
| Fixed package version information. |
| Revision 1.0 | 2004-05-17 | Revised by: Theo |
| First version. |
Table of Contents
This document will guide the user to install the Linux operating system (Red Hat 9), Apache 2.x webserver with Secure Socket Layers, mySQL 4.1.x database, PHP 4.3.x, and osCPro shopping cart.
The following packages are required for this tutorial. Unless specified, download the tar'd source for each package. Try to avoid RPM/SRPM.
Red Hat Linux 9
All CDs required.
http://www.redhat.comApache 2.0.49
http://httpd.apache.org/
mySQL 4.1.1
http://dev.mysql.com/downloads/mysql/4.1.html#SourcePHP 4.3.x
http://www.php.net/downloads.phpLatest Version of CGI.pm and DBI
http://www.cpan.org/modules/by-module/CGI/
http://www.cpan.org/modules/by-module/DBI/osCPro
http://www.oscpro.com/shop/index.php
Zend Optimizer
http://www.zend.com/store/free_download.phpMake sure all packages will be in the
rootdirectory of the server.
Install RH9 with a custom install; the development tools must be selected. Do not install the
httpdandmysqlpackages. Make sure thecurlpackage is installed.
Documentation
http://dev.mysql.com/doc/mysql/en/index.htmlMake sure you are logged in as
root. Extract the mySQL package (tar xfvz filename) and change into the mySQL source directory.
mysql into the group mysql > groupadd
mysql
>
useradd -g mysql mysql > ./configure --with-openssl
--with-isam --prefix=/usr/local/mysql
> make
> make install
> cp support-files/my-medium.cnf /etc/my.cnf
> cd /usr/local/mysql/bin
> ./mysql_install_db --user=mysql
> cd ..
> chown -R root .
> chown -R mysql var
> chgrp -R mysql .
> cd /usr/local/mysql/bin
> ./mysqld_safe --user=mysql &
> ./mysql
You are now in the mySQL CLI prompt. All SQL commands end with a semicolon.
mysql> drop database test;
mysql> use mysql;
mysql> delete from db;
mysql> delete from user where not (host="localhost" and user="root");
mysql> flush privileges;
Note: Make sure you spell privileges correctly. If you get any errors when you have to type a line with that word, it is most likely you misspelled it. osCommerce username so we do not have to use a root account for mySQL access. You will be creating two logins, one that is a login for the server itself, and another for remote access.
mysql> GRANT ALL PRIVILEGES ON osCommerce.* TO 'osCommerce'@'localhost' IDENTIFIED BY '';
mysql> GRANT ALL PRIVILEGES ON osCommerce.* TO 'osCommerce'@'%' IDENTIFIED BY '';
your_password with the password you will be using.
mysql>
SET PASSWORD FOR 'osCommerce'@'localhost' = OLD_PASSWORD('your_password');
mysql> SET PASSWORD FOR 'osCommerce'@'%' = OLD_PASSWORD('your_password');
mysql> FLUSH PRIVILEGES;
root account password for mySQL.
mysql> \q
>
./mysqladmin -u root password new-password
> cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
> chmod +x /etc/init.d/mysql
> chkconfig --add mysql
CGI.pm package and install.
(extract using tar xfvz filename and change into the CGI.pm source directory)
> perl Makefile.PL
> make
> make install
DBI package and install. (extract using tar xfvz filename and change into the DBI source directory and extra
> perl Makefile.PL
> make
> make install The CGI.pm and DBI packages allow you to run the command line mySQL utilities.
Make sure you are logged in as
root. Extract the Apache 2 package (tar xfvz filename) and change into the Apache 2 source directory.
>
export CFLAGS="-I/usr/kerberos/include/ -L/usr/kerberos/lib"
> ./configure --enable-so --enable-ssl
> make
> make install> vi /usr/local/apache2/conf/httpd.confServerAdmin line to reflect the administrator's e-mail address.DocumentRoot to reflect the path where HTML and PHP files will be served.
DocumentRoot from the default, you will have to find the line that reads <Directory "/usr/local/apache2/htdocs"> to the path you used in DocumentRootDirectoryIndex index.html index.html.var and change it to DirectoryIndex index.php index.html index.html.var Save the file by typing <esc>, colon, wq, <enter>
:wq
Press <enter>.
3. Edit mime.types to inlcude handlers for PHP.
> vi /usr/local/apache2/conf/mime.types
At the bottom of the file, insert the following line:
application/x-httpd-php .php
4. Modify the script for apache to start up on boot with SSL.
> cp /usr/local/apache2/bin/apachectl /etc/rc.d/rc3.d/S58httpd
Where rc3.d is the current boot run level. If you use a graphical login, change rc3 or rc5
> vi/etc/rc.d/rc3.d/S58httpd
In vi, find the line that begins with
HTTPD='/usr/local/apache2/bin/httpd'
Change it to
HTTPD='/usr/local/apache2/bin/httpd -DSSL'
Save and exit vi.
At this point, do not reboot the machine. Apache will not start since SSL is not completely configured yet. After you complete the SSL setup, when you boot the server, you may be asked for the SSL password on boot; the system will not fill this value in automatically (although there are scripts that will).
Documentation
http://www.php.net/docs.phpMake sure you are logged in as
root. Extract the PHP package (tar xfvz filename) and change into the PHP source directory.
> ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-curl
> make
> make install
> cp php.ini-dist /usr/local/lib/php.ini
/usr/local/lib/php.ini and set register_globals to on> vi /usr/local/lib/php.ini
register_globals = Off. Change "Off" to "On" by pressing insert to go into edit mode. When you are done editing, hit esc, and then press the following in order, colon, wq, <enter>. Your prompt should look like
:wq
Then press <enter> to save your file and quit the editor.
> vi /usr/local/apache2/conf/httpd.conf
Insert the following lines at the bottom of the file:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Make sure you are logged in as
root. Extract the Zend Optimizer package (tar xfvz filename) and change into the Zend Optimizersource directory.
> ./install
> cd
>
openssl genrsa -des3 -out server.key 1024
Set a password for the key.
>
openssl rsa -in server.key -out server.pem
Use the same password in step 2.
>
openssl req -new -key server.key -out server.csr
- Fill out the values for country, state, city.PEM passphrase is the password you used originally when you generated a root certificate.
- The Common Name is the domain name or IP the server is on.
- The Challenge Password can be a different password than the PEM passphrase.
> openssl x509 -req -days 60 -in server.csr -signkey server.key -out server.crt
Use the same password you used for the PEM passphrase.
> mkdir /usr/local/apache2/conf/ssl.crt
> cp server.crt /usr/local/apache2/conf/ssl.crt/server.crt
> mkdir /usr/local/apache2/conf/ssl.key
> cp server.key /usr/local/apache2/conf/ssl.key/server.key > vi /usr/local/apache2/conf/ssl.conf
DocumentRoot and change the path to the DocumentRoot found in the httpd.confServerName to your server's domain name or IP address. > cd /usr/local/apache2/bin
> ./apachectl stop
> ./apachectl startssl > cd
> mkdir cpro
> cd cproDocumentRoot. > cd catalog > cp * -R -f /usr/local/apache2/htdocs> cd /usr/local/apache2/htdocs/includes/
> touch configure.php
> chmod 706 configure.php
> cd /usr/local/apache2/htdocs/admin/includes/
> touch configure.php
> chmod 706 configure.php
http://yourserver.com/install
DocumentRoot.Database Server: localhost
Username: osCommerce
Password: your password for the mySQL username osCommerce
Database: osCommerce
> vi /usr/local/apache2/htdocs/admin/includes/classes/split_page_results.php
In vi, type colon, slash offset.
:/offset
Underneath the line that begins with $offset, insert the following lines:
if($offset < 0){
$offset = 0;
}
Save and quit from vi. Edit the next file.
> vi /usr/local/apache2/htdocs/includes/classes/split_page_results.php
In vi, type colon, slash offset.
:/offset
Underneath the line that begins with $offset, insert the following lines:
if($offset < 0){
$offset = 0;
}
Save and quit from vi. > crontab -e0 0 * * * * php /usr/local/apache2/htdocs/subscription_automation.php
Save and quit from vi.> chmod 705 /usr/local/apache2/htdocs/includes/configure.php
> chmod 705 /usr/local/apache2/htdocs/admin/includes/configure.php
> chmod 777 /usr/local/apache2/htdocs/images
Delete the osCPro install directory.
> rm -r -f /usr/local/apache2/htdocs/install