Category Archives: Plesk

Plesk Guides, Articles and Discussion

Creating Default Mailboxes Automatically

This is how you can create default mailboxes automatically when using Dovecot and Plesk…

nano /etc/dovecot/conf.d/10-mailboxes.conf

And add the following…

namespace inbox {
mailbox Drafts {
special_use = \Drafts
auto=subscribe
}
mailbox Trash {
special_use = \Trash
auto=subscribe
}
mailbox Sent {
special_use = \Sent
auto=subscribe
}
mailbox "Sent Messages" {
special_use = \Sent
}
}

Then restart Dovecot…

service dovecot restart

Now when you add an email user in Plesk these mailboxes will be created automatically for them.

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

Moving Plesks Mail Directory

This is an update to a kb article at Plesk KB6312 on How to move the Plesk Mail Directory.
I will use the example folder /var/vmail

1. Edit psa.conf

# nano /etc/psa/psa.conf

Changing “PLESK_MAILNAMES_D” to the desired location…

# Location of qmail maildirs
PLESK_MAILNAMES_D /var/vmail/mailnames

2. Then run the following command which will create the new folder and copy the contents of the qmail directory to the new directory…

# cp -a /var/qmail /var/vmail

3. And change the maildirs in Dovecot…

# nano /etc/dovecot/conf.d/15-maildir.conf

Adding the following…

# Plesk Maildirs layout.
mail_home = /var/vmail/mailnames/%Ld/%Ln
mail_location = maildir:/var/vmail/mailnames/%Ld/%Ln/Maildir

4. Run…

# /opt/psa/admin/bin/mchk --with-spam

This will update the following configuration files

/etc/postfix/main.cf
/etc/postfix/master.cf
/etc/default/spamassassin

with the correct paths to your new Maildir.

5. We need to edit the spamtrain script…

# nano /opt/psa/admin/sbin/spamtrain

You will see line 8…

maildir="/var/qmail/mailnames"

Simply change this to…

maildir="/var/vmail/mailnames"

6. Now create the Spamassasin Home Directory…

# cd /var/vmail/popuser
# mkdir .spamassassin
# chown -R popuser:popuser .spamassassin

And restart Postfix and SpamAssassin..

# service posfix restart && service spamassassin restart