2010
12.10

Sometimes you may need to reset the password of the admin account in Zimbra from CLI.

To get the list of all administrators in Zimbra, you can use:

su – zimbra

zmprov gaaa

To reset the password of the admin account, use:

zmprov sp <admin@domain.com> <your desired password>

Hope this will help you all.

2010
11.04

I have to clear a file to create some disk space in my FreeBSD machine. I tried to use “>” as usual.

Haaa… it was not working.

Then I tried the following and it worked.

# touch test

# cat test > filetonull

Hope you all will also find it useful. :)

2010
10.07

You can download packages via yum without installing/updating them. For this, you have to install a plugin named yum-downloadonly.Install the package using yum itself.

# yum install -y yum-downmloadonly

To download the packages, use the following commands:

# yum install package -y –downloadonly

The package will be downloaded and saved to the /var/cache/yum/ directory in this case.

To download it to the /usr/src/ directory, use the following:

# yum install package -y –downloadonly –downloaddir=/usr/src/

Now you can install the package using,

# rpm -ivh packagename.rpm

2010
09.30

Joomla admin password is stored in mysql, so it can be changed easily by running a simple mysql query.

If you have a cPanel account, use the phpMyAdmin to reset the password. Select the Joomla database and run the following query.

UPDATE `jos_users` SET `password` = MD5(‘newpass‘) WHERE `jos_users`.`username` = “admin” ;

“newpass” – replace this with the new password you wish to use.
“admin” – replace this with your username.

and submit the query.Now you should be able to login to Joomla admin page with the new password.

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