Updates from November, 2014 Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 11:50 am on November 2, 2014 Permalink | Reply
    Tags:   

    How to install Plesk on CentOS 7 

    Plesk-LogoInstalling Plesk on CentOS 7 hasn’t changed drastically from earlier versions, however CentOS is different than its predecessors. I’ve written an article about how to install Plesk on CentOS 6, but that was 3 years ago and thought it’s time for an updated version.

    Well here it is: Plesk 12, meet CentOS 7.

     

    Plesk Documentation

    Much of what I’m telling you and more is documented on the Parallels Plesk website:

    On the left hand side you’ll find a link to the current documentation, as well as handy links to purchase a license if you need to. The link will also answer your questions about the different editions of Plesk and direct you to the Parallels Forum.

     

    One-Click Installer

    The Plesk one-click installer is a script that downloads itself and determines the correct Plesk version for your OS. You won’t accidentally pick the wrong version for your distribution. Paste this and the installer will download the latest version of Plesk (12 at the time of writing):

    wget -O - http://autoinstall.plesk.com/one-click-installer | sh

    If you get an error message, wget may not be installed. Rectify this pitiful situation like this:

    yum install wget

     

    To download older versions of Plesk you can download the one-click-installer file and run it with the option –show-all-releases. This will give you the option to specify your desired Plesk version with –select-release-id. For more information, run the file with the –help option.

    I’ve noticed that the installer is much quicker than on previous versions of Plesk and is finished in under 10 mins (as opposed to half an hour previously). This is presumably due to many packages that are pre-installed with CentOS 7, so not much time is spent downloading stuff. Nice!

    Once finished the installer will give you a URL to login with – usually consisting of your IP, like https://10.1.2.3:8843

     

    Opening Ports for Plesk

    On CentOS 6 and prior the firewall rules were set via iptables. This service is gone and has been replaced with firewalld in CentOS 7. We still need to open ports to speak to Plesk via a browser. The two important ones to open here are 8443 and 8447:

     firewall-cmd --zone=public --add-port=8443/tcp --permanent
     firewall-cmd --zone=public --add-port=8447/tcp --permanent
     firewall-cmd --reload

    The –permanent option makes these rules “stick” upon restart.

    These are not the only ports Plesk needs to function, for a full list please see this KB article:

    There is usually no need to open other ports if you install the Firewall extension in Plesk, as this will manage the underlying service for you (and apply the necessary open ports). To do this, head over to Tools and Settings – Updates and Upgrades and install the Firewall Extension (under Additional Plesk extensions).

    Next head over to Extensions select the Firewall Module. Select “Enable Firewall Rules Management”, followed by another enable button. Now Plesk will manage the firewall for you and open all ports ready for web and email traffic.

     

    Add Atomic Repo Power (optional)

    If you’d like to supercharge your server, now’s a good time to install the Atomic repos. These will give you access to many additional tools such as pre-compiled OSSEC HIDS and additional PHP versions:

    wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh

     

    Loggin in for the first time

    With your dedicated IP handy, the installer script will have given you something like https://10.1.2.3:8443. Surf there and be presented with the Plesk login screen.

    But what are your credentials? I’m glad you asked: the first time you login to Plesk you can do so with your server root credentials. This even works on subsequent sessions, however Plesk creates an admin user for which you will specify the password during your first session.

    It is strongly recommended that you use that admin user for Plesk administrative tasks. You can also create additional administrators in Plesk once you’re up and running – so there’s no need to share your super secret password with colleagues and clients.

     

    Correcting your IP address (optional)

    It can happen that Plesk does not detect the correct IP address on your server. This was never the case in CentOS 6, but I’ve noticed this in CentOS 7. In my case the Plesk installer thought that the local loopback address was my main one (127.0.0.1) – which of course it was not.

    You can usually correct this on first login, but just in case you need to do this from the command line, check this helpful KB article:

     

    License Key and Additional Components

    You need a license to operate Plesk. You’ll get this either from your server provider (if Plesk is part of your deal), or you can buy one directly from Parallels. You can also run Plesk as a 14 day trial version. If you don’t enter this you can still use the Plesk interface but you’ll be limited to a single domain and several options are unavailable.

    In case you’re missing menu items that you had expected to be there, it’s probably a license issue.

    I find it helpful to head over to Tools and Settings (or the Server Tab) – Plesk – Updates and Upgrades and install several additional components, such as

    • Health Monitor
    • Migration Manager
    • Firewall (under Additional Plesk Extensions)
    • Watchdog (under Additional Plesk Extensions)
    • Spam Assassin (under Mail hosting features)
    • Kapersky Anti Virus (under Mail hosting features)

    You can also install Fail2ban from this menu if you like – I personally rely on OSSEC to deal with intrusion detection and choose not to use Fail2ban at this point.

     

    That’s it! Have fun with Plesk ;-)





     
  • Jay Versluis 8:24 am on October 20, 2014 Permalink | Reply
    Tags:   

    How to create Scheduled Tasks in Plesk 

    In this video I’ll show you how to create Scheulded Tasks in Plesk. I’ll explain where to find them (for admins and customers), how to execute them and what all those cryptic fields mean. I’ll also show you how to mute the output of the commands you execute so you won’t be bothered with emails you didn’t ask for.

    Scheduled Task is another name for Cron Job, and it’s something you want to run on a regular basis, like a script file. Plesk itself does not execute your task. Instead it will give you a nice interface to add the parameters you need for the Linux crontab command (or the equivalent on Windows, I believe it’s called at or schtasks).

     

    Cryptic Numbers

    The cryptic numbers in each field are crontab parameters. Numbers for those fields correspond to their description (i.e. 0-59 for minutes, 0-23 for hours, etc).

    One thing of note (and confusion) is how to define endless repetitions. We can do this with the asterisk and slash combinations.

    • * means “every”, as in “every minute”, “every hour”, “every day”
    • */4 means “every 4″, as in “every 4 hours”
    • 5-11 means “every number in between”, such as 5,6,7,8,9,10,11

    To find out more about the crontab command, head over to a great nixCraft article here:

     

    Muting Output

    By default Plesk will send you an email with any output a script or command may generate. You can avoid this by diverting all output to /dev/null. This is a virtual partition that magically makes things disappear.

    In the video I’m using a fictitious script /var/script.php. To divert its potential output I would use

    /var/script.php > /dev/null 2>&1

     

    A note about Script Files

    If you’re executing BASH, PHP, Python or any other script, make sure your files contain the she-bang at the very beginning to that your server can find the correct path. Here’s an example for how a PHP script should start:

    #!/usr/bin/php

    Note that web files that are designed to run in a browser cannot be called that way. You need to call those using cURL or wget.

     

     





     
  • Jay Versluis 8:56 am on October 13, 2014 Permalink | Reply  

    How to add Custom Buttons in Plesk 12 

    In this screencast I’ll show you how to create Custom Buttons in the Customer Control Panel in Plesk 12. These are direct links to URLs you can provide with the same look and feel as the rest of Plesk.

    Custom Buttons allow you to create links within Plesk or to external sources, like your website or a contact form. If you’re a developer you can even read out parameters that are passed with the URL (such as customer’s domain name). You can link to external sources as well as other areas of the Plesk Panel – including destinations you’ve created with extensions.

     





     
  • Jay Versluis 9:27 am on October 6, 2014 Permalink | Reply
    Tags: ,   

    Setting up Plesk Mail on iOS 8 (iPad) 

    In this screencast I’m explaining how to setup your iOS Device for use with Email Accounts created in Plesk 12. I’m also explaining how to map IMAP folders from your email account to the relevant folders on your iOS Device.

    For this demo I’m using an iPad 3 running iOS 8, but the process is the same on your iPhone and iPod Touch and older versions of iOS.

    It’s a rather complex setup (as dealing with email accounts usually is) and has caused me and my customers major headaches in the past. I hope this video can alleviate such pains. If setup properly, Plesk Mail is a pleasure to deal with and works very reliably.

    Sadly iOS Mail does not discover the settings it needs to work with your Plesk Mail automatically, but with a bit of help and guidance it’s easy to get it working. Let me show you how.





     
  • Jay Versluis 7:21 am on September 29, 2014 Permalink | Reply
    Tags: ,   

    Setting up Plesk Mail on Mac OSX Mavericks (10.9) 

    In this screencast I’m explaining how to setup Mac Mail for use with Email Accounts created in Plesk 12.  I’m also explaining how to map IMAP folders from your email account to the relevant folders on your Mac.

    It’s a rather complex setup (as dealing with email accounts usually is) and has caused me and my customers major headaches in the past, I hope this video can alleviate such pains. If setup properly, Plesk Mail is a pleasure to deal with and works very reliably.

    Sadly however Mac Mail cannot discover the settings it needs to work with your Plesk Mail automatically, but with a bit of help and guidance it’s easy to get it working. Let me show you how.

    I’ve created a similar screencast to show you how this works in iOS:





     
  • Jay Versluis 11:42 am on September 22, 2014 Permalink | Reply  

    MySQL Databases and phpMyAdmin in Plesk 12 

    In this screencast I’ll show you how to access your MySQL databases from Plesk and where to find the phpMyAdmin tool.

    I’ll also show you how to create MySQL users and copy databases in Plesk – this can come in handy when you’re about to make a change and you want to create a backup in case something goes wrong.





     
  • Jay Versluis 10:16 am on September 19, 2014 Permalink | Reply  

    How to use the File Manager in Plesk 12 

    In this screencast I’ll show you how to use the File Manager in Plesk 12. It’s a very convenient tool that has largely replaced the need for an external FTP client.

    The File Manager allows you to change files directly on the server via your web browser. I’m explaining the following things:

    • how to upload and download files
    • how to edit them via the integrated text and HTML editors
    • how to make files accessible to others via URLs
    • how to create and extract ZIP files directly on the server
    • and how to change file permissions

    Enjoy!





     
  • Jay Versluis 7:23 pm on September 18, 2014 Permalink | Reply
    Tags: ,   

    How to create a Plesk Backup from the command line in CentOS 

    Plesk-LogoEven in Plesk 12 we can only schedule a single backup, and we must decide where said backup should be saved: either on the local server, or on an off-site FTP server. Sadly we can’t have it both ways.

    Many of us – me included – find this very limiting.

    Both local and remote backups have their advantages though, and greedy as I am I want the best of both worlds:

    • an FTP backup is stored off-site, which is great for disaster recovery.
    • but a local backup can be create and to restore much faster, which is great for development
    • a local server wide backup creates individual domain backups automatically, whereas an FTP backup does not – great for convenience

    The good news is that Plesk has a set of command line tools which we can use to create a backup manually. In this scenario you can schedule a local backup in the Plesk web interface, and create another one using a cron job.

    The tool I’m talking about is called pleskbackup and it lives in the Plesk utilities directory. On CentOS this is in /usr/local/psa/bin.

    If called without parameters you’ll see a long list of options you can pass to this command:

    Usage: pleskbackup  <command></command> [] 
    
    Commands:
    
      server         Backs up whole Plesk.
    
      resellers-name Backs up selected resellers. Reseller's logins are read from command line,
                     space-separated. If no resellers provided, backs up all resellers
                     on the host.
    
      resellers-id   Backs up selected resellers. Reseller's identificators are read from command line,
                     space-separated. If no resellers provided, backs up all resellers
                     on the host.
    
      clients-name   Backs up selected clients. Client's logins are read from command line,
                     space-separated. If no clients provided, backs up all clients
                     on the host.
    
      clients-id     Backs up selected clients. Client's identificators are read from command line,
                     space-separated. If no clients provided, backs up all clients
                     on the host.
    
      domains-name   Backs up selected domains. Domain's names are read from command line,
                     space-separated. If no domains provided, backs up all domains
                     on the host.
    
      domains-id     Backs up selected domains. Domain's identificators are read from command line,
                     space-separated. If no domains provided, backs up all domains
                     on the host.
    
                     Use Exclude options to exclude some resellers/clients/domains.
    
      help           Shows this help page
    
    ...
    
    Output file option:
      --output-file=
            /fullpath/filename      - regular file,
            -                       - use stdout for output,
    
            [ftp|ftps]://[[:]@]/fullpath/filename - storing the backup to ftp server.
                           FTP_PASSWORD environment variable can be used for setting password.
                           FTP option '--ftp-login' can be used for setting login.
                           FTP option '--ftp-password' (with '--ftp-login') can be used for setting password.
                           If your password contains slash, you have to use '--ftp-password' option or
                           FTP_PASSWORD environment variable.
                           'ftps' protocol can be specified to use FTP over SSL, instead of plain FTP.
                           With ftps specify 990 port to use implicit FTPS, otherwise explicit mode will be used.
    
            Used to import dump from repository into the single file.
    

    Usage Example: Local Backups

    To create a local server-wide backup, all we have to do is this:

    pleskbackup server
    

    This will create a backup just like the Backup Manager would in the Plesk web interface. Those are stored in a variety of files in /var/lib/psa/dumps and also in the respective domains/resellers/customers directories.

    To create a single domain backup, simply replace “server” with “domains-name yourdomain.com” like this:

    pleskbackup domains-name your yourdomain.com
    

    Add more domains on the same line, separated by spaces.

    Usage Example: FTP Backups

    FTP backups are slightly more complex to create. We must pass all our credentials as part of the –output-file parameter, which requires us to specify a file name. Since the tool will create a .tar file, make sure you add this as part of your file name. Let’s look at a full example.

    Imagine we’d like to create a server wide backup, and our FTP credentials are

    – server (FTP Host)
    – user (FTP User Name)
    – password (FTP Password)
    – filename.tar (our backup file name)

    then we can call the command like this:

    pleskbackup server --output-file=ftp://user:password@server/filename.tar
    

    If all goes well you’ll receive no feedback. This is a synchronous task which on larger installations can take several hours – but it should be done within seconds on systems with dummy domains.

    First the tool creates a local backup, then ZIPs up the tarball and sends it to the FTP server. Once finished, the tool comes back to the command line.

    Automatically deleting older backups from FTP

    I love how the Plesk Backup Manager takes care of older backups and deletes them automatically. The pleskbackup command line tool on the other hand isn’t so friendly and instead is a low-level command that only does one thing. If we’d like to see automatic deletions we’ll have to employ a script that will do this for us.

    I’ve written such a script in PHP and put it on GitHub – feel free to examine it, test it, use it, redistribute it:

    To use the script, take a look at the top of the file and amend your details accordingly:

    // add your FTP credentials here
    $ftp_server = "ftpserver";
    $ftp_user = "ftpuser";
    $ftp_password = "password";
    
    // maximum number of backup files to keep on FTP
    $maxbackups = 30;
    
    // add a prefix for your backup
    $prefix = 'BACKUP-'; 
    
    // PLESK utilities directory
    $pleskbin = "/usr/local/psa/bin/";
    

    Save your changes and make sure you add execute permissions to the file:

    chmod +x ./backup.php
    

    Now you can call the file from the command line or via a Cron Job (Scheduled Tasks in Plesk). Execute the script as root and make as many backups as you like – in addition to what Backup Manager is doing from the web interface.

    The one caveat I found is that the pleskbackup tool does not maintain the correct timestamp when it copies the tarball over to the FTP server. It’s an issue with pleskbackup rather than my script – I don’t understand how Backup Manager can do this fine in the web interface, which presumably relies on the same tool.

    As a workaround I’m saving the date as part of the filename, i.e. BACKUP-YYYYMMDD-HHMMSS.tar. For the auto-deletion to work, make sure to use a dedicated directory for your FTP backups with no other files – otherwise the latest backup may be deleted.

    To save your backups in a subfolder, amend the prefix like this:

    // add a prefix for your backup
    $prefix = 'subfolder/BACKUP-'; 
    

    And that’s how we can create Plesk backups from the command line!





     
  • Jay Versluis 4:21 pm on September 16, 2014 Permalink | Reply  

    How to use File Sharing in Plesk 12 

    In this screencast I’ll show you how to use the File Sharing features in Plesk 12. File Sharing allows you to upload files and give links to others, or let others upload files to the server. You can do this with or without password protection and you can even map folders from your server to your desktop computer – so file sharing can be as easy as drag and drop.

    I’ll show you how to share files via email, how to map folders from Plesk on Mac and on Windows, and how to setup additional users so that you can allow others to upload files and access protected content. I’ll also show you how to share files without protection so they can be embedded easily into newsletters, emails or websites.

    With the right setup you can transform your Plesk server into an unlimited cloud storage system (much like DropBox, Google Drive, One Drive and the plethora of other services out there).

    Plesk uses the WebDAV protocol for file sharing and you can use the principles I’m showing here on any device that supports WebDAV. If you’re interested to do this on iOS, look into Good Reader.

    Let me know if you have any questions.





     
  • Jay Versluis 8:46 am on September 8, 2014 Permalink | Reply  

    Installing legacy versions of WordPress in Plesk 12 

    In this screencast I will show you how to install an older version of WordPress in Plesk 12. This is useful if you’d like to test drive the WordPress Toolkit on a spare server before going live with its many new features. You can’t use the APS installer for this as it will always install the latest version of WordPress.

    I will explain where to download an older version of WordPress from and how to install it manually by creating a database first and then running the WordPress installer manually. In total I’m installing three WordPress instances in preparation for the WordPress Toolkit (I’ve explained how to use it in the previous video – you can check it out here:

     

    You can find all previous releases of WordPress in the Release Archive:

     





     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel