Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
46Activity
0 of .
Results for:
No results containing your search query
P. 1
Install & Configure Apache PHP PostgreSQL & MySQL on Linux v1.1

Install & Configure Apache PHP PostgreSQL & MySQL on Linux v1.1

Ratings:

5.0

(1)
|Views: 3,888|Likes:
Published by Kefa Rabah
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. If then use Google to grub some CentOS5 HowTo.
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. If then use Google to grub some CentOS5 HowTo.

More info:

Published by: Kefa Rabah on Aug 14, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/11/2014

pdf

text

original

 
Linux LAMP PostgreSQL Install & Configure Apache, PHP, and MySQL PSQL on Linux v1.2
© April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
www.globalopenversity.orgA GOV Open Knowledge Access License Technical Publications
 
1
Global Open VersityIT Systems Integration Hands-on Labs Training Manual
Apache, PHP, MySQL and PostgreSQL on Linux HowTo
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 installedCentOS52.
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 overto scribd.com and check out a good HowTo entitled “Install Configure and Upgrade Linux CentOS5 Serverv1.1” to get you started.
Part 1: Installing Apache, PHP, MySQL
These will the basic components for a dynamic, database-driven web site. We use yum to handle of therequired packages1. Install Apache (
httpd
), PHP, MySQL (server and client), and the component that allows PHP to talk tomysql.
yum install httpd* php* mysql* -y
Note that: * indicates install all components2. Configure the service to start automatically
 
/sbin/chkconfig httpd on/sbin/chkconfig --add mysqld/sbin/chkconfig mysqld on/sbin/service httpd start/sbin/service mysqld start
3. IMPORTANT! Set up the mysql database root password. Without a password, ANY user on the box canlogin to mysql as database root. The mysql root account is a separate password from the machine rootaccount.
mysqladmin –u root password 'new-password'\\quotes are required
 
Linux LAMP PostgreSQL Install & Configure Apache, PHP, and MySQL PSQL on Linux v1.2
© April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
www.globalopenversity.orgA GOV Open Knowledge Access License Technical Publications
 
24 Make additional security-related changes to mysql.
 
Mysql –u root –pMysql> DROP DATABASE test; \\ removes the test dbaseMysql> DELETE FROM mysql.user WHERE user =''; \\ removes anonymous acrossMysql> 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:
<?phpPhpinfo();?>
7. Create a database and database user for your data. You will use this database and username in yourdatabase connection string. The GRANT statement actually creates a new MYSQL user account.
Mysql> GREATE DATABASE web_db;Mysql> GRANT ALL PRIVILEGES ON web_db.* TO 'web_user'@'localhost' IDENTIFIEDBY 'thepassword';
Part 2: Installing PostgreSQL on Fedora Core (skip MySQL)
This will install the PostgreSQL database server and the component required to write PHP scripts thatcommunicate with postgresql. We use yum to handle dependencies and gather all of the requiredpackages. For more information on PostgreSQL, seehttp://www.postgresql.org 1. Install PostgreSQL and the component that allows PHP to talk to PostgreSQL.
# yum -y install postgresql postgresql-server php-pgsql
2. Configure the new service to start automatically on boot
 
# /sbin/chkconfig –-level 345 postgresql on# /sbin/service postgresql start
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.
# su - postgres
 \\The
dash "-"
is important!
 
Linux LAMP PostgreSQL Install & Configure Apache, PHP, and MySQL PSQL on Linux v1.2
© April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
www.globalopenversity.orgA GOV Open Knowledge Access License Technical Publications
 
34. Next, issued the command,
"psql template1
", to enter the default postgresql database
-bash-3.2$ psql template1
 
 
Welcome to psql 8.1.11, the PostgreSQL interactive terminal.Type: \copyright for distribution terms\h for help with SQL commands\? for help with psql commands\g or terminate with semicolon to execute query\q to quittemplate1=#
 
Note:
"template1
"is the database that is included by default with PostgreSQL.5. Check the
version
of your
postgresql
:
template1=# select version();version--------------------------------------------------------------------PostgreSQL 8.1.11 on i686-redhat-linux-gnu, compiled byGCC gcc (GCC) 4.1.2 20070626 (Red Hat 4.1.2-14)(1 row)template1=# \q-bash-3.2$
6. Now create dbase user
"webadmin"
and make him a superuser:
-bash-3.2$ createuser -P webadmin
Enter password for new role:Enter it again:Shall the new role be a superuser? (y/n) yCREATE ROLE
-bash-3.2$
7. Next create the database
"webdbase"
 
-bash-3.2$-bash-3.2$ createdb -O webadmin webdbaseCREATE DATABASE-bash-3.2$
8. Now connect into your newly created database:
-bash-3.2$ psql webdbaseWelcome to psql 8.1.11, the PostgreSQL interactive terminal.Type: \copyright for distribution terms\h for help with SQL commands\? for help with psql commands\g or terminate with semicolon to execute query\q to quitwebdbase=#

Activity (46)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
ssmile liked this
Luiserf ST liked this
Kefa Rabah liked this
Kefa Rabah liked this
Kefa Rabah liked this
Kefa Rabah liked this
Kefa Rabah liked this
Kefa Rabah liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->