2010
07.13

Vzdump is a utility to make consistent snapshots of running OpenVZ containers. It basically creates a tar archive of the container’s private area, which also includes the container configuration files. It stores the backup on the disk in a single tar file.

Download vzdump rpm packages from http://download.openvz.org/contrib/utils/vzdump and install the rpm package on the server.

# rpm -ivh vzdump.x.x.x.rpm

How to backup container.

Simply dump CT 777 — no snapshot, just archive the container private area and configuration files to the default dump directory, usually in /vz/dump.

vzdump 777

Use rsync and suspend/resume to create a snapshot (minimal downtime).

vzdump –suspend 777

Backup all containers and send notification mails to root.

vzdump –suspend –all –mailto root

Use LVM2 to create snapshots (no downtime).

vzdump –dumpdir /space/backup –snapshot 777

Note that using LVM2 and vzdump to create snapshots requires 512Mb of free space in your VG.

How to restore the container.

Restore the above backup to CT 600:

vzrestore /space/backup/vzdump-777.tar 600

OR

vzdump –restore /space/backup/vzdump-777.tar 600

Courtesy: http://wiki.openvz.org

2010
06.27

When attempting to run the vmware vsphere client the following errors are received and is unable to login or proceed any further:

“Error parsing the server “<server name” “clients.xml” file.”

“The type initializer for ‘VirtualInfrastructure.Utils.HttpWebRequestProxy’ threw an exception.”

Follow the following easy steps and you will be ready to go.

Download this DLL called system.dll

Once downloaded install it in the “C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\Lib” directory. If the ‘lib’ directory doesn’t exist then create it and drop the dll file into it.

Next edit the “VpxClient.exe.config” file which can be found in the “C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher” directory and add the following three lines to it before the last line. Then save the changes.

<runtime>
<developmentMode developerInstallation=”true”/>
</runtime>

The file after the changes will look like below:

<?xml version=”1.0″ encoding=”utf-8″?>
<configuration>
<system.net>
<connectionManagement>
<clear/>
<add address=”*” maxconnection=”8″ />
</connectionManagement>
</system.net>
<appSettings>
<add key = “protocolports” value = “https:443″/>
</appSettings>
<runtime>
<developmentMode developerInstallation=”true”/>
</runtime>
</configuration>

From the Windows ‘System Properties’ click the ‘Advanced’ tab and then the ‘Environment Variables’ button as we want to add a new ‘System’ variable.

Create a new ‘System’ variable called ‘DEVPATH’ and assign the following variable value, or as a User variable if you are running the vsphere client as an user.

C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\Lib

You are now ready to start using the VMware vSphere Client on your Windows machine.

2010
06.11

While running freshclam in servers, you may encounter this problem.

root@linux [~]# freshclam
ClamAV update process started at Fri Jun 11 19:23:37 2010
WARNING: Your ClamAV installation is OUTDATED!
WARNING: Local version: 0.95.2 Recommended version: 0.96.1
DON’T PANIC! Read http://www.clamav.net/support/faq
ERROR: chdir_tmp: Can’t create directory ./clamav-c1140c4846ffa40c2678e2fdcd1221ee
WARNING: Incremental update failed, trying to download main.cvd
ERROR: getfile: Can’t create new file /usr/local/share/clamav/clamav-9a5f47dee827502d0a4e9cce6648aa3c in /usr/local/share/clamav
Hint: The database directory must be writable for UID 5127 or GID 5127
WARNING: Can’t download main.cvd from database.clamav.net

The issue is that the directory /usr/local/share/clamav/ is missing proper permissions. Run the following command and the freshclam command will work.

root@linux ~]# cd  /usr/local/share/; chown -R clamav.clamav clamav/
root@linux [/usr/local/share]# freshclam
ClamAV update process started at Fri Jun 11 19:23:56 2010
WARNING: Your ClamAV installation is OUTDATED!
WARNING: Local version: 0.95.2 Recommended version: 0.96.1
DON’T PANIC! Read http://www.clamav.net/support/faq
nonblock_connect: connect timing out (30 secs)
Can’t connect to port 80 of host database.clamav.net (IP: 65.120.238.5)
Trying host database.clamav.net (208.72.56.53)…
Downloading main-52.cdiff [100%]
main.cld updated (version: 52, sigs: 704727, f-level: 44, builder: sven)
WARNING: Your ClamAV installation is OUTDATED!
WARNING: Current functionality level = 43, recommended = 44
DON’T PANIC! Read http://www.clamav.net/support/faq
Trying host database.clamav.net (168.143.19.95)…
Downloading daily.cvd [100%]
daily.cvd updated (version: 11181, sigs: 95755, f-level: 51, builder: edwin)
Database updated (800482 signatures) from database.clamav.net (IP: 168.143.19.95)
root@linux [~]#

Hope this helps :)

2010
06.01

We all know that the command `sendmail -q` will flush the mails in queue. In Postfix, enter the following to flush the mail queue:

# postfix flush

Or you can use:

# postfix -f

To see mail queue, enter:
# mailq

To remove all mail from the queue:
# postsuper -d ALL

To remove all mails in the deferred queue:
# postsuper -d ALL deferred

2010
05.31

Installing PHP5 Memcache Extension Module in Linux.

Prerequisite Install

* Download & install libevent (memcached dependency)
wget http://www.monkey.org/~provos/libevent-1.4.8-stable.tar.gz
tar xfz libevent-1.4.8-stable.tar.gz
cd libevent-1.4.8-stable
./configure && make && sudo make install

* Create a symlink to libevent
ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib

* Download & install memcached
wget http://danga.com/memcached/dist/memcached-1.2.6.tar.gz
tar xfz memcached-1.2.6.tar.gz
cd memcached-1.2.6
./configure && make && sudo make install

* Run memcached as a daemon (d = daemon, m = memory, u = user, l = IP to listen to, p = port)
memcached -d -m 1024 -u root -l 127.0.0.1 -p 11211

You can see Installing Memcache Extension for PHP here.

Test Install

Create a file ‘memcache_test.php’ in your webroot and paste the following:

<?php
$memcache = new Memcache;
$memcache->connect(‘localhost’, 11211) or die (“Could not connect”);

$version = $memcache->getVersion();
echo “Server’s version: “.$version.”<br/>\n”;

$tmp_object = new stdClass;
$tmp_object->str_attr = ‘test’;
$tmp_object->int_attr = 123;

$memcache->set(‘key’, $tmp_object, false, 10) or die (“Failed to save data at the server”);
echo “Store data in the cache (data will expire in 10 seconds)<br/>\n”;

$get_result = $memcache->get(‘key’);
echo “Data from the cache:<br/>\n”;

var_dump($get_result);
?>

# Test to see if the file renders in your browser

Cheers!

2010
05.31

Let’s determine the PHP version installed and also make sure it is in system path.

1. type php -v on you shell, it should show something like PHP 5.2.6 (cli) (built: some date)
2. type whereis php to get the path where PHP is installed in your system.
3. In your accounts home directory create/edit ‘.profile’ file and add ‘export PATH=$PATH:/usr/local/bin‘ where ‘/usr/local/bin‘ is the folder where php executable is installed.

Install PEAR, type following sequence of commands on your shell

1. wget http://pear.php.net/go-pear -O go-pear.php
2. php go-pear.php and follow the installation instructions
3. ls -l ~/.pearrc
4. edit the ‘.profile‘ (again) and add export PATH=/home/yourname/pear/bin:$PATH

Finally Install Memcache

1. type pecl install memcache on your shell, it will install memcahce extension for PHP.

Edit php.ini to add ‘extension=memcache.so‘, to find the exact php.ini file used by your system

1. php -i | grep ‘php.ini’

Restart apache, and you are done  type one of the commands below to do that

1. /etc/init.d/apache  restart , or
2. service httpd restart

2010
05.29

VPN support for a VPS Hosting via the TUN/TAP device is available. To allow VE #700 to use the TUN/TAP device, the following steps are required:

* Make sure the tun module has been already loaded on the hardware node:

lsmod | grep tun

If it is not there, then issue the command ‘modprobe tun’ to load it and add it into /etc/modules.conf. This module should be loaded before Virtuozzo is started, so you should run ‘service vz restart’ to make it available at runtime.

* Allow the VPS Hosting to use the tun/tap device:

vzctl set 700 –devices c:10:200:rw –save

* Create the device in the VPS Hosting:

vzctl exec 700 mkdir -p /dev/net
vzctl exec 700 mknod /dev/net/tun c 10 200

* Set proper permissions for /dev/net/tun:

vzctl exec 700 chmod 600 /dev/net/tun

You are done.

2010
05.26

Fdisk command does not supports partitioning of disk that has greater than 2 TB size. The parted tool supports GPT disk labels which can be used on disks larger than 2TB.
The example below demonstrates how to create a 6TB partition:

1. Use the parted tool to access the partition table of the device:

# parted /dev/sdj
Using /dev/sdj
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted)

2.

Once at the parted prompt, create a GPT label on the disk:

(parted) mklabel
Warning: The existing disk label on /dev/sdj will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes
New disk label type?  [gpt]? gpt
(parted)

Note: This will remove any existing partition table and partitions on the device.
3. Use the print command to show the size of the disk as reported by parted.  We need this later:

(parted) print

Model: Linux device-mapper (dm)
Disk /dev/sdj: 6000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

4. Create a primary partition on the device.  In this example, the partition will encompass the entire disk (using size from the step above):

(parted) mkpart primary 0 6000GB

5. Unlike fdisk, you do not have to write out the partition table changes with parted.  Display your new partition and quit.

(parted) print

Model: Linux device-mapper (dm)
Disk /dev/mapper/VolGroup00-gpttest: 6000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End          Size         File system  Name     Flags
1      17.4kB  6000GB  6000GB               primary

(parted) quit
Information: Don’t forget to update /etc/fstab, if necessary.

6.

You can now create a filesystem on the device /dev/sdj1

7. Use mkfs.ext3 to make ext3 partition.

mkfs.ext3 /dev/sdj1

8. Use print option to displays the partition table.

parted /dev/sdj print

2010
05.22

If images do not display in IE, but they do in firefox, and if the includes/configure.php files are correct, the images are in the /images directory, and the permissions on the /images directory and the images are correct, then, you should go to includes/application_top.php and where it says $request_type = (getenv(‘HTTPS’) == ‘on’) try changing the “on” to “off”.

If that fixes the problem, then in the HTML source of /index.php file:

<base href=”">
should be something like:
<base href=”http://www.yourdomain.com/”>

This should fix the issue.

2010
05.17

To Install VMware Tools in a Linux Guest, do the following steps,

Goto, Settings > VMware Tools Install and click Install.

This step connects the virtual machine’s CD-ROM drive to an ISO image file on the ESX Server machine.

In your Linux guest, become root, mount the VMware Tools virtual CD-ROM, copy the installer file from the virtual CD-ROM to installation directory, and unmount the CD-ROM.

mount -t iso9660 /dev/cdrom /mnt
cp /mnt/vmware-linux-tools.tar.gz /usr/src
umount /dev/cdrom

Untar the VMware Tools tar file in /tmp and install it.
cd /usr/src
tar zxf vmware-linux-tools.tar.gz
cd vmware-tools-distrib
./vmware-install.pl

Choose directories for the files. Enter a display size for the virtual machine and press Enter. Follow the instructions in the screen. Start X and your graphical environment and launch the VMware Tools background application.

vmware-toolbox &

Note: If you created this virtual machine using the vmxnet driver, run netconfig or another network configuration utility in the virtual machine to set up the virtual network adapter.