{"id":161,"date":"2015-05-13T16:56:19","date_gmt":"2015-05-13T16:56:19","guid":{"rendered":"https:\/\/www.prolimehost.com\/blogs\/?p=161"},"modified":"2015-05-13T16:59:16","modified_gmt":"2015-05-13T16:59:16","slug":"how-to-create-vps-out-of-physical-server-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/www.prolimehost.com\/blogs\/how-to-create-vps-out-of-physical-server-step-by-step-guide\/","title":{"rendered":"How to Create VPS out of Physical Server \u2013 Step by Step Guide"},"content":{"rendered":"

This tutorial will guide you how to install and configure your own VPS (virtual private server) machine on a physical Linux server. As a common practice, the physical server comes up with the minimum Operating System installed on it. Try to order a server with Centos 5 or the latest version.<\/p>\n

We assume that you have a server with Centos 6 minimal operating system on it. We will be using OpenVZ for virtualization to create virtual servers. The server machine should have at least 2 Gbs or better memory to handle the virtual machines on it. The machine with more memory and CPU can handle more virtual servers on it. Typically the server is sliced on the bases of the memory installed on it. For example a server machine with 16 GBs of RAM could be sliced upto 8 to 16 virtual boxes.<\/p>\n

OpenVZ is free under the GNU open-source license. It is a container based virtualization system, where each container executes separately and independently\u00a0of<\/u>\u00a0the\u00a0Linux<\/u>\u00a0box with its own file system and control management system. OpenVZ is widely used by the VPS companies to share the memory and other resources economically .<\/p>\n

 <\/p>\n

Step 1: Adding Repository<\/u><\/strong><\/p>\n

First of all we will add the OpenVZ repository to our physical machine to install the important software’s.<\/p>\n

\u00a0wget -P \/etc\/yum.repos.d\/ https:\/\/ftp.openvz.org\/openvz.repo<\/p>\n

rpm –import https:\/\/ftp.openvz.org\/RPM-GPG-Key-OpenVZ<\/p><\/blockquote>\n

\u00a0<\/strong><\/p>\n

Step 2: Installation of OpenVZ Kernel<\/u><\/strong><\/p>\n

Install a the OpenVZ kernel to support virtual boxes using the repository.<\/p>\n

yum install vzkernel<\/p>\n

 <\/p>\n

Step 3: Kernel Configuration<\/u><\/strong><\/p>\n

Configure kernel parameters to support virtualization by editing the sysct.conf file.<\/p>\n

i \/etc\/sysctl.conf<\/p>\n

# On Hardware Node we generally need<\/p>\n

# packet forwarding enabled and proxy arp disabled<\/p>\n

net.ipv4.ip_forward = 1<\/p>\n

net.ipv6.conf.default.forwarding = 1<\/p>\n

net.ipv6.conf.all.forwarding = 1<\/p>\n

net.ipv4.conf.default.proxy_arp = 0<\/p>\n

# Enables source route verification<\/p>\n

net.ipv4.conf.all.rp_filter = 1<\/p>\n

# Enables the magic-sysrq key<\/p>\n

kernel.sysrq = 1<\/p>\n

# We do not want all our interfaces to send redirects<\/p>\n

net.ipv4.conf.default.send_redirects = 1<\/p>\n

net.ipv4.conf.all.send_redirects = 0<\/p>\n

We will disable Selinux to avoid any surprises.<\/p>\n

vi \/etc\/sysconfig\/selinux<\/p>\n

“SELINUX=disabled”<\/p>\n

Install necessary OpenVZ tools via yum before rebooting the machine.<\/p>\n

yum install vzctl vzquota ploop<\/p>\n

Reboot the machine to load OpenVZ kernel<\/strong><\/p>\n

Now you have loaded the virtualization environment, you are ready to create virtual machines.<\/p>\n

Download the ready-made templates from the OpenVZ repository to create the virtual machines. You can download the precreated OS templates from download.openvz.org\/template\/precreated <\/a>the path to templates:<\/p>\n

cd \/vz\/template\/cache\/<\/p>\n

Lets download centos 6 template<\/p>\n

wget https:\/\/download.openvz.org\/template\/precreated\/centos-6-x86_64-minimal.tar.gz<\/p>\n

Step 4: Create Our First VPS<\/u><\/strong><\/p>\n

\u00a0we will use the below command to create our first virtual machine.<\/strong><\/p>\n

\u00a0<\/strong>vzctl create [ID number] –ostemplate [template name] –config basic<\/p>\n

\u00a0<\/strong><\/p>\n

ID number : any number from 1- 100<\/em><\/p>\n

ostemplate: Precreated Operating system <\/em><\/p>\n

template name: The name of downloaded precreted OS template<\/em><\/p>\n

config: give the configuration file name<\/em><\/p>\n

\u00a0<\/em><\/p>\n

OpenVZ comes up with sample configuration files to give you a kick-start found in \/etc\/vz\/conf<\/p>\n

You can use basic , bight or unlimited sample configuration to create your first virtual machine.<\/p>\n

 <\/p>\n

We will use basic configuration to create our first container.<\/strong><\/p>\n

vzctlcreate 123 –ostemplate centos-6-x86 –config basic<\/strong><\/p>\n

\u00a0<\/strong><\/p>\n

Step 5: Necessary VPS Configuration<\/u><\/strong><\/p>\n

Now we will configure the virtual server for necessary settings to make it online.<\/p>\n

Configure the VPS<\/strong><\/p>\n

Give a name to the virtual machine.<\/p>\n

vzctl set 123 –hostname vps1.linuxbox.com –save<\/p>\n

Give it an IP address<\/p>\n

vzctl set 123 –ipadd 33.54.2.2 –save<\/p>\n

Set the VPS to become online automagically on the reboot:<\/p>\n

vzctl set 123 –onboot yes –save<\/p>\n

It is important to add working name server to to make it online:<\/p>\n

vzctl set 123 –nameserver 8.8.8.8 \u2013save<\/p>\n

vzctl set 123 –nameserver 8.8.4.4\u2014save<\/p>\n

Here we go, we are almost ready to take our newly created VPS online.<\/p>\n

 <\/p>\n

Assign Root Password to the machine.<\/p>\n

vzctl exec 123 passwd<\/p>\n

You will be prompted to set the root password.<\/p>\n

 <\/p>\n

Start OpenVZ VPS<\/u><\/strong><\/p>\n

We will run the below command to start our VPS:<\/p>\n

vzlist -a <\/em>\u00a0It will list down the number of virtual machines<\/p>\n

vzctl start 123<\/em><\/p>\n

 <\/p>\n

Installation of Cpanel on Newly Created VPS<\/u><\/strong><\/p>\n

\u00a0<\/em><\/strong>Since the new container has the precreated Centos OS 6. We will install cpanel on the virtual machine.<\/p>\n

Login to the machine:<\/p>\n

vzctl enter 123<\/p>\n

Enter the root password to log in.<\/p>\n

cd \/root<\/em><\/p>\n

\u00a0wget -N https:\/\/httpsupdate.cpanel.net\/latest<\/em><\/p>\n

\u00a0sh latest & <\/em>it will take some time to complete. Once the cpanel is installed, you can access it using the Ip address and the port.<\/p>\n

Http:\/\/youripadress:2086<\/a> , https:\/\/yourip\/whm<\/a> , https:\/\/yourip\/whm<\/a><\/p>\n

Voila, we are ready with our first virtual private server. You can create more vps using the same processes.<\/p>\n

 <\/p>\n

Some Helpful Commands<\/u><\/strong><\/p>\n

vzlist -a\u00a0\u00a0 (list all virtual servers)<\/em><\/p>\n

vzlist start\/stop\/restart ID ( start\/stop\/restart a server)<\/em><\/p>\n

vzctl set [ID] –diskspace [soft limit]:[hard limit] (change disk space)<\/p>\n

vzctl set [ID] –cpulimit 4 \u2013save ( assign cpu cores)<\/p>\n

vzctl destroy CTID ( destroy\/delete the virtual machine)<\/p>\n

\u00a0<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"This tutorial will guide you how to install and configure your own VPS (virtual private server) machine on…","protected":false},"author":2,"featured_media":162,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"csco_display_header_overlay":false,"csco_singular_sidebar":"","csco_page_header_type":"","footnotes":""},"categories":[1,10],"tags":[],"class_list":{"0":"post-161","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-geneal","8":"category-tutorials-tips","9":"cs-entry"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.prolimehost.com\/blogs\/wp-json\/wp\/v2\/posts\/161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.prolimehost.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.prolimehost.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.prolimehost.com\/blogs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.prolimehost.com\/blogs\/wp-json\/wp\/v2\/comments?post=161"}],"version-history":[{"count":0,"href":"https:\/\/www.prolimehost.com\/blogs\/wp-json\/wp\/v2\/posts\/161\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.prolimehost.com\/blogs\/wp-json\/wp\/v2\/media\/162"}],"wp:attachment":[{"href":"https:\/\/www.prolimehost.com\/blogs\/wp-json\/wp\/v2\/media?parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.prolimehost.com\/blogs\/wp-json\/wp\/v2\/categories?post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.prolimehost.com\/blogs\/wp-json\/wp\/v2\/tags?post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}