Wednesday, December 05, 2007

Missing table psa.exp_event

Well, after the update of Plesk by the previous method, all was not well.
During the upgrade, dpkg failed to complete the install and eventually, after removing and the re-installing the psa debs, I was back up and running.

Well, I thought I was! Whenever I tried to do anything I'd get the following message:
MySQL query failed: Table 'psa.exp_event' doesn't exist
0: /opt/psa/admin/plib/common_func.php3:211
db_query(string 'INSERT INTO exp_event (source, event_type, event_time, obj_class, obj_id, host, user, flushed) VALUES ("plesk", "created", NOW(), "mailname", "*******@*****", "xx.xxx.xxx.xxx", "admin", "false")')
1: /opt/psa/admin/plib/api-rpc/loger.php:306
Log2Expand->Log2Expand(object of type ActionLog)
2: /opt/psa/admin/plib/class.ActionLog.php:534
ActionLog->submit()
3: /opt/psa/admin/plib/mail/MailName.php:1008
Mailname->update()
4: /opt/psa/admin/htdocs/domains/mail/mail_name_preferences.php:92
Clearly, I needed to add the table psa.exp_event.
Log into the mysql table by:
sudo -s
mysql -uadmin -p`cat /etc/psa/.psa.shadow`
Choose to use the psa table
USE psa
I found two suggestions for the table schema, but neither worked: 1, 2. Finally, I found this, and after creating the table, all was fixed:
DROP TABLE IF EXISTS `exp_event`;
CREATE TABLE `exp_event` (
`id` bigint(10) unsigned NOT NULL auto_increment,
`source` enum('pa','plesk') default NULL,
`event_type` enum('started','stopped','created','updated', 'deleted', 'status_changed', 'terminated', 'flushed', 'installed', 'uninstalled', 'siteapp_added', 'siteapp_removed', 'expired', 'exceeded') NOT NULL default 'started',
`event_time` datetime NOT NULL default '0000-00-00 00:00:00',
`obj_class` enum('license', 'service', 'ip_address', 'admin_info', 'siteapp', 'session_preferences', 'client', 'client_limits', 'client_status', 'client_prefs', 'client_perms', 'client_ip_pool', 'client_limit_traffic', 'client_limit_size', 'domain', 'domain_limits', 'domain_user', 'domain_limit_traffic', 'domain_limit_size', 'domain_status', 'phosting', 'fhosting', 'db_server', 'subdomain', 'mailname', 'webuser', 'maillist', 'dns_zone', 'mailname_antivirus', 'mailname_spamfilter', 'mailname_mailgroup', 'mailname_autoresponder', 'mailname_attachment', 'dashboard_preset', 'dashboard_preset_type', 'dashboard_preset_name') NOT NULL default 'license',
`obj_id` varchar(255) character set utf8 NOT NULL default '',
`host` varchar(255) character set utf8 NOT NULL default '',
`user` varchar(255) character set ascii NOT NULL default '',
`flushed` enum('true','false') NOT NULL default 'false',
PRIMARY KEY (`id`)
);
\q

Sunday, December 02, 2007

Error: There is no release with ID PLESK_8_0_1.

I tried to run an update for my Plesk installation and was met with this error:
Error: There is no release with ID PLESK_8_0_1.

A quick google and I found this: http://kb.swsoft.com/en/2115

A quick read of the instruction on the download page told me that I didn't need a new licence to install 8.1 on an 8.0.x machine "Plesk 8.1 for Linux/Unix does not require a new product license for users upgrading from Plesk 8.0.x versions.". So, I downloaded with latest 8.1 installer with:
wget http://download1.swsoft.com/Plesk/Plesk8.1/Debian3.1/psa_installer_v3.1.2_build070419.14_os_Debian_3.1_i386
I needed to make it executable and run it, follow the instructions and I was up and running again
chmod +x installer_file_name
./installer_file_name

Friday, November 30, 2007

Spamassassin backport

I only seem to blog about spam!

Task: Plesk 8.0 - improve spam filtering

Plesk 8.0 on a Debian Sarge box comes with Spamassassin 3.0.3
I wanted to installed a more recent version along with Pyzor, Razor etc.

So, I needed to install spamassassin from the backports repro:
Alter sources.list...
deb http://ftp.uk.debian.org/debian sarge main
deb http://security.debian.org/ sarge/updates main contrib
deb http://www.backports.org/debian/ sarge-backports main
Then update the repros and install the later version of spamassassin
sudo apt-get update
sudo apt-get -t sarge-backports install spamassassin
Once this is done, follow the on-screen instructions and then the previous blogged installation of Pyzor and Razor.

Sounds simple... took ages to find out how to do it!

Saturday, November 24, 2007

Spamguardian failure

I migrated accounts from one Plesk server to another using their cool migration feature. Everything worked swimingly apart from the fact that no mail was being delivered.

A quick look through the logs revealed this in /var/log/messages:
Nov ** **:**:** servername livesguardian(7032): Failed running maildir
I had a look on Google and found no help. Trying to run the command "maildir" on the server resulted in a "no such file" error. Comparing directory listings of other servers, I noticed that /usr/bin/maildir didn't exist! I have no idea why, so decided to copy the maildir binary from the other server.

All is working swimingly now.

Wednesday, November 21, 2007

Synchronising Plesk with unison

I wanted to synchronise my local files and server with one hosted on a Plesk server.

REMOTE
First, we need to make sure that the server has unison installed.
unison -version
If unison isn't installed, install it
If the version doesn't match the version on the local machine, download the binary from the unison site, move it to /usr/bin and create "ln -s" it to "unison"
Try unison -version again.
Make sure that you can run unison remotely - the first time it is run, it tried to create a .unison directory, so if the environment doesn't allow unison to write to the users home directory, it needs to be created first.

LOCAL
Now locally, create the directory we are going to sync with.
Create the unison config file.
It lives in .unison in your home directory and will look something like:
root = /var/www/vhosts/**site_name**/httpdocs/
root = ssh://**username**@**remote_host**/httpdocs/
Using either unison or unison-gtk, run the first sync

Monday, September 24, 2007

SpamAssasin upgrade with SpamGuardian

I wanted to update spamassassin on my Plesk install on a Debian machine. I have SpamGuardian installed too, so needed to make sure that once the upgrade of SpamAssassin was complete, I could still control the setup through the web-insterface and Plesk and SpamGuardian.
sudo -s
get the latest spamassassin deb:
dkpg -i the_spamassassin_file.deb
cd /etc/spamassassin
remove the old .cf files (I moved them to a nuke folder)
remove the Rules_du_jour files too
edit the local.cf file
check that everything is still working
spamassassin --lint
fix any errors
if you log into the Plesk control panel now, SpamGuardian will still show that you are using the old version...

Re-install SpamGuardian

Additional instructions can be found in various places.

UK2 server setup

I've not long purchased another server from UK2.net and installed Plesk 8.2 on it with Spam Guardian. It's interesting how I refine the install on each occasion, and this is probably as slick as it can get without being completely automated.

check the open ports on the server
login as root

Basic server setup

Once the email from UK2 has arrived with confirmation of the server, log into the server as root, change the password and upgrade all the current packages (be aware of previous kernel updates that have caused kernel-panics at boot:
ssh root@server12345.uk2net.com
passwd
nano /etc/apt/sources.list

deb http://ftp.uk.debian.org/debian/ etch main
deb-src http://ftp.uk.debian.org/debian/ etch main

deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib

apt-get update
apt-get upgrade
Upgrade out of date packages and setup the sudo function
apt-get install sudo
nano /etc/sudoers
Add the line %admin ALL=(ALL) ALL to the bottom of the file. Now add some real users and a group called admin; add users to the admin group if they are sudoers.
adduser username
groupadd admin
usermod -G admin username
Setup some other basic packages and admin tasks
apt-get install joe lynx
joe /etc/motd - Welcome to...
joe /etc/ssh/sshd_config - PermitRootLogin no
sudo /etc/init.d/ssh restart
Setup the hosts file (/etc/hosts)
Logout of the root account and setup passwordless login to the new server
ssh-keygen -t rsa - follow the hints (don't enter a passphrase)
ssh-copy-id -i ~/.ssh/id_rsa.pub username@host
Log into your new account and check that you aren't prompted for a password.

change hostname (/etc/hostname)
install webmin
sudo dpkg -i webmin...
  • copy over installers
  • install plesk
  • login (admin:setup)
  • change password
  • change hostname
  • check watchdog and change email address
  • review licence
Other Plesk jobs on blog
  • munin
  • maxclients
  • imap connections
  • spamguardian
  • totalbackup
(where /usr/bin/bzip2 doesn't exist and bzip2 has been installed, it may be in /bin/bzip2 - create a symlink)

Set time servers
apt-get install ntp ntp-server ntp-simple
ntpdate uk.pool.ntp.org
nano /etc/ntp.conf
add server 0.uk.pool.ntp.org (1.uk.... and 2.uk...)
/etc/init.d/ntp-server restart
ntpq (peer)
*

install the new ssl certificate or renew it through the instantssl web interface
set it as the default certificate for all IP addresses on the machine
make it the default certificate
remove the plesk ssl certificate

FILES THAT GET CHANGED ON A PLESK INSTALL
  • motd
  • sources.list
  • hosts
  • hostname
  • ntp.conf