Latest blog entry

How to check System Information and vendors of MotherBoard/Processor/RAM in Linux?

July 27, 2010    |   Posted by admin   |    Category: Linux Administration

dmidecode command can be used to check the system’s information and manufacturers of MotherBoard, Processor, RAM and other hardware of your Linux server. If the dmidecode command doesn’t work, install it using YUM.

Check your Linux server architecture i.e. 32bit OR 64bit:

# uname -p

Search for the dmidecode package

# yum search dmidecode

Depending on the architecture, install the proper dmidecode package

# yum install dmidecode

You are done. To check all the hardware information of the server, execute

# dmidecode
Comments Off on How to check System Information and vendors of MotherBoard/Processor/RAM in Linux?

Plesk Installation: Unable to install the psa-backup-manager

July 25, 2010    |   Posted by admin   |    Category: Plesk Management

You see a “Unable to install the psa-backup-manager” error while installing Plesk control panel on a Linux server and it is because of the incomplete db4 packages needed for embedded database support for various applications. The complete error message looks like:

Determining the packages that need to be installed. ERROR: Unable to
install the "psa-backup-manager-9.x.x-cos5.buildxxxxxxx.00.i586"
package. Not all packages were installed.

Solution:

Check if the required db4 packages are installed by executing:

# rpm -qa | grep db4

It will list the db4 packages. If the db4-devel and db4-utils are missing from the above output, install the packages using yum

# yum install db4-utils
# yum install db4-devel

That’s it. You can start the Plesk installation once again and it will install the psa-backup-manager successfully.

Comments Off on Plesk Installation: Unable to install the psa-backup-manager

Shell script to backup a Mysql database and save it on a remote server using Ftp

July 23, 2010    |   Posted by admin   |    Category: Scripts

The following shell script will dump the mysql database and will save the .sql file on a remote location using Ftp. This script will create a backup file including the current date so you can have multiple copies of the backups of the same database under one directory.

Create a file called mysqlbkup.sh

# vi /root/mysqlbkup.sh

and paste the following code in the file as it is.

##############START OF THE SCRIPT##############

#!/bin/bash

# Specify the temporary backup directory.
BKUPDIR="/tmp"

# Specify Database Name
dbname="dbname_here"

# Save the current date
date=`date '+%Y-%m-%d'`

# Specify Ftp details of the remote server.
ftpserver="FtpServerIP"
ftpuser="your ftp user"
ftppass="your ftp password"

# Dump the mysql database with the current date and compress it.
# Save the mysql password in a file and specify the password file
# path in the below command.

/usr/bin/mysqldump -uroot -p`cat /path/to/pass/file` $dbname\
 | gzip > $BKUPDIR/$date.$dbname.sql.gz

# Change directory to the backup directory.
cd $BKUPDIR

# Upload the backup
ftp -n $ftpserver <<!EOF!
user $ftpuser $ftppass
binary
prompt
mput *.sql.gz
quit
!EOF!

# Remove the local backup file.
/bin/rm -f /$BKUPDIR/$date.$dbname.sql.gz

##############END OF THE SCRIPT##############

Make sure to specify your db_name, ftpserver, ftpuser and ftppass values in the script.

Save the file and schedule a cronjob to execute the file on daily basis, say during night hours at 1.00AM. Edit the cron file

# crontab -e

and set the following cronjob

0 1 * * * /bin/sh /root/mysqlbkup.sh

save the file and restart the crond service

# service crond service

The script will work on a Linux/Plesk server as well. You just have to replace the mysqldump line in the script with the following

/usr/bin/mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` $dbname\
 | gzip > $BKUPDIR/$date.$dbname.sql.gz

Note: Leave a comment if you have any suggestions, questions OR have received any error message using this script.

How to access psa database in Plesk?

July 17, 2010    |   Posted by admin   |    Category: Plesk Management

Plesk uses a ‘psa’ database to store all the data and values. This data can be easily retrieved at any point of time using the Mysql queries.

How to access the Plesk ‘psa’ database in Linux?
There are 2 ways, one via SSH (Linux command line) and the other from the Plesk control panel.

Method 1)

SSH to your server as root and execute the following command. The /etc/psa/.psa.shadow file contains the Plesk admin password.

# mysql -uadmin -p`cat /etc/psa/.psa.shadow`

You will be connected to the Mysql server. To use psa database, execute

mysql> use psa;

To view all the psa database tables:

mysql> show tables;

Method 2)

Login to the Plesk control panel as user admin

Goto Settings -> Database Hosting Preferences -> click OK -> 
Local MySQL server -> Databases tab -> click Webadmin.

Once you click “Webadmin”, phpMyAdmin will open in a new window from where you can access all the databases including the ‘psa’ database. Make sure pop-ups are enabled in your browser.

Comments Off on How to access psa database in Plesk?

How to enable http compression on a Plesk server?

July 15, 2010    |   Posted by admin   |    Category: Plesk Management

What is http compression and which module to use for http compression?

Compressing data before transmitting to the browsers and then uncompressing the data before displaying. The module that is responsible for http compression is called mod_deflate.The main advantage of mod_deflate is that it saves a lot of bandwidth and loads the pages faster.

On a Plesk server, the mod_deflate module is installed by default, however it may be disabled in the Apache configuration file. To enable the mod_deflate module in Plesk edit the Apache configuration file

# vi /etc/httpd/conf/httpd.conf

Search the line that says,

#LoadModule deflate_module modules/mod_deflate.so

and uncomment it i.e. remove the ‘#’ mark

LoadModule deflate_module modules/mod_deflate.so

Now, create a /etc/httpd/conf.d/deflate.conf file. Apache reads all the .conf files from the /etc/httpd/conf.d directory on a Plesk server.

# vi /etc/httpd/conf.d/deflate.conf

and place the following code in it

<Location />
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI  \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
</Location>

Save the file and restart Apache.

# service httpd restart

This compression code will compress all the files except the .gif, .jpe, .jpeg and .png files before sending them to the browser. To test the compression, use the tool

http://www.whatsmyip.org/mod_gzip_test/

To enable compression for a specific directory or domain, specify the directory path in the <Location> directive in deflate.conf and restart the Apache server.

 

Related URLs:
Enable http compression on a Plain Linux server