Hello. Today I will show you how to install a LAMP server package. LAMP meaning Linux, Apache, MySQL, and PHP. I am assuming you already have some sort of linux (Preferably Ubuntu or Debian but, it is your choice

) and will start with apache, which is pretty simple. Open a shell and type:
sudo apt-get install apache
You will need to enter your password to continue. Now for php, which is also equaly simple. Enter these commands into the shell:
sudo apt-get install php
Again, enter your password to continue. Now for MySQL.
sudo apt-get install mysql
Enter your username and pass (I just used root and root because I'm only using the DB on my localhost) and continue the installation.
Now you should be set to build apps and test on your localhost. To check browse to
http://localhost/. If you see "It Works" than apache is working. Now to check php. Open a shell and type:
gksudo nautilus (For Ubuntu)
or
gksudo konqueror (For Debian)
This command opens a root shell. Go to the root of your filesystem (Where you see the etc, var, mnt and other folders) and enter the /var/ directory. Now right click www (This is where your web files are stored) and click the "Permission" tab and change the owner of the directory to your username. Then click make changes. Now you are free to add files to the web root without using the sudo command

. Browse to the /var/www/ folder and add a file called info.php. Inside add the code:
<?php
phpinfo();
?>
Open your broswer and go to
http://localhost/info.php. If you see your php info php is ready to be used! Now for mysql -- Create a new php file in your web root named mysql.php and inside add this code:
<?php
$mysql_con = mysql_connect('localhost','root','root');
if (!$mysql_con)
{
die('Database connection failed: ' . mysql_error());
}
else
{
echo 'Connection successful!';
}
?>
This code does the following:
Uses mysql_connect() to attempt to connect to the DB at the localhost using root as username and root as password. If an error occurs it echo's Database connection failed: along with the mysql error. If the connection is successful than the script echo's 'Connection successful!'. Now test it out of course!
If all the previous test worked than your ready to start testing and creating web apps on your localhost!
I hope you learned a bit of linux, managing a server, and maybe even some coding from this tutorial.
I will be making more tutorials on managing your web server, coding web apps, making hacking challenges, and code audits

.
Thanks for reading.