Tag Archives: Plesk 12.5.30

Migrate Plesk to MariaDB 10.1

Migrating Plesk to MariaDB 10.1 is fairly simple, currently Plesk officially supports up to MariaDB 10 and MySQL 5.6 (since writing 10.1 is now supported), so this is “use at your own risk”. I’ve run Plesk with MariaDB 10.1 on various operating systems, here I’ll show you how to install on Ubuntu 14 LTS from the MariaDB repository…

Please Note: An in place upgrade like this does not work on Ubuntu 16, you need to install MariaDB prior to installing Plesk, though I will be coming back to this issue when I have time.

Preparation

1. Import the key

apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db

2. Add the repository

add-apt-repository 'deb [arch=amd64,i386] http://lon1.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu trusty main'

3. Now update apt…

apt-get update

4. Stop the current MySQL/MariaDB process (if you use WatchDog to monitor MySQL/MariaDB stop monitoring first)

/opt/psa/admin/bin/modules/watchdog/wd --unmonit-service=mysql​

And

service mysql stop

Installation

5. Install like so…

env DEBIAN_FRONTEND=noninteractive apt-get -o OrderList::Score::Immediate=1000 \
install libjemalloc1 galera-3 libmysqlclient18 libmariadbclient18 mariadb-common mariadb-client-core-10.1 mariadb-client-10.1 mariadb-server mariadb-server-core-10.1 mariadb-server-10.1

If prompted to set a password, leave blank to keep your current, and you should over write the my.cnf file with the latest version to make sure you get all the optimizations added for MariaDB, especially if you are coming from MySQL.

Final Stage

6. Now you can start the MySQL service and start Watchdog monitoring…
Stop the current MySQL/MariaDB process (if you use WatchDog to monitor MySQL/MariaDB stop monitoring first)

/opt/psa/admin/bin/modules/watchdog/wd --monit-service=mysql​

And

service mysql start

Should you have any problems, please see the notes at the bottom of my post on Migrating Plesk to MariaDB

Migrate Plesk to MariaDB

The guide at Plesk’s DevBlog results in dependency issues on Ubuntu 14.
Here’s what the command should be when migrating to MariaDB on Ubuntu 14.04.2 LTS with Plesk 12.0.18.

1. Log in as root and run…

# apt-get update

2. And run the following updated command…

# env DEBIAN_FRONTEND=noninteractive apt-get -o OrderList::Score::Immediate=1000 \
install libmariadbclient18 mariadb-client-5.5 mariadb-client-core-5.5 mariadb-common mariadb-server mariadb-server-5.5 mariadb-server-core-5.5

3. Check you have MariaDB installed with

# mysql -V
mysql Ver 15.1 Distrib 5.5.41-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

I hope that helps someone else.

Notes

Some problems you may encounter, these are in the order you may receive them…

dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/mariadb-server-5.5_5.5.41-1ubuntu0.14.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Fix:

# dpkg -i --force-overwrite /var/cache/apt/archives/mariadb-server-5.5_5.5.41-1ubuntu0.14.04.1_amd64.deb

Following the above error you will get this…

Errors were encountered while processing:
mariadb-server-5.5

Fix:

# dpkg --configure -a

And finally…

Error: dpkg: error processing package mariadb-server-5.5 (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mariadb-server-5.5

Fix:

# apt-get install -f

Migrate Plesk to ClamAV

Recently a client wanted a free alternative to Plesk’s DrWeb, I went with ClamAV.
Here’s what I did to migrate the system from DrWeb to ClamAV.

REMOVE DRWEB

1. Firstly lets remove DrWeb properly:

# /opt/psa/admin/bin/autoinstaller --select-product-id plesk --select-release-current --remove-component drweb

INSTALL CLAMAV

2. Now we can install ClamAV:

# apt-get install clamav clamav-base clamav-daemon clamav-freshclam clamav-milter clamsmtp libclamav6

3. Edit /etc/clamav/clamav-milter.conf and set:

MilterSocket /var/run/clamav/clamav-milter.ctl

to

MilterSocket inet:3381@localhost

4. Now edit /etc/postfix/main.cf and add:

milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:127.0.0.1:12768, inet:127.0.0.1:12345, inet:127.0.0.1:3381
non_smtpd_milters = inet:127.0.0.1:12345, inet:127.0.0.1:3381

Where 12768 = psa-remote, 12345 = OpenDKIM, 3381 = ClamAV.

5. Now we need to restart postfix, clamav-milter and send a test mail and check for these headers..

X-Virus-Scanned: clamav-milter 0.98.6 at hostname
X-Virus-Status: Clean

Your mail should now be scanned by both Spamassasin and ClamAV.
If you are missing the Scanned by header check the file…/etc/clamsmtpd.conf, for

# A header to add to all scanned email
Header: X-AV-Checked: ClamAV using ClamSMTP

And uncomment it.

SET UP FRESHCLAM

6. ClamAV Freshclam, can be set up in several ways, I find it best to use cron for an hourly update.
To configure freshclam run…

# dpkg-reconfigure clamav-freshclam

And select cron instead of daemon.

7. You should have a default cron job for freshclam in /etc/cron.d/clamav-freshclam, should you wish to manage the task in Plesk or crontab you should disable first by commenting it out, you can then add the task to crontab like so…

# crontab -e
30 * * * * /usr/bin/freshclam --quiet

8. Now restart freshclam with

# service clamav-freshclam restart

And you should be good.
Any questions feel free to contact me.