Tuesday, August 16, 2011

Installing Apache, MySQL, PHP in CentOS 5.5 on Rackspace Cloud

Most of cloud users prefer Rackspace Cloud for its better service and cost effectiveness…
All commands are performed as root to install Apache, MySQL, PHP in CentOS 5.5 Server on Rackspace Cloud.

Install Apache

# sudo yum install httpd mod_ssl

Configure ServerName
# sudo /etc/init.d/httpd start

Remove Error
Starting httpd: httpd: Could not reliably determine the server’s fully qualified domain name, using xx.xx.xxx.xx for ServerName

Modify
# sudo vi /etc/httpd/conf/httpd.conf

Add server name after #ServerName www.example.com:80

ServerName svnlabs

# sudo /etc/init.d/httpd reload

By default port 80 is blocked on server, enable in iptables…
# iptables -I RH-Firewall-1-INPUT -p tcp –dport 80 -j ACCEPT

Chkconfig to start automatically if the Cloud Server is rebooted.

# sudo /sbin/chkconfig httpd on

Install MySQL

# yum install mysql-server
# /etc/init.d/mysqld start

Install PHP

Edit Repo file
# sudo vi /etc/yum.repos.d/CentOS-Base.repo

add at last

[c5-testing]
name=CentOS-5 Testing
baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing

now run
# yum install php php-common php-gd php-mcrypt php-pear php-pecl-memcache php-mhash php-mysql php-xml php-mbstring

Install PhpMyAdmin

# cd /var/www/html
# wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.6/phpMyAdmin-3.3.6-english.tar.gz?r=http%3A%2F%2Fwww.phpmyadmin.net%2Fhome_page%2Fdownloads.php&ts=1283745912&use_mirror=voxel

# tar zxvf phpMyAdmin-3.3.6-english.tar.gz
# mv phpMyAdmin-3.3.6-english phpmyadmin
# cd phpmyadmin
# cp config.sample.inc.php config.inc.php

Edit config.inc.php for random string $cfg['blowfish_secret'] = ‘RandomStringHere’;

Restart server
# service httpd restart

use the following in the file config.inc.php of phpMyAdmin to restrict access to from remote machines:

$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
$cfg['Servers'][$i]['AllowDeny']['rules'][] = 'allow % from 127.0.0.1';
$cfg['Servers'][$i]['AllowDeny']['rules'][] = 'deny % from all';

This means that only users logged into my laptop are allowed to see the phpMyAdmin pages in their browser. The percent sign (%) stands for "all users".


No comments:

Post a Comment