Installing Ruby on Rails on Plesk

To Install Ruby on Rails on a Plesk Server:

yum groupinstall “Plesk 8.1 Ruby”
yum install psa-miva (If Miva required)
yum groupinstall “Plesk 8.1 FastCGI” (if FastCGI required)

To Configure Ruby on Rails on a Plesk Server:

1. Create a domain in Plesk with Physical hosting.
2. Ensure that bin/bash access is enabled.
3. Ensure that CGI and FastCGI are enabled
4. SSH to server.yourservername.com with the FTP/SSH username and password.
5. Configure Ruby:
##Add Ruby to your path
export PATH=$PATH:/opt/ruby/bin/
##Change permissions on private folder
chmod 755 private

rsync backups

rsync can be used as an effective backup tool:

rsync -avz --delete -e "ssh -i rsync/mirrorkey" backup@85.222.111.000:/var/www/vhosts/mydomain.com/httpsdocs /backup/mydomain.com

If there’s a lot of data and speed takes importance over security, a weaker cipher such as blowfish could be used:

"ssh -c blowfish -ax -i rsync/mirrorkey"

Be careful with the –delete flag, it will delete files on destination if they exist.

RPM Examples

Install RPM:
rpm -ivh package.rpm

Upgrade RPM:
rpm -Uvh package.rpm

Import an RPM GPG key:
rpm –import /media/cdrom/RPM-GPG-KEY

Getting detailed information about the package wget:
rpm -qi wget

Showing all the files installed by the package wget:
rpm -ql wget

Enable Disk Quotas on plesk for Linux

First of all make sure that quota is supported by kernel. It should be compiled into the kernel or loaded as module.

You can check if quota is configured properly with this command line:
/usr/local/psa/admin/sbin/usermng –isquotable

Normally, it should return “0”.

If the utility returns the following error message:

usermng: Unable to turn on user quota. User quota not supported on device ‘/dev/sda3′
System error 3: No such process

then, make sure that quota is enabled in /etc/fstab for the partitions Plesk stores data on. You should add ‘usrquota’ as it is done in the example below:

/dev/hda1 / ext3 defaults,usrquota 1 1

The partition must be remounted after you added usrquota option into /etc/fstab, for example with:
mount -o remount /

Update users quota with this command line:

quotaon /dev/hda1

Make sure that ‘aquota’ format is used. It should be an aquota.user file
in the root of every partition where quota is enabled. If you see
the ‘quota.user’ file, please remove it and create the right one:
rm -f quota.user
touch aquota.user
/sbin/quotacheck -fmv /dev/hda1

Note: you have to use your own device instead of ‘/dev/hda1′.

Managing the Qmail queue

/var/qmail/bin/qmail-qstat

or for more detailed info:
/var/qmail/bin/qmail-qread

qmail configuration:
/var/qmail/control

list count of email addresses in queue
grep -h "^From:" /var/qmail/queue/mess/*/* | sort | uniq -d -c

for big big queues: (will take a while)
find /var/qmail/queue/mess/21/  -type f -print0 | xargs -0 -P1 -n64 grep -h "^From:" |sort | uniq -d -c

search through queue for all email headers/bodies:
cd /var/qmail/queue/mess; cat */* | less
/search for address in queue here

so to get a list of all remote addresses
cat /var/qmail/queue/remote/*/* | tr '\0' '\n'
cat /var/qmail/queue/local/*/* | tr '\0' '\n' for the local delivery queue

kick queue and attempt redelivery
/var/qmail/bin/qmail-tcpok; killall -ALRM qmail-send

qmHandle is a useful tool with more features.

Managing the Postfix queue

This command will delete one specific email address from the mail queue (taken from the postsuper man page):

#mailq | tail +2 | grep -v ‘^ *(‘ | awk  ‘BEGIN { RS = “” } { if ($8 == “email@address.com” && $9 == “”) print $1 } ‘ | tr -d ‘*!’ | postsuper -d –

Note that “email@ddress.com” should be replaced with the messages noted email address.

To clear (delete) the entire Postfix queue, run the following command:

#postsuper -d ALL

Note: This command will delete all messages in the Postfix queue. If you need more selective deleting, this can be done as well, use ‘man postsuper’ to find out all of the available options.

Plesk Admin Password

Linux:

cat /etc/psa/.psa.shadow

Windows:

Open a command prompt and type:

“C:\Program Files\Parallels\Plesk\admin\bin\plesksrvclient.exe” -get

Plesk unlock admin account

mysql -uadmin -p$(cat /etc/psa/.psa.shadow) -Dpsa -e “delete from lockout where login=’admin'”

Plesk 9 Backup Utility Broken

After an upgrade to Plesk 9 you cannot schedule backups and get the following error:

Unable to update scheduled backup information: MySQL query failed: Unknown column ‘backup_time’ in ‘field list’

Just run the following and it will reinstall them and correct the database:

yum erase psa-backup-manager psa-migration-manager
yum install psa-backup-manager psa-migration-manager
service psa restart

Plesk 9 Greylisting

Plesk 9 introduced greylisting  – yay! or not.

To disable it:

/usr/local/psa/bin/grey_listing --update-server -status off