FaltuTech.Club : Fane of Advanced Logical Thriving Utopian Technical Club

How to setup your VPS with all functionalities for website hosting.

  1.  First thing first : What is VPS?   It is allocation of resources of a server which itself acts a dedicated server. That's why it is called virtual private server. This is less powerful than dedicated server but more than a shared hosting server.
  2.  A web publisher or developer needs a VPS when his shared hosting is not able to handle a large number of users or a developer want to configure a server as he its wants.
  3.  Here I will talk about only of website hosting.  If your server is managed then you have to pay more for management done by hosting company. Managed VPS comes with control panel like cpanel or plesk. Also you don't have to do anything like below to host your website. Below are the steps for unmanaged vps only. So to setup your own unmanaged VPS follow these steps:
  4.  Find a good and reputed VPS provider: It is really very necessary that you choose a reputed provider for VPS for long term use because I personally had been through a disaster which caused all data loss of my websites. So if you want reliability you should choose a reputed hosting and if possible choose a cloud hosting which works as VPS. It would help in scalability later on. If you are from India then Milesweb.com is best for your needs with low cost VPSs and it also accept all Indian payment options.

  5.  Now your host will ask for hostname (domain), if not, do not worry just signup.We will set hostname later on ourselves. Choose CentOs as your OS when selecting OS for your VPS as it is best choice for web hosting according to industry.

  6.  After that you will get IP address and password of your server.

  7.  Now you should download a SSH client to connect to your VPS. You will be asked for user name which is usually 'root' and password which is given by VPS provider company. The best SSH Client is mobaxtrem.

  8.  Now type yum update . It will update your installation of centos. Now type reboot . It will disconnect your ssh session. Wait for around 5 minutes and try logging again through ssh client. After this we will install a control panel.

  9.  Now in my personal opinion is VESTACP.Which is best choice to starting with. It is a control panel which will allow you to host websites and what more it is free and provides letsencrypt inbuilt support. So you don't have to spend money on control panel and SSL.

  10.  You can install VestaCP by visiting their website https://vestacp.com/install/  . It would take around 15 Minutes. It will install all required softwares needed for hosting purpose.

    • There may be DNS problem occurs while downloading there script. The error will save unable resolv vestcp.com . So you have to edit file resolv.conf in etc directory by command  

      
      vi /etc/resolv.conf

      and uncomment the DNS1 and DNS2 lines by removing # and change first xxx.xxx.xxx.xxx with 8.8.8.8 and second with 8.8.4.4 and save it by pressing ESC and typing 

      :w 

      and close the file with

      !q 

      . Now reboot the system. If problem presists then you have to edit file

      /etc/sysconfig/network-config/ifcfg-eth0

      and add following lines:
      DNS1=8.8.8.8​​
      DNS2=8.8.4.4
      and save the file as stated above and reboot the system by typing

       reboot

      it should solve your DNS problem.

  11.  Now if you have been asked for hostname before installation of OS then you don't have to follow this step but if not you have to follow below steps and also if you are curious then you can read these steps. Follow Below steps to change or add hostname for your server:

     

     

    1.      Type : hostname -f      If you see your domain name then there is no problem otherwise type vi /etc/hosts  

    2.      It will open hosts file . Now press  (it will enable editing)

    3.      Now at top line which would be starting with symbol ~ type your server ip followed by your domain name with space in between. e.g.  if your ip is 102.102.103.103 and your domain is xyz.com then type

      102.102.103.103  xyz.com 

    4.     Press Esc  and type :w   . It will save you hosts file. Now to exit type :q .If it shows error then type :q! .You will taken to main ssh window. You are done with this part and try to install control panel again.

  12.  On completion you will be shown password to login to Control panel in ssh window. So use it for logging in to your Control panel and change your password once logged in. If you didn't see any password in SSH window then use your server password.

  13. After complete installation you can go to https://<your ip>:8083 to manage your server. e.g. if your ip is 102.102.103.103 then you will type in browser address bar https://102.102.103.103:8083  . Your browser may show ssl warning just continue as there is no ssl certificate installed on server. Use admin for user name and password as shown while installing or server password.

  14.  Now comes the DNS part. You have to go to your domain registrar and make two Name Server records pointing towards your server ip. Name servers must be like ns.youdomain.com and ns2.youdomain.com    where ns and ns2 could be anything. In other words you must use subdomains. You must add atleat 2 enteries in name server.

  15.  Now add these name servers records to your domains hosted on your server by editing domain settings.

  16.  If you want to use ssl then in advanced setting of domain you can activate it and check letsencrypt option and you will get a free cetificate after few minutes. You can encrypt subdomain and other domains too without buying new ip.

  17.  That's all.