If you don't know, the LAMP stack is the Linux-Apache-MySQL-PHP stack. Because Ubuntu (and therefore Minty Linux) and Debian have apt-get, this process is extremely simple. First, lets get everything installed.
$sudo apt-get install apache2 apache2-utils mysql-server php5 libapache2-mod-php5 php5-mysql mysql-client
One line, everything will be installed. But we should do some configuring before we start it all up. To begin, lets configure apache. The file needing to be edited is /etc/apache2/apache2.conf. Choose your favorite text editor, and add the following line to the file.
ServerName localhost
If you have your own domain, then you can put this instead. Also, if you are intending to use a non-default folder to store your web documents, you'll need to adjust this as well. I will cover these changes in my next post about Virtual Hosting using apache2. For now, we'll just get the server up and running.
Lets start the web server and make sure its working.
sudo /etc/init.d/apache2 start
And then browse to http://localhost. Is everything working? It should say "It works!" making it easy to tell. Next, we'll start the MySQL server.
sudo /etc/init.d/mysql start
And then from the command line, connect to make sure its working with:
mysql -u root
If it works, you should really change your root password for security reasons. If you were able to connect, enter "exit" to, well, exit, and then run the following comand.
mysqladmin -u root password YOUR NEW PASSWORD
Phew, we're safe again! The last step is to verify that PHP is working. This involves placing a new file into your web directory. The default directory is /var/www/. Go there now. Using your favorite text editor, create a new file called phptest.php. This is what it should contain:
Thats it. Then again, browse to http://localhost/phptest.php. Do you see a lot of information? Do you see nothing? Nothing is bad, lots of information is good. But once you see it, remove the phptest.php file for security reasons. You're up and running!
Wednesday, January 27, 2010
Subscribe to:
Comments (Atom)