Managing an Unmanaged V.P.S/ Dedi

hey guys. in the below tutorial we will be installing all the things which are needed to run a typical website.
we will be using Debian Lenny , as the operating system, and will be installing and configuring the required packages , so that you can host Multiple websites on your Server.

In this guide, I assume that you have basic knowledge on how to login to your VPS/ Dedi as root user . ( if you don't know what is this, please don't try this ! )

Part 1 :

  • Updating.
  • Installing Apache2.
  • Installing MySQL.
  • Installing and Configuring PHP5 and Getting MySQL Support.
  • Virtual Hosting Configuration ( so that we can host multiple websites on the same server ).
  • Installing PHYMyAdmin.



UPDATING

Code: 
aptitude update
aptitude upgrade
Installing Apache2

Code: 
aptitude install apache2
Few Commands To Control Apache2
Start : /etc/init.d/apache2 start
Stop : /etc/init.d/apache2 stop
Restart : /etc/init.d/apache2 restart


default document root ---> /var/www/
configuration file ---------> /etc/apache2/apache2.conf


MySQL

Code: 
aptitude install mysql-server mysql-client
While the installation is in progress, you will be prompted to set a Password for root user of MySQL .. Please Type a Strong Password and make sure you don't forget it .

Starting MySQL
: /etc/init.d/mysql start
Stopping MySQL : /etc/init.d/mysql stop
Restarting MySQL : /etc/init.d/mysql restart


PHP5 with MySQL Support

Code: 
 aptitude install php5 libapache2-mod-php5 php5-mysql php5-curl php5-gd
Next we restart apache2 and MySQL server so that the new configuration will take into effect.

Restarting MySQL : /etc/init.d/mysql restart
Restarting Apache2 : /etc/init.d/apache2 restart

Virtual Hosting : ( hosting multiple websites )

lets say , that I want to Host
www.thisismysite.com and www.lolwtfzomg.com ..
and the IP of my server is 100.200.300.400 ( just and example )


Its always advised to keep the directories that we host the sites on in an well organised manner..

We now tell Apache2 to listen to only the desired IP address ( 100.200.300.400 in my case )

now by using your favourite editor, edit /etc/apache2/ports.conf
Code: 
nano /etc/apache2/ports.conf
if you don't have nano..I advice you to install it
Code: 
aptitude install nano
and change NameVirtualHost *:80 to

Code: 
NameVirtualHost 100.200.300.400:80
Replace 100.200.300.400 with your IP !

and now we edit , the default apache2's virtual host to our needs..
change <VirtualHost *:80>
to <VirtualHost 100.200.300.400:80>
and make sure you replace 100.200.300.400 with your IP .

Now we are ready to Host websites , as told above I want to host
www.thisismysite.com
and
www.lolwtfzomg.com

so lets create the Directories in an well organised manner,

Code: 
mkdir -p /srv/www/thisismysite.com/public_html
mkdir -p /srv/www/thisismysite.com/logs

mkdir -p /srv/www/lolwtfzomg.com/public_html
mkdir -p /srv/www/lolwtfzomg.com/logs
Next we create the virtual config file for each site in /etc/apache2/sites-available/

Code: 
nano /etc/apache2/sites-available/
and place the following code in it

Code: 
<VirtualHost 100.200.300.400:80>
     ServerAdmin desiboy@thisismysite.com
     ServerName thisismysite.com
     ServerAlias thisismysite.com
     DocumentRoot /srv/www/thisismysite.com/public_html/
     ErrorLog /srv/www/thisismysite.com/logs/error.log
</VirtualHost>
obviously you have to edit it for your needs..

and the next site lolwtfzomg.com

Code: 
 nano /etc/apache2/sites-available/lolwtfzomg.com
and place the code into it..


Code: 
<VirtualHost 100.200.300.400:80>
     ServerAdmin desiboy@lolwtfzomg.com
     ServerName lolwtfzomg.com
     ServerAlias www.lolwtfzomg.com
     DocumentRoot /srv/www/lolwtfzomg.com/public_html/
     ErrorLog /srv/www/lolwtfzomg.com/logs/error.log
</VirtualHost>
again, edit the above code for your needs..

Enabling sites
Code: 
a2ensite thisismysite.com
a2ensite lolwtfzomg.com
we have to reload Apache2 so that all the above setting takes place..

Code: 
/etc/init.d/apache2 reload
PHPMyAdmin
Code: 
aptitude install phpmyadmin
you will be prompted to select the type of web server, Please select Apache2 and click ok..

and we will be editing apache2 config , and tell the path of phpmyadmin to it..

Code: 
echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
Now you can Open PHPMyAdmin from your Browser using

http://100.200.300.400/phpmyadmin/


Now the contents of the thisismysite.com, should we uploaded in
/srv/www/thisismysite.com/public_html/

and that of lolwtfzomg.com in.
/srv/www/lolwtfzomg.com/public_html/

you can use wget or use rsync to upload the content on the sites ATM..
in Next Update of this tutorial we will be dealing about Installing FTP and configuring it..followed by some more useful tools like firewall, etc..


Thanks for reading..and if you have anything to suggest , correct, please reply below..
and please leave a link back to This thread..whenever you post this tutorial in other sites .. ( took some time to write this )

TRY AT YOUR OWN RISK ! and if you have any doubt , please post here..I will try to answer..
desiboy Reviewed by desiboy on . Hosting Websites without any control panel on your VPS /DEDI Managing an Unmanaged V.P.S/ Dedi hey guys. in the below tutorial we will be installing all the things which are needed to run a typical website. we will be using Debian Lenny , as the operating system, and will be installing and configuring the required packages , so that you can host Multiple websites on your Server. In this guide, I assume that you have basic knowledge on how to login to your VPS/ Dedi as root user . ( if you don't know what is this, please don't try this ! ) Part Rating: 5