Recently I set up a VPS, and for the Control Panel I initially chose VestaCP, but after researching the forums a bit I came to the conclusion that it is preferable to use HestiaCP, a fork of VestaCP.

I do not go into detail for all the reasons, but from online reviews it seems that HestiaCP is better maintained than VestaCP, and the interface seems a little friendlier, although it does not rise to the level of CPanel or Plesk, but being free it doesn’t matter that much anymore!

Initially I moved a few personal sites, most of which have been functional for a long time, I usually use Wordpress or ClassicPress, depending on the situation.

Recently, however, I had to setup a new site and I wanted to put ClassicPress and as the HestiaCP WepApp installation interface is only with Wordpress, I decided to find a solution to add ClassicPress, it will be much easier next time for other sites!

After a little “work” and searching through the server files, I found the solution, I implemented it, I tested it on Ubuntu 20.04 + HestiaCP v1.3.1 (+1.3.2) and below are all the necessary steps to do the same!

1). Locate the Wordpress Installer and make a copy like this:

@ cd /usr/local/hestia/web/src/app/WebApp/Installers/

@ cp WordpressSetup.php ClassicPressSetup.php

usr_local_hesta_web_src_app_WebApp Installers-Classicpress

2). Edit the ClassicPressSetup.php file as follows:

<?php namespace Hestia\WebApp\Installers; use Hestia\System\Util; class ClassicPressSetup extends BaseSetup { protected $appname = 'classicpress'; protected $config = [ 'form' => [
            //'protocol' => [
            //    'type' => 'select',
            //    'options' => ['http','https'],
            //],
            'site_name' => ['type'=>'text', 'value'=>'ClassicPress Blog'],
            'site_description' => ['value'=>'Another ClassicPress site'],
            'classicpress_account_username' => ['value'=>'wpadmin'],
            'classicpress_account_email' => 'text',
            'classicpress_account_password' => 'password',
            ],
        'database' => true,
        'resources' => [
            'archive'  => [ 'src' => 'https://www.classicpress.net/latest.tar.gz' ],
        ],

    ];

    public function install(array $options = null)
    {
        parent::install($options);

        $this->appcontext->runUser('v-open-fs-file',[$this->getDocRoot("wp-config-sample.php")], $result);

        $distconfig = preg_replace( [
                '/database_name_here/', '/username_here/', '/password_here/'
            ], [
                $this->appcontext->user() . '_' . $options['database_name'],
                $this->appcontext->user() . '_' . $options['database_user'],
                $options['database_password']
            ],
            $result->text);

        while (strpos($distconfig, 'put your unique phrase here') !== false) {
            $distconfig = preg_replace( '/put your unique phrase here/', Util::generate_string(64), $distconfig, 1);
        }

        $tmp_configpath = $this->saveTempFile($distconfig);

        if(!$this->appcontext->runUser('v-move-fs-file',[$tmp_configpath, $this->getDocRoot("wp-config.php")], $result)) {
            throw new \Exception("Error installing config file in: " . $tmp_configpath . " to:" . $this->getDocRoot("wp-config.php") . $result->text );
        }

        exec("/usr/bin/curl --location --post301 --insecure --resolve ".$this->domain.":80:".$this->appcontext->getWebDomainIp($this->domain)." "
            . escapeshellarg("http://".$this->domain."/wp-admin/install.php?step=2")
            . " -d " . escapeshellarg(
                "weblog_title=" . rawurlencode($options['site_name'])
            . "&user_name="      . rawurlencode($options['classicpress_account_username'])
            . "&admin_password=" . rawurlencode($options['classicpress_account_password'])
            . "&admin_password2=". rawurlencode($options['classicpress_account_password'])
            . "&admin_email="    . rawurlencode($options['classicpress_account_email'])), $output, $return_var);

        return ($return_var === 0);
    }
}

Save your changes and move on to the next step.

3). Locate the folder where Hestia keeps the images / logo for applications

@ cd /usr/local/hestia/web/images/

copy the original logo from the ClassicPress website to the respective folder and rename it in the format used by HestiaCP

@ wget https://www.classicpress.net/wp-content/ClassicPress-Design/Logo/autogenerated/classicpress-logo-coin-white-on-gradient-600x600.png

@ mv classicpress-logo-coin-white-on-gradient-600x600.png cp-thumb.png

usr_local_hestia web_images_webapps_logo

4). Locate the HestiaCP file for the WebApp template,

that is, the file that formats the applications present in the web interface and open it for modification:

@ cd /usr/local/hestia/web/add/webapp

@ nano index.php

Modify as in the example below and save the file:

$v_web_apps = [
    [ 'name'=>'Classicpress', 'group'=>'cms', 'enabled'=>true, 'version'=>'latest', 'thumbnail'=>'/images/webapps/cp-thumb.png' ],
    [ 'name'=>'Wordpress', 'group'=>'cms', 'enabled'=>true, 'version'=>'latest', 'thumbnail'=>'/images/webapps/wp-thumb.png' ],
    [ 'name'=>'Drupal',    'group'=>'cms', 'enabled'=>false,'version'=>'latest', 'thumbnail'=>'/images/webapps/drupal-thumb.png' ],
    [ 'name'=>'Joomla',    'group'=>'cms', 'enabled'=>false,'version'=>'latest', 'thumbnail'=>'/images/webapps/joomla-thumb.png' ],

    [ 'name'=>'Opencart',   'group'=>'ecommerce', 'enabled'=>true,  'version'=>'3.0.3.3', 'thumbnail'=>'/images/webapps/opencart-thumb.png' ],
    [ 'name'=>'Prestashop', 'group'=>'ecommerce', 'enabled'=>true, 'version'=>'1.7.6.5', 'thumbnail'=>'/images/webapps/prestashop-thumb.png' ],

    [ 'name'=>'Laravel', 'group'=>'starter', 'enabled'=>true, 'version'=>'7.x', 'thumbnail'=>'/images/webapps/laravel-thumb.png' ],
    [ 'name'=>'Symfony', 'group'=>'starter', 'enabled'=>true, 'version'=>'4.3.x', 'thumbnail'=>'/images/webapps/symfony-thumb.png' ],
];

* NOTE: If HestiaCP does an automatic upgrade, it will rewrite the file /usr/local/hestia/web/add/webapp/index.php, consequently ClassicPress will disappear from Webapp. So after each upgrade you will have to re-edit this file!

5). Check in Hestia Control Panel if ClassicPress is present!

  • Log in to the administration interface and check if ClassicPress appears in the list of available applications, it should be the first, just like in the image below!

WebApp Hestia-Control-Panel ClassicPress

  • Add a new domain – it can be a test one – and check the installation, fill in all the necessary fields including username and password … otherwise it will only be partially installed.

HestiaCP-ClasicPress WebApp-Installer-Interface

If an installation error occurs, something has certainly not been done well or the above tutorial is no longer up to date, other changes have appeared in the new versions. Otherwise, if everything is ok, something similar should appear as in the image below: ClassicPress App was installed succesfully!

WEB-Hestia-Control-Panel Install-App-Classicpress

Where you can find the applications present in this article:

  • HestiaCP – https://www.hestiacp.com/
  • ClassicPress – https://www.classicpress.net/
  • Wordpress – https://wordpress.org/
  • Ubnutu – https://ubuntu.com/download
Tags: , , ,

Leave a Reply

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