LinuxHelps.com

A blog for Linux Lovers.

Archive for the ‘vps’ Category

Posted by sibu on September 20, 2009

VPS creation commands.

VPS Creation

# vzctl create VEID –ostemplate osname
# vzctl set VEID –ipadd a.b.c.d –save
# vzctl start VEID

Here VEID is the numeric ID for the VPS;
osname is the name of the OS template for the VE,
and a.b.c.d is the IP address to be assigned to the VE.

Example:

# vzctl create 101 –ostemplate fedora-core-5-minimal
# vzctl set 101 –ipadd 10.1.2.5 –save
# vzctl start 101

VE should be up and running now; you can see its processes

# vzctl exec VEID ps ax

To provide VEID password


# vzctl exec VEID passwd ‘username’

To enter VE give the following command:

# vzctl enter VEID
entered into VPS VEID
[ve]#

Adding ip address to a VPS and creating networking

The command syntax below to add networking to the existing VPS

# vzctl set VEID –ipadd ipaddr  –nameserver nameserverIP  –hostname hostname –save

The –ipadd parameter assigns the IP address to the first venet interface in the guest OS, the –hostname assigns the VPS its hostname, and the –nameserver parameter provides the first nameserver.


How to Assign fixed amount of RAM for the created VPS?

Here is an example of setting the VPS with a guaranteed 256 MB RAM and a maximum of 1GB RAM.

vzctl set vpsid –vmguarpages 65536 –save
vzctl set vpsid –privvmpages 262144 –save


vmguarpages ->The memory that is ‘guaranteed’ to the VPS
privvmpages -> The ‘maximum’ amount of memory that will be granted to the VPS

Replace vpsid with with the VPS_ID.

Example:

vzctl set 105 –vmguarpages 65536 –save
vzctl set 105 –privvmpages 262144 –save

Start your VPS with the command

vzctl start vpsid

Example : vzctl start 105

Posted by sibu on March 10, 2009

edquota: “Can’t write quota for /dev/vzfs”

If you see error message like this trying to manage users’ quotas inside a VE:

edquota: Can’t write quota for 32063 on /dev/vzfs: No such process
Resetting quota for admin2 to 0 Meg….Done

then probably its reason is that second-level quota limit is exceeded and user quotas above a limit were not loaded.

Please increase QUOTAUGIDLIMIT parameter value for a VE to the number
which is greater than sum of users and groups created (or supposed to be created) in a VE.

This command will show you current usage of second-level quotas in a VE #101, you may run it on a hardware node:
# wc -l /vz/root/101/etc/{passwd,group}
95 /vz/root/101/etc/passwd
107 /vz/root/101/etc/group
202 total

You may increase QUOTAUGIDLIMIT parameter using ‘vzctl’ utility on a node:
# vzctl set 101 –save –quotaugidlimit 210

To apply changes it is required to restart VE:
# vzctl restart 101

Posted by sibu on March 10, 2009

Install APF firewall into the VPS

The installation of APF requires some additional steps to be taken on the hardware node.

1. First of all, you should define which iptables modules are available for VEs.

Edit /etc/sysconfig/iptables-config file on a Virtuozzo hardware node:

IPTABLES_MODULES=”ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp”

Edit /etc/sysconfig/vz file on a Virtuozzo hardware node:

IPTABLES=”ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp”

Please note - iptables modules list in IPTABLES and IPTABLES_MODULES parameters in /etc/sysconfig/vz and /etc/sysconfig/iptables-config files should be placed in one single line, no linebreaks is allowed in this parameter.

Restart Virtuozzo. All VEs will be restarted.


# service vz restart

2. Increase ‘numiptent’ parameter for the VE you need to install APF into. This parameter limits the amount of iptables rules available for a VE. Default APF configuration requires ~200 rules. Lets set it to 400 in the example below for VE #101:


# vzctl set 101 –numiptent 400 –save

3. Install APF inside the VE. Edit /etc/apf/conf.apf inside VE, set the following parameters:
IFACE_IN=”venet0″
IFACE_OUT=”venet0″
SET_MONOKERN=”1″

4. Start APF inside the VE:
# /etc/init.d/apf start