Showing posts with label Virtuzzo. Show all posts
Showing posts with label Virtuzzo. Show all posts

Wednesday, March 19, 2008

How do I enable quotas on my RedHat server with no control panel?

As the root user, edit file /etc/fstab to add qualifier "usrquota" or "grpquota" to the partition you want quotas enabled for as shown below:
/dev/hda2 /home ext3 defaults,usrquota,grpquota 1 1


This enables user and group quotas support on the /home file system.
You can finish initializing quota support by simply rebooting your server. If a reboot isn't a viable option at the moment, you can also follow the instructions listed below:
1. Remount changed filesystems
To remount a specific filesystem: mount -o remount (ex. mount -o remount /dev/hda2)
2. Create aquota.user and aquota.group for quota accounting.
To create the aquota.user and aquota.group files which keep track of quotas, run the following command:
quotacheck -vguma
This command may take awhile to run as it scans any quota enabled filesystems to build the quota accounting files.
3. Enable quota account process.
To enable the quota accounting process which keeps tabs on user/group usage activity as it occurs and updates the aquota.user and aquota.group files, run this command:
quotaon -av
Your linux filesystem(s) should now be quota-enabled.

Your linux filesystem(s) is now quota enabled.

I have lost my MySQL root password, how can I get in?

• Stop the mysqld daemon process.
• Start the mysqld daemon process with the --skip-grant-tables option.
• Start the mysql client with the -u root option.
• Execute the UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
• Execute the FLUSH PRIVILEGES; command

How exactly does the VZ installer format the /vz partition?

Pavel Kostyuk, of SWSoft, posted the following information in the SWSoft forums(thread).
It is summarized here for your benefit. Basically, when Virtuozzo is installed on Linux,
the following options are used to format the VZ partition:


# mke2fs -i 1024 -b 1024 -j /dev/device


That is a block-size of 1024 bytes, with 1024 bytes per inode. This gives the most optimal
relation of blocks to inodes for a VPS installation.

What do I do if /var partition is constantly running out of space?

Make sure your log rotation scripts are configured and working properly. If you've disabled crond for some reason it's likely that none of the log files in /var/log are being compressed and periodically deleted. Another commonly filled directory is /var/spool/mail. If you seldom or never check mail on your server this could consume considerable amounts of space. Make sure you either forward that mail to an address you'll read or read it from the server directly. In either case you will have to delete files before any compression can take place. Be aware that large files may not fit into temporary space so keeping /var tidy can be critically important.

How do I install APF or any other firewall configuration GUI into the VPS?

First of all you should define which iptables modules are available for VPSes.

Edit /etc/sysconfig/iptables-config and /etc/sysconfig/vz on the hardware node, abd add the modules you need into IPTABLES_MODULES= and IPTABLES= lines correspondingly.

For example, a typical firewall configuration requires the following modules:

ipt_REJECT ipt_tos ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_conntrack

The changes will be applied after you restart the vz on the hardware node.

You can also define a list of iptables modules for each VPS using --iptables option of the vzctl utility thusly:

vzctl set 101 --iptables iptable_filter --iptables ipt_length --iptables ipt_limit --iptables iptable_mangle --iptables ipt_REDIRECT --iptables ipt_REJECT --iptables iptable_nat --iptables ipt_state --iptables ip_conntrack --save

You will probably also need to increase the barrier of the numiptent parameter in /proc/user_beancounters using the vzctl utility. This parameter limits the amount of iptables rules which VPS owners are allowed to create.

If you wish to run APF inside of a VPS, be sure that APF is configured with MONOKERN=1.

How do I create a VPS with Plesk?

Virtuozzo is shipped with sample configuration files that can be used for Plesk VPS creation. These samples
can be found in /etc/sysconfig/vz-scripts/ directory on the hardware
node (ve-vps.plesk7.fc1.conf-sample, ve-vps.plesk7.fc2.conf-sample, ve-vps.plesk7.rh9.conf-sample). They contain resource limits for Plesk and a list of prerequisities for Plesk (mysql, php, mod_perl, mod_ssl, mod_frontpage) which will be installed automatically after VPS creation.

To create VPS #101 using one of these configuration files, use:

vzctl create 101 --config vps.plesk7.fc2 --pkgset fedora-core-2

To apply a configuration sample to an already created VPS, use the --applyconfig option.

After you have created a VPS, install the corresponding version of Plesk there:

vzpkgadd 101 psa-fc2

The same operations can be done using the Virtuozzo Management Console.

How do I change a VE's ip address?

To change a VE's IP address, you can ssh into the server, you may either edit /etc/sysconfig/vz-scripts/$VEID.conf, or you may run the following two commands (we'll use VE 102 with an IP of 1.2.3.4 as an example):

vzctl set 102 --ipdel 1.2.3.4 --save
vzctl set 102 --ipadd 2.3.4.5 --save

How do I mount /tmp on VPSes with noexec,nosuid options?

The idea is to create a separate file which will contain a filesystem for /tmp directories for all VPSes and mount that file as a loop device using noexec,nosuid options.

It can be done thusly:

1) Create a special file, and create a filesystem inside that file and mount it:

# dd if=/dev/zero of=/vz/tmpVE bs=1k count=2000000
# losetup /dev/loop0 /vz/tmpVE
# mkfs.ext2 /dev/loop0
# mkdir /vz/tmpVEs
# mount /dev/loop0 /vz/tmpVEs -o noexec,nosuid,nodev,rw

2) Add the following lines into /etc/sysconfig/vz-scripts/dists/scripts/postcreate.sh:

function vztmpsetup()
{

VEID=`basename $VE_ROOT`

cp /etc/sysconfig/vz-scripts/new.mount /etc/sysconfig/vz-scripts/$VEID.mount
cp /etc/sysconfig/vz-scripts/new.umount /etc/sysconfig/vz-scripts/$VEID.umount

if [ "$" != "" ]; then
[ -d /vz/tmpVEs/$ ] && rm -rf /vz/tmpVEs/$VEID/*
fi

chmod 755 /etc/sysconfig/vz-scripts/$VEID.mount
/etc/sysconfig/vz-scripts/$VEID.umount

}

vztmpsetup

exit 0

3) Create "/etc/sysconfig/vz-scripts/new.mount":

#!/bin/bash
#
# if one of these files does not exist then something is really broken
[ -f /etc/sysconfig/vz ] || exit 1
[ -f $VE_CONFFILE ] || exit 1
[ -f /etc/sysconfig/vz-scripts/$VEID.conf ] || exit 1
# Source configuration files to access $VE_ROOT
. /etc/sysconfig/vz
. $VE_CONFFILE
[ -e /vz/tmpVEs/$VEID ] || mkdir /vz/tmpVEs/$VEID
mount --bind /vz/tmpVEs/$VEID $VE_ROOT/tmp

4) Create "/etc/sysconfig/vz-scripts/new.umount":

#!/bin/bash
# if one of these files does not exist then something is really broken
[ -f /etc/sysconfig/vz ] || exit 1
[ -f $VE_CONFFILE ] || exit 1
# Source configuration files to access $VE_ROOT
. /etc/sysconfig/vz
. $VE_CONFFILE
# Unmount shared directory
if grep "/vz/root/$VEID/tmp" /proc/mounts >/dev/null; then
umount $VE_ROOT/tmp
fi

5) Add the following lines into "/etc/rc.sysinit":

losetup /dev/loop0 /vz/tmpVE
mount /dev/loop0 /vz/tmpVEs -o noexec,nosuid,nodev,rw

Any operation on a VPS gives me "Cannot lock VE". How do I solve it?

A VPS is locked when some operation (backup, migration, start / stop, etc.) with that VPS is in progress. You can determine which process is holding VPS #101 using the following command on the hardware node:

cat /vz/lock/101.lck

You can kill that process if needed, but make sure that the process is really killed. If there is no process with that PID on the node, just remove the lockfile.

How do I determine on which VPS a process is running on?

You must first know the PID of the process you want information on. After that, you can run the vzpid utility thusly (using PID 10031 as an example):

# vzpid 10031
Pid VEID Name
10031 113 httpsd

How do I automate backup operations in Virtuozzo?

VPS backups can be created using the vzbackup utility, it should be run on the backup node. You can restore any backup using the vzrestore utility.

To configure vzbackup, you should do the following actions:

Check the global vzbackup configuration file /etc/vzbackup.conf file on the backup node for backup parameters (pay attention to the $BACKUP_DIR parameter).

If you are going to make backups using a cronjob, set the following parameters:

# Backup directory - where the backups will be stored, e.g

BACKUP_DIR="/vz/backups"

# backup type. Supported types are "full", "initial incremental" and
# "incremental". Default is incremental. If it is impossible to do
# "incremental" then "initial incremental" will be done.

BACKUP_TYPE="i"

# Backup cron mode

CRON_BACKUP="yes"

# List of nodes to backup.

BACKUP_NODES=""

# e-mails to send notifications about backup

BACKUP_NOTIFY_EMAIL="root@myserver.com"

Be sure to create the directory:

mkdir /vz/backups

And add the following command to the crontab on the backup node:

vzbackup -i -p -a

Also, you will need to make sure that the root user is able to access all hardware nodes without a password. This can be completed through propogating a DSA public key.

How do I change system time or timezone in a VPS?

You cannot change system time in a VPS because all VPSes on the hardware node have the same system time. However it is possible to change the default system timezone inside a VPS, for example, by replacing /etc/localtime with the file from /usr/share/zoneinfo which contains a description of your timezone.

How do I move a VPS from one server to another?

You can use the vzmigrate utility for moving a VPS from one server to another. Here is an example of moving VPS #101 to hardware node 192.168.0.1:

vzmigrate -r no 192.168.0.1 101

If VPS #101 already exists on the destination node, you can assign new ID to a VPS using:

vzmigrate -r no 192.168.0.1 101:102

The same can be also done using the Virtuozzo Management Console.

How do I solve problems with connecting to some mail servers from a VPS?

One of the possible reasons for this problem is that many firewalls refuse connections from servers with enabled TCP ECN (Explicit Congestion Notification). To access a site behind such a firewall you will need to disable ECN on the hardware node by running:

sysctl -w net.ipv4.tcp_ecn=0

and adding the following line into /etc/sysctl.conf:

net.ipv4.tcp_ecn = 0

How do I login into VPS without knowing its root password?

As the hardware node administrator, to log into a VPS, you may issue the following command:

# vzctl enter 101

To run a command inside a VPS, you may use the vzctl command thusly (using VE 101 and /bin/ls as examples):

# vzctl exec 101 /bin/ls

If you need to ssh into VPS 101 as root, you can add a user with UID=0 to /vz/root/101/etc/passwd and set a password for that user using:

# vzctl exec 101 passwd username

How do I check the apache version on my server?

In the default configuration, Apache will be set to display the version information
on most of your error pages. The easiest way to verify what version of Apache
you have, is to visit a link to a file that does not exist. Such as http://domain.com/unknownfile.txt

If for whatever reason, you do not see the version listed, you can find out from
the command line.

You will want to run the binary with the -v option. This will give you a short response,
that includes both the version number, and the date the binary was built.

How do I install gcc inside of a VPS?

You must install the -devel package for that OS template. For example, for VPS #101 based on Fedora Core 2, run the following command on the hardware node:

# vzpkgadd 101 devel-fc2

How do I download application templates for my VPS?

Both OS and application templates can be downloaded, using SWSoft's vzup2date utility. When
your server is handed over to you, vzup2date is ready to use. You will need to open an ssh shell
to your server to use vzup2date. Once logged in, run the following command:
vzup2date -?

This will give you a brief explanation of the usage:
[root@pascal root]# vzup2date -?
Usage: vzup2date [OPTION...]
-s, --system update Virtuozzo itself
-t, --templates update OS and application templates for Virtuozzo

Help options:
-?, --help Show this help message
--usage Display brief usage message
[root@pascal root]#

From here, all you need to do is use the correct syntax to update your templates. Run the following
command to update both OS and Application templates:
vzup2date -t
You will be prompted by a screen similar to this:


-------------------- Welcome to system update ------------------
| |
| The Virtuozzo up-to-date utility will help you update your |
| Virtuozzo installation by means of latest Virtuozzo |
| packages located on the SWsoft website.After updating, you |
| will be able to find the update log in the |
| /var/log/vzup2date file. |
| |
| -------- -------- |
| | Quit | | Next | |
| -------- -------- |
| |
| |
----------------------------------------------------------------
Tab over to next, and press to get to the next page. On the next page you will be able
to change the url that vzup2date is using to update:
-------------------------- Repository --------------------------
| |
| In the fields below, provide the URL of the repository |
| where the updated packages are located. These fields might |
| already be filled in according to the information in the |
| /etc/sysconfig/vzup2date/vzup2date.conf configuration |
| file. However, you may change this information at your |
| discretion. |
| |
| URL: https://vzup2date.swsoft.com____________ |
| Login: username________________________________ |
| Password: ******__________________________________ |
| Proxy: ________________________________________ |
| Proxy login: ________________________________________ |
| Proxy password: ________________________________________ |
| |
| [*] Save configuration |
| |
| -------- -------- -------- |
| | Quit | | Back | | Next | |
| -------- -------- -------- |
| |
| |
----------------------------------------------------------------
Please ensure that the url listed is as above. SWSoft changed urls recently, and the older sw-soft.com
domain no longer works for vzup2date.

From here, it is just a matter of selecting what templates you want to update, and letting it download them.

How can I install cpanel within a VPS?

How can I install cpanel within a VPS?

1 The yum package MUST be installed before installing, the installer will not run without it. (centos/rhel/fedora/RH)



2 Add the line: "exclude=dev* udev* spamassassin* httpd* mod_ssl* perl* mysql* php* kernel*"

to /etc/yum.conf



3 Run rpm -qa and look for any entries beginning with "httpd" "mod_ssl" "mysql" "openldap" (if you wish to install openldap, you can install it later, installing it at this time, will cause problems with exim) & "php" and then use rpm -e to remove them (and all their dependencies).



4 RPMs that conflict with the cpanel services can be set to not install by editing /vz/template/distroname/distroversion/config/ostemplate.list



5 It is of extreme usefulness to add sshd to ON_SERVICES in /vz/template/centos/4/config/install-post


6 Make sure you are logged in as root and type:

# cd /home

# wget http://layer1.cpanel.net/latest

Note: For FreeBSD, you need to download and untar the latest installer package from http://www.cpanel.net/.

# sh latest

Monday, March 10, 2008

How do I automate backup operations in Virtuozzo?

How do I automate backup operations in Virtuozzo?
VPS backups can be created using vzbackup utility. It should be run on the backup node. You can restore any backup using vzrestore utility.To configure vzbackup you should do the following:
1. Check global vzbackup configuration file /etc/vzbackup.conf file on the backup node for backup parameters (pay attention to $BACKUP_DIR parameter).
If you are going to make backups using cronjob, set the following parameters:
# Backup directory - where the backups will be stored, e.g
BACKUP_DIR="/vz/backups"
# backup type. Supported types are "full", "initial incremental" and
# "incremental". Default is incremental. If it is impossible to do
# "incremental" then "initial incremental" will be done.
BACKUP_TYPE="i"
# Backup cron mode
CRON_BACKUP="yes"
# List of nodes to backup.
BACKUP_NODES=""
# e-mails to send notifications on backup
BACKUP_NOTIFY_EMAIL=root@myserver.com
2. Create directory
# mkdir /vz/backups
3. Add the following command to the crontab on the backup node:
# vzbackup -i -p -a
4. Make sure root user of the backup node is able to access all hardware nodes without a password (propagate DSA public keys).
How do I create VPS with guaranteed amount of RAM (256M, 512M, etc.)?
Virtuozzo is shipped with sample configuration files which allow to allocate 256, 512, 1024, or 2048 MB of memory for a VPS. These samples can be found in /etc/sysconfig/vz-scripts/ directory on the hardware node (ve-vps.256MB.conf-sample, ve-vps.512MB.conf-sample, ve-vps.1024MB.conf-sample, ve-vps.2048MB.conf-sample).
To create VPS #101 using one of these configuration files, use
# vzctl create 101 --config vps.512MB --pkgset fedora-core-2
To apply some configuration sample to already created VPS, use --applyconfig option of vzctl utility.The same operation can be done using Virtuozzo Management Console or Virtuozzo Control Center.