(I set this up for a class I was teaching they were using Fedora 13, it is of course easily adaptable for CentOS or RHEL)
Fedora comes with Apache (httpd) installed and mysql client but it is missing a few things to complete the LAMP stack. So a little work is required to get everything set up. All of the following are systems administration tasks and must be done as root user:
Once you complete this you can install Wordpress, Mediawiki, Tikiwik etc. Or if you want to build your own application start with this tutorial IBM DeveloperWorks Introduction to LAMP
These instructions are also applicable to Centos 5.x. Be aware that where it says install / update you may need to do one or the other depending upon your install.
Apache http://httpd.apache.org/docs/2.2/
- yum update httpd -y
- service httpd start
- chkconfig httpd on
make sure it starts up when we reboot
- Note: main configuration file /etc/httpd/conf/httpd.conf, others in /etc/httpd/conf.d./*
- yum install mysql-server -y
- service mysqld start
- chkconfig mysqld on
make sure it starts up when we reboot - mysql_secure_installation
secure the install a little bit! - yum install phpmyadmin -y
the browser/web interface for mysql - service httpd restart
- Optional create a database:
- mysql -u root -p
- mysql> create database testing;
- mysql> grant all on testing.* to 'userx' identified by '123pass';
- mysql> quit
- mysql -u userx -p
- mysql> show databases;
- mysql> quit
- or you can do the same thing using http://localhost/phpMyAdmin
- Note: phpMyAdmin defaults to respond only to a localhost client, to allow other hosts to use it you must modify /etc/httpd/conf.d/phpMyAdmin.conf:
- Locate the line(s) Allow from 127.0.0.1
- Add a line below it
Allow from 192.168.10.0/24
where 192.168.10.0/24 is your network - save the file
- service httpd reload
PHP http://ca3.php.net/tut.php
- yum -y update php php-mysql
- If you are using Tikiwiki you may also need the php & gd connection: yum install php-gd -y
- service httpd reload
- create a file /var/www/html/hello.php containing:
- Load the file in a browser http://localhost/hello.php
if you see the text hello world, you are ready to go - Optional
- create a file /var/www/html/phpinfo.php
- load the file in a browser http://localhost/phpinfo.php
- 80 for apache/httpd (443 for https)
- 3306 for mysql
