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

Posted by admin     Category: Linux Administration

To check the system’s information and manufacturers of MotherBoard, Processor, RAM and other hardware from the command line in a Linux machine, install the package “dmidecode”. You can search and install the dmidecode package 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

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

Posted by admin     Category: Plesk Management

You see a “Unable to install the psa-backup-manager” error while installing Plesk 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.
Please, contact product technical support.

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.

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

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"
# Database Name
dbname="dbname_here"
# store the current date
date=`date '+%Y-%m-%d'`
# Specify Ftp details
ftpserver="FtpServerIP"
ftpuser="username"
ftppass="password"
# Dump the mysql database with the current date and compress it.
#Save the mysql password in a file and specify the path below
/usr/bin/mysqldump -uroot -p`cat /path/to/passfile` $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##############

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

Make sure you assign the db_name, ftpserver/user/pass values properly at the start of the script.

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?

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 psa database in Plesk?
There are 2 ways to access the Plesk psa database, from the Linux command line (via ssh) and from the Plesk control panel.

Method 1) To access the psa database from command line:

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

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

You will be taken to the Mysql prompt. To switch to the psa database, execute,

mysql> use psa;

You are now in the psa database and can view all the tables

mysql> show tables;

Method 2) From the Plesk control panel.

Login to Plesk as user ‘admin’ and password from /etc/psa/.psa.shadow file.

Click "Settings" >> "Database Hosting Preferences" >> click OK >>
"Local MySQL server" >> "Databases" tab >> "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.

How to enable http compression on a Plesk server?

Posted by admin     Category: Plesk Management

First of all, 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 i.e. compressing the data is called mod_deflate.The main advantage is that it saves a lot of bandwidth.

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 module edit the Apache configuration file

vi /etc/httpd/conf/httpd.conf

Search for the line

#LoadModule deflate_module modules/mod_deflate.so

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

LoadModule deflate_module modules/mod_deflate.so

Save the file and restart the httpd service

service httpd restart

Now, create a .conf file under the /etc/httpd/conf.d/ directory since Apache reads all the .conf files from that 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 the httpd service. The compression code will compress all the files except the .gif, .jpe, .jpeg and .png files. 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