• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Develop Plesk Extensions Series: Install a Local Version of Plesk

V

Viktor Vogel

Guest
Have you ever wanted a feature in Plesk that doesn’t exist? 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 start out.

I will cover all aspects, beginning with installing Plesk locally, setting up your development environment, writing your first extension and submit 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

plesk-extensions-part1-screenshot1-1024x581.png




First of all, we will download a Plesk ISO image from here. On this page you will also find a form to request a free trial license key. We will need the license key later once Plesk was configured properly to run on our local machine. You can already request the license key in this step as long as the ISO image is downloaded.

Look at the bottom of the page for the ISO images. We take the Ubuntu 14.04 64-bit with Plesk 12.5 image for our local development constellation. This is the latest, stable version that is available at the moment. There will be updates of Plesk frequently, so you should take the latest available version that is offered on this page. If you encounter issues with this image, feel free to try another one, preferably an Ubuntu image because we will use this Linux distribution throughout our complete tutorial.

Our next step is to download and install the software Virtual Box. Virtual Box by Oracle is a free virtualizer (virtualization application) that makes virtualization (e.g. running multiple operating systems) possible on our local machine. Go here and download the latest version for your operating system, in my case I took the OS X version.
plesk-extensions-part1-screenshot2-1024x581.png


After 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 “Preferences” and 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.

plesk-extensions-part1-screenshot3-1024x581.png



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 “New” button, 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.

Don’t start the machine yet but select it and click on “Settings”. In the settings go to the “Network” tab, then the “Adapter 1” tab and select the checkbox “Enable Network Adapter”. Under “Attached to” you select NAT. Afterwards click on “Advanced” and then the “Port Forwarding” button. 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). Use for all rules the TCP protocol.

plesk-extensions-part1-screenshot4-1024x581.png


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 use this user to access the machine via SSH. Be patient, the installation process runs 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 NAME@localhost -p 2225

Replace 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.

After the first login into the virtual machine, you have to wait until Plesk was installed completely. This is very important, do not interrupt the installation process else you will have to recreate the complete virtual machine. The progress of the installation is documented in a special log file.

plesk-extensions-part1-screenshot5-1024x581.png


To see the status, you can type

$ sudo tail -f var/log/plesk/install/autoinstaller3.log

in your terminal. Now it’s time to get a coffee, this can take a while! You will see a “Congratulations” message after the installation and you can verify it by typing

$ plesk version

into 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

$ sudo plesk bin admin --show-password



Note: For help on password retrieval, go here.

plesk-extensions-part1-screenshot6-1024x581.png


We are almost there! Now open your browser and type the address “http://localhost:8880” into 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 “Other” – “Power User”. The last step is to enter your (trial) license key and you are ready to go!

plesk-extensions-part1-screenshot7-1024x581.png


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 how to add auto-completion to make our life easier.

Stay tuned!


The post Develop Plesk Extensions Series: Install a Local Version of Plesk appeared first on Plesk Developers Blog.

Continue reading...
 
Back
Top