Develop Plesk Extensions Series: Install a Local Version of Plesk
Have you ever wanted a feature in Plesk that doesn’t exist yet? Or do you want to earn some money by selling a really valuable Plesk Extension to thousands of Plesk users? In this article, you will learn how to quickly code your first extension for Plesk and adapt it to your needs. And if you do this Open Source – even better! This will help others to contribute and make your new extension really stand out. I will cover all aspects, beginning with installing Plesk locally, setting up your development environment, writing your first extension and submitting it to the official Plesk Extension Catalog. Every part will contain tips and tricks and related links. Additionally, I will create a short screencast for each part of the series that will make it easier for you to dive into this topic. I hope you enjoy coding your first Plesk Extension and I’m looking forward to receiving your feedback!
Part 1 – Install a local version of Plesk
Note: I’m using a Mac OS as my development system. If you are using a PC with Windows, then some parts of the tutorial could potentially differ.
What do we need to run a Plesk instance locally?
- Plesk ISO image
- Virtual Box to run the image
- Plesk license key
Configure the network settings of the virtual machine properlyAfter the successful installation of Virtual Box, we need to configure the global and (later) local Network settings to be able to communicate with the virtual machine via the browser and SSH. Open the global
Preferencesand select the button
Network. Select the Host-only Networks tab and click on the
+symbol. You will see a new entry
vboxnet0. Click on this entry. The IP address will be pre-configured to a private IPv4 address space. The Host-only networking setting provides connectivity among virtual machines and the host (your machine). For the connection of the virtual machine to the web we will use the so-called Network Address Translation (NAT) adapter.
Note: You don’t need to add a NAT network, it is sufficient to attach the virtual machine to the NAT adapter. I will explain it later once we’ve created our virtual machine with the Plesk image. For more information to the networking modes, please see this.To create our local development image, we click on the
Newbutton, enter the name of the machine, select the correct type and version of the operating system. In my case, it is Linux and Ubuntu (64-bit). Click through the creation process with your preferred settings to the end. When the virtual machine was created successfully, you will see a new entry in the list of available machines.
Set the correct Port Forwarding rules for your imageDon’t start the machine yet but select it and click on
Settings. In the settings go to the
Networktab, then the
Adapter 1tab and select the checkbox
Enable Network Adapter. Under
Attached toyou select NAT. Afterwards, click on
Advancedand then the
Port Forwardingbutton. Here we will define the port rules which are important to access the virtual machine via the browser and SSH. For instance, we can set the first rule to
Host Port 2225 and Guest Port 22 (for SSH), a second rule to
Host Port 80 and Guest Port 80. You should map all required ports:
443, 8443, 8447 and 8880(see screenshot). For all rules we select the TCP protocol. After the network is configured, start the virtual machine. In the first run, you will be asked for the image to boot from. Select the Plesk ISO image and finish the installation process of the operating system. Please define the username and password that you want to use for the root user. This is important because we will utilize this user to access the machine via SSH. Be patient, the installation process takes some minutes.
Tip: Use your own Terminal (such as iTerm) to manage the virtual server by using SSH.Connect the virtual machine once it was booted with:
$ ssh [email protected] -p 2225Replace NAME with the username that you’ve defined during the installation process and the port that you’ve mapped in the Virtual Box image settings.
Don’t interrupt the installation process of Plesk after first bootAfter the first login into the virtual machine, you have to wait until Plesk was installed completely. Remember not to interrupt the installation process, or else you will have to recreate the complete virtual machine. The progress of the installation is documented in a special log file. To see the status, you can type:
$ sudo tail -f var/log/plesk/install/autoinstaller3.login your terminal. Now it’s time to get a coffee as this can take a while! You will see a
Congratulationsmessage after the installation and you can verify it by typing:
$ plesk versioninto the console. You should see some information such as the product version, build date or the OS version. The default username is
admin, to retrieve the password of your Plesk instance, use for Plesk Onyx:
$ plesk login $ plesk bin admin --get-login-link // alternative calland for Plesk 12.5:
$ sudo plesk bin admin --show-passwordThe
--show-passwordcommand is no longer available in Plesk Onyx due to security reasons. In Plesk Onyx you will get a URL with a secret key (https://domain:8443/login?secret=X) which will allow you to log in to the Plesk instance and set an own password.
Note: For help on password retrieval, go here.
Check the correct installation of Plesk in your browserWe are almost there! Now open your browser and type the address
http://localhost:8880into the address bar (use the port that you’ve defined in the NAT forwarding rules!). If you did everything properly, you will see the login screen of Plesk. Login with the default credentials, accept the license and select the type
Power User. The last step is to enter your (trial) license key and you are ready to go! In the next part of the blog series I will show you how to create a default Plesk extension as a starting point of the development, add this extension into your IDE (we will use the great IDE PhpStorm), sync it with the copy that runs in the local Plesk instance and add auto-completion to make our life easier. Ready for Part 2? Create extension stub and IDE project
How useful was this post?
Click on a heart to rate it!
Average rating / 5. Vote count:
No votes so far! Be the first to rate this post.
Oh no, sorry about that!
Let us know how we can do better below
Thanks for your feedback!