2/25/2011

Create and configure VPS on Linux OpenVZ

1.Create VPS. VPS means Virtual Private Server, it's the GuestOS in short. I installed CentOS 4 for VPS because there is no template of CentOS 5 for VPS.
[root@ns ~]# yum -y vztmpl-centos-4-2.0-2   # tempalte for CentOS 4
Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vztmpl-centos-4 to pack into transaction set.

vztmpl-centos-4-2.0-2.i38 100% |====================| 5.4 kB 00:00
---> Package vztmpl-centos-4.i386 0:2.0-2 set to be updated
--> Running transaction check
--> Processing Dependency: vzrpm43 for package: vztmpl-centos-4
--> Processing Dependency: vzrpm43-python for package: vztmpl-centos-4
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzrpm43 to pack into transaction set.
vzrpm43-4.3.3-7_nonptl.6. 100% |====================| 13 kB 00:00
---> Package vzrpm43.i386 0:4.3.3-7_nonptl.6 set to be updated
---> Downloading header for vzrpm43-python to pack into transaction set.
vzrpm43-python-4.3.3-7_no 100% |====================| 4.4 kB 00:00
---> Package vzrpm43-python.i386 0:4.3.3-7_nonptl.6 set to be updated
--> Running transaction check

Dependencies Resolved

===================================================================
Package Arch Version Repository Size
===================================================================
Installing:
  vztmpl-centos-4 i386 2.0-2 openvz-utils 127 k
Installing for dependencies:
  vzrpm43 i386 4.3.3-7_nonptl.6 openvz-utils 7.0 M
  vzrpm43-python i386 4.3.3-7_nonptl.6 openvz-utils 15 M

Transaction Summary
=========================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 22 M
Downloading Packages:
(1/3): vzrpm43-4.3.3-7_no 100% |====================| 7.0 MB 00:00
(2/3): vztmpl-centos-4-2. 100% |====================|   127 kB 00:00
(3/3): vzrpm43-python-4.3 100% |====================| 15 MB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing:   vzrpm43-python################################ [1/3]
  Installing:   vzrpm43################################ [2/3]
  Installing:   vztmpl-centos-4################################ [3/3]

Installed: vztmpl-centos-4.i386 0:2.0-2
Dependency Installed: vzrpm43.i386 0:4.3.3-7_nonptl.6 vzrpm43-python.i386 0:4.3.3-7_nonptl.6
Complete!
[root@ns ~]#
[root@ns ~]# vzpkgcache# generate cache

[root@ns ~]# vzpkgls# show installed template
centos-4-i386-default
centos-4-i386-minimal

# create VPS that ID is 101 with following command ( it's impossible to use 0-100 IDs )
[root@ns ~]# vzctl create 101 --ostemplate centos-4-i386-default --config vps.basic
Creating VE private area (centos-4-i386-default)
Performing postcreate actions
VE private area was created
[root@ns ~]#
# auto start setting for VPS
[root@ns ~]# vzctl set 101 --onboot yes --save
Saved parameters for VE 101
# set IP address
[root@ns ~]# vzctl set 101 --ipadd 192.168.0.18 --save
Saved parameters for VE 101
# set hostname
[root@ns ~]# vzctl set 101 --hostname www.server-linux.info --save
Saved parameters for VE 101
# set DNS
[root@ns ~]# vzctl set 101 --nameserver 192.168.0.17 --save
Saved parameters for VE 101
# set root password
[root@ns ~]# vzctl set 101 --userpasswd root:password
Starting VE ...
VE is mounted
VE start in progress...
Changing password for user root.
passwd: all authentication tokens updated successfully.
Stopping VE ...
VE was stopped
VE is unmounted
[root@ns ~]# vzctl start 101# start VPS that has ID '101'
Starting VE ...
VE is mounted
Adding IP address(es): 192.168.0.18
Setting CPU units: 1000
Set hostname: www.server-linux.info
File resolv.conf was modified
VE start in progress...
[root@ns ~]# vzctl exec 101 service sshd start   # start sshd on VPS
Starting sshd:[  OK  ]
[root@ns ~]# vzlist# show status of VPS
 VEIDNPROCSTATUSIP_ADDRHOSTNAME
 10116running192.168.0.18www.server-linux.info
2. Install yum command for VPS because it's not installed.
# install 'yum' command on VPS from HostOS

[root@ns ~]# vzyum 101 install yum

[root@ns ~]# vzyum 101 install yum-plugin-fastestmirror

Source from (server-world.info)

2 comments:

  1. Could you describe these processes as well as little more information on programming for C + + Builder, and various programming algorithms

    ReplyDelete
  2. Nice,I am happy to see this best information. I search this from a long time...I finally get this by your blog.

    ReplyDelete