Wonderful World of Plesk

Winding roadRecently a friend of mine asked me to migrate his old server to a new provider, and I said yes. This new machine is managed by a software called Parallels Plesk. Plesk streamlines a lot of the boring and tedious tasks an administrator would have to do manually.

Now me being a proficient Linux person I thought cool, this will reduce the amount of work I have to do. I will be able to do everything either from the GUI or the command line, I said to myself. It's not until I looked at what was happening on the actual machine, when my smile vanished off my face... Every component that is manageable via Plesk has been retrofitted in some bizarre way. What will I do, how do I integrate seamlessly with these components? I don't want to break the nice GUI.

After scratching my head, poking around the filesystem and doing some research, I finally found what I was looking for. In order to configure the machine from the command line, you have to use the utilities provided by Plesk. In my case they are located under /opt/psa/ on the Ubuntu 12.04 server.

Migrating Mailboxes

The first thing that I was tasked to do was migrate all email accounts. Fortunately for me be both the old and the new system used the same set of software, the postfix and courier combo.

I started with getting a dump of all the email accounts and aliases from the original MySQL database. Since I was lazy, I loaded up the mysql prompt, did two quick selects and copied over the output of the results from one terminal to the other. Step one, check!

Now that I had the raw data, I had to convert the nice ASCII art data into something more usable by the computer.

Before I continue, let see how we can add a new email account via Plesk... To manage the mail system we use the mail comand:

The actual mailbox will be created in /var/qmail/DOMAIN_NAME/USERNAME with the Maildir format. This fits in great with what we want to do, because the original mailbox was also in the same format, we can just copy over the files.

So we just need to iterate over the entries that we got from the MySQL database, execute the mail command, copy over the files, and set the proper permissions:

Finished task one, onto round two...

Migrating Apache

This is the part involving the convoluted configurations files I hinted earlier. If you look at the apache configuration files in /etc/apache2/ everything looks normal, nothing out of the ordinary, until you see that all those config files do nothing! I spent half a day reading those configs and figuring out how Plesk manages it's virtual domains. I have yet to fully understand how it works, but I know enough to get by, for now at least.

Plesk stores all of it's apache related stuff in /var/www/, and thats fairly standard. The most important directory there is vhosts. That's where all the magic happens,  where the management panel stores all of its domains. For each domain you setup in the web GUI, you get a matching directory.

When you get your server from the provider, there will be always be at least one default domain. Usually it's a auto-generated domain based on the IP of your machine. That  domain unfortunately is here to stay, Plesk does not allow you to remove it.

The directory structure of a domain should be something similar to:

 In the case of the default domain, the httpdocs directory is the default apache root directory. All the configuration files are located in conf, but these are auto-generated files and should not be edited. You might see multiple files with numbers, these are the revisions of the configs, symlinks point to latest version. Every time you modify the configuration via the Panel, a new set of configs are generated.

If you wish to provide your own configuration file, you should call it vhost.conf/vhost_ssl.conf and put it in the conf directory. Execute the following to load your files:

 For those interested, I just found some documentation relating to Linux administration with Plesk. Everything is starting to become clearer on how I should manage this beast.

That's all

For now I will leave you with what I have written so far. This is all the Plesk specific information I wanted to share, I'm going back to work getting everything migrated properly. Hopefully you have glimpsed some useful nuggets of information from my adventures into the wonderful world of Plesk.

Tomasz Bogdal

Engineer by day, hacker at night. I take the road less traveled, dissect the unknown. Give me something new, and I'll master it by the dusk of dawn.

One Comment:

  1. I read a lot of inter­est­ing con­tent here. Prob­a­bly you
    spend a lot of time writ­ing, i know how to save you a lot of time, there is an online tool
    that cre­ates read­able, SEO friendly arti­cles in sec­onds,
    just type in google — laran­i­tas free con­tent source

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">