Topics: Installation, Red Hat / Linux

Installing MySQL, PHP and Apache

Install the software:

# yum -y install mysql mysql-server php-mysql httpd php phpmyadmin
Create link from the DirectoryRoot of the webserver to PhpMyAdmin:
# cd /var/www/html
# ln -s /usr/share/phpMyAdmin
Make sure the services are started at boot time:
# chkconfig httpd on
# chkconfig --add mysqld
# chkconfig mysqld on
# service httpd start
# service mysqld start
Set the root password for mysql:
# mysqladmin -u root password root
Make additional security-related changes to mysql:
# mysql -u root -p
mysql> DROP DATABASE test; [removes the test database]
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]
Following the above steps, the document root for Apache is /var/www/html/. Create a test PHP script (such as phpinfo.php) and place it in the document root. A useful test script sample:
Test with a brower: http://hostname/phpinfo.php

Create a database:
mysql> create database testdb
Add the following to /etc/httpd/conf/httpd.conf:
<Directory "/usr/share/phpMyAdmin">
   Order allow,deny
   Allow from all
Set the ServerName entry to hostname:80

Add "index.php" to the DirectoryIndex entry, so the webserver also recognizes index.php as an index file.

Restart the http server:
# service httpd restart
Test with a browser: http://hostname/phpMyAdmin/

If you found this useful, here's more on the same topic(s) in our blog:

UNIX Health Check delivers software to scan Linux and AIX systems for potential issues. Run our software on your system, and receive a report in just a few minutes. UNIX Health Check is an automated check list. It will report on perfomance, capacity, stability and security issues. It will alert on configurations that can be improved per best practices, or items that should be improved per audit guidelines. A report will be generated in the format you wish, and the report includes the issues discovered and information on how to solve the issues as well.

Interested in learning more?