Set up a new VPS slice with Apache, MySQL and PHP5.3 (Debian/Ubuntu)
I recently switched from a SliceHost account (which I had for 2+ years) to a Linode slice, and I got double the specs for the same price.
So I signed up for my account, set up a new Debian slice, it was setup in minutes. So now I had to setup my production environment.
I've setup servers hundreds of times, but I figured it was a good tutorial for users who never had but want to get into the world of Virtual Private Servers (VPS).
This tutorial will show you how to setup a quick MySQL 5.0.51, PHP 5.3 and Apache 2.2.9 in a few easy steps.
It is worth noting that this setup will work well for a development machine, but when running a production environment, it is worth tweaking and compiling these daemons, as you will get a bit more performance out of your binaries
This tutorial will assume that you have already signed up for a Linode VPS and have SSH root access to it.
Upon logging into your new Debian slice, it is important before installing any software to update any possibly outdated packages.
You can update your apt repositories and upgrade any out-of-date packages by simply running the command:
apt-get update apt-get upgrade
If there are any out-of-date packages, you will be asked if you want to install them here. You can type 'y' to install them, but you should look over the list and make sure nothing is out of sorts.
If you have an older Debian installation (your VPS has been lingering for a while), you may want to either rebuild (if you don't have any data on it) or do a distribution upgrade (which will install the latest stable version of Debian). You can do so using this command:
apt-get dist-upgrade
Now that you are up to date, you are ready to install your LAMP environment.
We will start by install MySQL, which can be done using this command:
apt-get install mysql-server
You will have to confirm that you want to install this package by typing a Y.
After it has downloaded the package, it will proceed to install it and will ask you during the process for a root mysql password. Although not necessary, it is recommended to set a secure password here.
It's now time to install PHP5. PHP 5.3 (by default) is not in the Debian main repositories, but Dotdeb.org has created a repository specifically for this reason, you can travel to their site which has an article, which will tell you about PHP 5.3 and also give you the debian repositories that they have set up, which go in your /etc/apt/sources.list file. Head over there now and follow the instructions to install the new repositories, then run an apt-get update to update your package listing.
At this point, it is worth noting that if you wish to install the latest stable PHP 5.2 release, you can do so easily by not grabbing the PHP5.3 dotdeb.org repositories and just proceeding with the tutorial.
apt-get install php5 php5-mysql
If you use PHP5 from the command line, or plan to, you can add "php5-cli" to the package list above to grab the local executable file as well.
This step will also install Apache 2.2.9 with all the relevant PHP5 modules for Apache 2.
You should now be able to go to your VPS's IP (or hostname if you have set one up) and see a page that states "It works!" (the default apache2 page)
Now we need to test that PHP is installed and running, do so by navigating to your web directory and opening a new file with these commands:
cd /var/www nano phpinfo.php
An editor window should now be visible in your console, type or copy the following PHP into that file:
<?php phpinfo(); ?>
Now you can visit that URL from your web browser and see the PHP configuration information. Navigate your browser to http://<your_linode_ip>/phpinfo.php [replace <your_linode_ip> with your actual Linode IP address.]
And you are done!
You should probably delete the phpinfo.php file (as it does have some information that should be considered private)
Optional Extras:
You may also want to install PHPMyAdmin, which will allow you to easily admiistrate MySQL, the package name is phpmyadmin, and can be installed with "apt-get install phpmyadmin"
Have a question? Want to follow me? I'm on twitter!
etPosted on August 8, 2010
One of the most amazing physics engines I’ve ever seen
via crunchgear.comThis has to be one of the coolest physics engines that I have ever seen.
Posted on August 8, 2010