There can be occasions when you need to use the Centos Live CD if you are away from your usual PC. You may carry about a laptop or you may simply need to use a machine which has neither Linux nor a web server installed on it.
You can set up a test Lamp server using the Centos 6 Live CD in order to try things out. This is surprisingly easy to accomplish as the basic repos which ship with the Live CD carry all the tools you need.
Obviously you will first need to boot the laptop or machine from the
Centos Live CD and log in, so this presumes you have already burned it to a disk and done that.
Once you are up and running, first you will need Httpd web server, which is the newer name for the Apache, so install it with the following command.
$ sudo yum -y install httpd
Start it up with
$ sudo service httpd start
We do not set to start on reboot for the obvious reason that the Live CD is not persistant, so this is a one use scenario and as of writing you will need to keep the machine on or in sleep mode and not switch it off before you have finished what you are doing.
Now install mysql with a similar command
$ sudo yum -y install mysql-server
and again start it with
$ sudo service mysqld start
Run the secure configuration tool
$ /usr/bin/mysql_secure_installation
And enter your preferences at the prompt
At this point you can check the installation with firefox if it is installed.
/usr/bin/firefox http://localhost
And you should see a screen such as the one below.
To use php you need to make a couple of small adjustments in the configuration files.
$ sudo vi /etc/httpd/conf.d/welcome.conf
Scroll down to comment out or remove the block as indicated,
$ sudo vi /etc/httpd/conf/httpd.conf
Scroll down to 'DirectoryIndex' and add the line 'index.php'
Now add the final php component
$ sudo yum -y install php php-mysql
Which will give the basics for php use
You can create an info file in the web directory
$ sudo vi /var/www/html/info.php
and add the line
<?php
phpinfo();
?>
Close and save the file then restart the httpd server
$ sudo service httpd restart
Then again browse to http://localhost
So, if you are on the move but need quick access to a webserver, whatever the machine is loaded up with, you can still use Centos with a basic (or more advanced) Lamp stack in minutes.
This is especially useful for anyone using CMS such as Wordpress, Joomla or similar which rely upon the PHP component of the stack
Labels: Centos 6, Centos Live CD, install Lamp, RHEL