Simple CentOS LAMP Server


CentosLogoIf you use “yum” or the “add/remove apps” programs from the GUI, you will find that you most likely wont need to do the “chkconfig –levels” commands, as the install process will do it for you.  All you will need to do is to start the service or reboot after you finish.

yum install mysql mysql-server
chkconfig –levels 235 mysqld on
/etc/init.d/mysqld start

yum install httpd
chkconfig –levels 235 httpd on
/etc/init.d/httpd start

yum install php

now create a “.php” file on the webserver in “/var/www/html/”, this is just so we can confirm that “PHP” and your “Apache” web server in working correctly.
nano /var/www/html/info.php
<?php
phpinfo();
?>

Now we install any extra php, and other modules we will need.
yum install php-mysql

yum install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy curl curl-devel

yum install php-pecl-apc

Edit the “iptables” file so there is nothing stopping you from accessing the web server.
nano /etc/sysconfig/iptables

This is only needed if you have installed “apache” manually so it can start when the system starts up.
/etc/init.d/httpd restart

yum install phpmyadmin

Now edit the “phpMyAdmin.conf”, and comment out the following like I have below.
nano /etc/httpd/conf.d/phpMyAdmin.conf

[…]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

#usr/share/phpMyAdmin/>
#   <IfModule mod_authz_core.c>
#     # Apache 2.4
#     Require local
#   IfModule>
#   <IfModule !mod_authz_core.c>
#     # Apache 2.2
#     Order Deny,Allow
#     Deny from All
#     Allow from 127.0.0.1
#     Allow from ::1
#   </IfModule>
#</Directory>
[…]

This is only needed if you have installed “phpMyAdmin” manually so it can have a config file to work with, when the service starts up.
cp /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php

 

Now edit the “config.inc.php” so you can remove the “only local access” and have normal “http”access via your browser.
nano /usr/share/phpMyAdmin/config.inc.php

[…]
/* Authentication type */
$cfg[‘Servers’][$i][‘auth_type’] = ‘http’;
[…]

service httpd restart

 

Thanks, and feel free to leave your comments.

Leave a comment

Your email address will not be published. Required fields are marked *