LAMP Tutorial for Debian and Ubuntu
You’ve always wanted to set up LAMP on your Debian/Ubuntu server but never knew how, right? Well, now you can. We’ll walk you through setting up LAMP on your server step by step.
Let’s start off by installing Apache 2 and PHP 5.
On Debian:
apt-get install apache2 php5 libapache2-mod-php5
On Ubuntu:
sudo apt-get install apache2 php5 libapache2-mod-php5
Once this has run, you will now have accomplished the “LAP” part of “LAMP”. Apache and PHP are now installed, and since you’re on Debian/Ubuntu, Linux is done too.
Let’s test out your PHP set up and make sure it’s working.
Run:
cd /var/www
echo “<? phpinfo(); ?>” > index.php
That command will create index.php with inside of it.
Visit http://yourip/index.php, you should see a PHP info page. If so, you’re good to go.
Now, let’s install MySQL to finish this job up. The following will install MySQL 5 and the PHP module for it.
On Debian:
apt-get install mysql-server mysql-client php5-mysql
On Ubuntu:
sudo apt-get install mysql-server mysql-client php5-mysql
Once this is done, the actual LAMP setup is finished. Now it’s time for a few little tweaks. We strongly recommend setting a MySQL root password. To set a MySQL root password, there’s a simple command to run:
mysqladmin -u root password NEWPASSWORD
Once this is set, restart Apache and your setup is finished.
The command to restart Apache is:
/etc/init.d/apache2 restart
Your LAMP setup is ready to go! Good luck.
DirectAdmin Install Guide On CentOS
Installing DirectAdmin is also an extremely simple process to do.
To install DirectAdmin, you need some packages before hand. Run:
yum update -yyum install gcc-c++ gcc automake -y
At this point, it’s time to make sure nothing is preinstalled on your server, and if it is, it’s time to remove it.
Run:
yum remove httpd* php* mysql* -y
Your server is now prepared to install DirectAdmin, so let’s begin.
Run:
wget http://directadmin.com/setup.sh
chmod +x setup.sh
sh setup.sh
DirectAdmin’s setup has a few more things you need to fill in before it actually begins the installation process. When you run the install, this is a sample of what you will see:
Please enter your Client ID :
Please enter your License ID :
Please enter your hostname \(server.domain.com\)
It must be a Fully Qualified Domain Name
Do *not* use a domain you plan on using for the hostname:
eg. don’t use domain.com. Use server.domain.com instead.
Do not enter http:// or www
Enter your hostname (FQDN) :
Is this correct? (y,n) :
Is eth0 your network adaptor with the license IP? (y,n) :
Is xx.xx.xx.xx the IP in your license? (y,n) :DirectAdmin will now be installed on: Enterprise 5
Is this correct? (must match license) (y,n) :You now have 2 options for your apache/php setup.
1: customapache: older, more tested. Includes Apache 1.3, php 4 and frontpage.
2: custombuild 1.1: newer, less tested. Includes any Apache version, php 4, 5, or both in cli and/or suphp. Frontpage not available with Apache 2.x.
Post any issues with custombuild to the forum: http://www.directadmin.com/forum/forumdisplay.php?f=61Enter your choice (1 or 2):
You need to enter the client ID and license ID here. The hostname is unimportant, you can set it to whatever you would like. If you are using Virtuozzo, you need to set your network adapter to venet0:0 or the appropriate device with the licensed IP address. We recommend option 1 for customapache. When you finish the interactive part, kick back and relax while it installs. Good luck with your installation!
cPanel Install Guide
Installing cPanel is a very simple and painless process to do. If you get a cPanel license after you get your server and want to install it yourself, this tutorial will show you how to do that.
We recommend verifying your license details before installing to avoid problems.
Visit http://verify.cpanel.net to verify that your IP has the proper licensing necessary to install it.
There are a few prerequisites that need to be addressed before installing.
On CentOS:
yum install gcc gcc-c++ make -y
As soon as these prerequisites have been installed, it’s now time to install cPanel. The steps to install cPanel are:
wget http://layer1.cpanel.net/latest
chmod +x latest
sh latest
When this process has started, kick back and relax. There’s nothing left for you to do except wait for it to finish.
Webmin install guide
Installing Webmin on a server is pretty painless; however, to install it, you must have root access to the server.
To download it:
cd /root
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.420.tar.gz
You have now downloaded webmin. The installation of Webmin takes about fifteen seconds once you untar the tarball and run the script.
To install Webmin, you need to run the following commands:
tar -xf webmin-1.420.tar.gz
cd webmin-1.420
sh setup.sh
Once this is done, you just need to make sure Webmin has started, and you can visit by going to http://ipaddress:10000.
Backing up a cPanel Account via SSH
This tutorial is going to go over the simple and easy way to back up a cPanel account via SSH, as to avoid using WHM altogether. This may come useful in situations where you may not be able to get to a browser right away, or just don’t want to bother loading one up.
(NOTE: This tutorial requires root access to the cPanel machine you are running this on.)
For this tutorial, the username we are going to be using for the demonstration will be hrealm.
We start off by connecting to the server via SSH, and elevating your privileges to root.
su root
Next, you will want to enter the cPanel scripts directory. When you have time, feel free to look through the cPanel scripts directory as well, as there are plenty of different scripts that may come handy from time to time. However, use these scripts with caution, as the wrong script can break your cPanel irreversably.
cd /scripts
You will run the script that will package up the user account. This will make a current backup of SQL databases, cPanel settings, passwords, and any other user data.
./pkgacct hrealm
After the script finishes, the backup is written to the user’s home directory, which in this case would be /home/hrealm. At this point you may download the backup via SFTP or other means.
Restoring a backup
What use is making a backup if you can’t restore it? Well this part is going to go over the basics of restoring a backup while still in SSH.
We will assume you’ve uploaded the backup to a new server in /root. Now, depending on your cPanel installation, the search path for the restore script may vary. On a default installation, the search path is /home,/usr/home,/web,/home2,/home3,/root,/usr. You can place the backup into any of those folders, and the restore script will find it.
Next you will return to the scripts folder while as root.
cd /scripts
You will run the restore script, while only entering the user name. The restore script knows how to interpret the filename of the backup file, so you do not have to provide the filename to the restore script.
./restorepkg hrealm
After a few minutes or so, the account should be restored and ready to go. As simple as that, the account is restored.

