Professional Documents
Culture Documents
Introduction
There are two sections involved in this article: Part 1 covers installation of Apache, MySQL and PHP,
while Part 2 deals mainly with installing PostgreSQL. The article assumes that you already installed
CentOS52.
Assumptions:
It’s assumed that you have a good understanding of Linux operating system and its working environment.
It’s also assumed that you know how to install and configure Linux CentOS5, if not go ahead and pop over
to scribd.com and check out a good HowTo entitled “Install Configure and Upgrade Linux CentOS5 Server
v1.1” to get you started.
These will the basic components for a dynamic, database-driven web site. We use yum to handle of the
required packages
1. Install Apache (httpd), PHP, MySQL (server and client), and the component that allows PHP to talk to
mysql.
/sbin/chkconfig httpd on
/sbin/chkconfig mysqld on
3. IMPORTANT! Set up the mysql database root password. Without a password, ANY user on the box can
login to mysql as database root. The mysql root account is a separate password from the machine root
account.
1
© April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Mysql –u root –p
Mysql> DROP DATABASE test; \\ removes the test dbase
Mysql> DELETE FROM mysql.user WHERE user =''; \\ removes anonymous across
Mysql> FLUSH PRIVILEGES;
5. Following the above steps, the document root for Apache is /var/www/hmtl/
6. Create a test PHP script (test.php) and place in the documents root. A useful test script sample:
<?php
Phpinfo();
?>
7. Create a database and database user for your data. You will use this database and username in your
database connection string. The GRANT statement actually creates a new MYSQL user account.
This will install the PostgreSQL database server and the component required to write PHP scripts that
communicate with postgresql. We use yum to handle dependencies and gather all of the required
packages. For more information on PostgreSQL, see http://www.postgresql.org
1. Install PostgreSQL and the component that allows PHP to talk to PostgreSQL.
Note: when you start postgresql for the first time, it’ll initialize the database.
3. Start the postgresql interactive shell and create your first user and database.
2
© April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
4. Next, issued the command, "psql template1", to enter the default postgresql database
-bash-3.2$
-bash-3.2$ createdb -O webadmin webdbase
CREATE DATABASE
-bash-3.2$
webdbase=# \q
-bash-3.2$ logout
[root@linuxc ~]#
10. Edit the postgres host based access (pg_hba) configuration file:
# vi /var/lib/pgsql/data/pg_hba.conf
11. Modify the local line to use "md5" based authentication rather than "ident sameuser". Please
review the PostgreSQL documentation before making this change and take the security
# su – postgres
Note: You may need to install Webmin from www.webmin.com to ease your server administration pain!
In the coming articles we will show how you use Apache, MySQL/PostgreSQL and PHP, to deploy Moodle
LMS, SugarCRM and Drupal.
-----------------------------------------------
Kefa Rabah is the Founder and CIO, of Serengeti Systems Group Inc. Kefa is knowledgeable in several fields
of Science & Technology, IT Security Compliance and Project Management, and Renewable Energy Systems.
He is also the founder of Global Open Versity, a place to enhance your educating and career goals using the
latest innovations and technologies.
4
© April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
5
© April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada