H-Sphere Sysadmin Guide

Customizing Server Configuration Files By Means Of Templates

(H-Sphere 2.5 Beta 4 and up)

 
 

Related Docs:  

H-Sphere Updater Customizing Cron Jobs

Starting with H-Sphere 2.5, you can't customize some major service configuration files (for Web, mail, DNS, databases, etc.) directly, as your changes in these files will be overwritten with the next H-Sphere update! Instead, you need to create config file templates by means of H-Sphere updater and customize these templates instead of default config files.

Please carefully study this document to re-customize:

 

Customizing Config Templates By H-Sphere Updater

(hsphere-update-1-1-3 and up)

Starting with hsphere-update-1-1-3, all default config file templates, except for /etc/resolv.conf, are included into the hsphere-update package and installed in the following locations:

  • CP Apache
    /hsphere/pkg/scripts/templates/cpapache/httpd.conf.tmpl.default
  • Web Apache
    /hsphere/pkg/scripts/templates/apache/httpd.conf.tmpl.default
    /hsphere/pkg/scripts/templates/apache/lsrv.conf.tmpl.default
  • PHP
    Linux:
    /hsphere/pkg/scripts/templates/Linux/php4/php.ini.tmpl.default
    /hsphere/pkg/scripts/templates/Linux/php5/php.ini.tmpl.default
    FreeBSD:
    /hsphere/pkg/scripts/templates/FreeBSD/php4/php.ini.tmpl.default
    /hsphere/pkg/scripts/templates/FreeBSD/php5/php.ini.tmpl.default
  • ProFTPd
    /hsphere/pkg/scripts/templates/proftpd/shared.proftpd.conf.tmpl.default
    /hsphere/pkg/scripts/templates/proftpd/local.proftpd.conf.tmpl.default
  • MySQL
    Linux: /hsphere/pkg/scripts/templates/Linux/my.cnf_tmpl.default
    FreeBSD: /hsphere/pkg/scripts/templates/FreeBSD/my.cnf_tmpl.default
  • PostgreSQL
    Linux: /hsphere/pkg/scripts/templates/Linux/postgresql.conf_tmpl.default
    FreeBSD: /hsphere/pkg/scripts/templates/FreeBSD/postgresql.conf_tmpl.default
  • DNS
  • (since hsphere-bind-9.3.3rc1-1)
    /hsphere/pkg/scripts/templates/named/named.conf.tmpl.default

Note: In Bind versions before 9.3.3rc1, custom template for /etc/resolv.conf is to be touched manually.

You can customize config file templates by means of H-Sphere updater, provided you have not customized your templates already. For this purpose two new options are added to the hspackages wrapper of the H-Sphere update script:

  • hspackages ctemplates=httpdcp,php,httpd,ftpd,mysql,pgsql,named [OPTIONS] - Place custom templates for comma-separated list of services into predefined locations if custom templates are not there already.
  • hspackages edit=IP:/path/to/custom/template - Edit custom template on a specified server in a specified location.

Important:

  • If you run the hspackages ctemplates command without options, it will create custom templates on all related servers of the H-Sphere cluster! To specify particular servers where custom config templates should be created, please use the extended syntax of the hspackages command. For example, to create PHP custom config templates only on the physical boxes 192.168.1.10 and 192.168.1.11, run:

    hspackages ctemplates=php ips=192.168.1.10,192.168.1.11

  • The hspackages ctemplates command should be run only once, in order to create custom config templates! Then you customize these files according to your needs. Next time you run it, it will prompt re-creating your custom config templates, thus you may lose your customization!
    Note: The only exclusion when you need to run hspackages ctemplates again is when a coming version of the hsphere-update package contains updates of default config templates. You will be specially notified of this in the respective update notes.

 

CP Apache

Default CP Apache httpd.conf template is insluded into the hsphere-update and installed here:

/hsphere/pkg/scripts/templates/cpapache/httpd.conf.tmpl.default

To customize them:

  1. Create custom config template:
    1. Download H-Sphere updater for your version, e.g.:

      wget http://www.psoft.net/shiv/HS/releases/U25.0/U25.0/U25.0P4

    2. Run H-Sphere update script for your version, e.g.:

      sh ./U25.0P4

    3. Execute the hspackages wrapper with the ctemplates=httpdcp option:

      hspackages ctemplates=httpdcp [OPTIONS]

      Custom template will be placed into the following location:
      /hsphere/local/home/cpanel/apache/etc/httpd.conf.tmpl.custom

      Important: Please carefully read the about hspackages ctemplates and especially the note about its options!

  2. Edit *.custom files according to your needs.
  3. To immediately apply changes, run the conf file generating script which is as a rule executed in the postinstall section of the package:

    /hsphere/local/home/cpanel/apache/bin/conf_httpdcp

 

Apache

Default config Apache templates are included into the hsphere-update package and installed in the following locations:

/hsphere/pkg/scripts/templates/apache/httpd.conf.tmpl.default
/hsphere/pkg/scripts/templates/apache/lsrv.conf.tmpl.default

To customize them, perform:

  1. Create custom config template:
    1. Download H-Sphere updater for your version, e.g.:

      wget http://www.psoft.net/shiv/HS/releases/U25.0/U25.0/U25.0P1

    2. Run H-Sphere update script for your version, e.g.:

      sh ./U25.0P1

    3. Execute the hspackages wrapper with the ctemplates=httpd option:

      hspackages ctemplates=httpd [OPTIONS]

      Custom templates will be placed into the following locations:
      /hsphere/local/config/httpd/lsrv.conf.tmpl.custom
      /hsphere/local/config/httpd/httpd.conf.tmpl.custom

      Important: Please carefully read the about hspackages ctemplates and especially the note about its options!

  2. Edit *.custom files according to your needs.
  3. To immediately apply changes, run the conf file generating script which is as a rule executed in the postinstall section of the package:

    /hsphere/shared/apache/bin/conf_httpd

 

Customizing /hsphere/shared/apache/htdocs/index.html

If you need to leave /hsphere/shared/apache/htdocs/index.html unchanged after the update, create the following file:

touch /hsphere/local/config/httpd/index.html.custom

If the latter file exists, then you can customize your index.html file without the risk of its being overwritten.

 

PHP 4

(HS 2.5 Beta 5 and up)

Starting with hsphere-php4-4.4.2-1 update, you can customize /hsphere/local/config/httpd/php4/php.ini file by creating its custom version.

For this, perform:

  1. Create custom config template:
    1. Download H-Sphere updater for your version, e.g.:

      wget http://www.psoft.net/shiv/HS/releases/U25.0/U25.0/U25.0P1

    2. Run H-Sphere update script for your version, e.g.:

      sh ./U25.0P1

    3. Execute the hspackages wrapper with the ctemplates=php option:

      hspackages ctemplates=php [OPTIONS]

      Custom templates will be placed into the following location:
      /hsphere/local/config/httpd/php4/php.ini.tmpl.custom

      Important: Please carefully read the about hspackages ctemplates and especially the note about its options!

  2. Edit php.ini.tmpl.custom file according to your needs.
  3. To immediately apply changes, copy:

    cp -p /hsphere/local/config/httpd/php4/php.ini.tmpl.custom /hsphere/local/config/httpd/php4/php.ini

  4. Restart Apache service

 

PHP 5

(HS 2.5 Beta 5 and up)

Starting with hsphere-php5-5.1.2-1 update, you can customize /hsphere/local/config/httpd/php5/php.ini file by creating its custom version.

For this, perform:

  1. Create custom config template:
    1. Download H-Sphere updater for your version, e.g.:

      wget http://www.psoft.net/shiv/HS/releases/U25.0/U25.0/U25.0P1

    2. Run H-Sphere update script for your version, e.g.:

      sh ./U25.0P1

    3. Execute the hspackages wrapper with the ctemplates=php option:

      hspackages ctemplates=php [OPTIONS]

      Custom templates will be placed into the following location:
      /hsphere/local/config/httpd/php5/php.ini.tmpl.custom
    4. Important: Please carefully read the about hspackages ctemplates and especially the note about its options!

  2. Edit php.ini.tmpl.custom file according to your needs.
  3. To immediately apply changes, copy:

    cp -p /hsphere/local/config/httpd/php5/php.ini.tmpl.custom /hsphere/local/config/httpd/php5/php.ini

  4. Restart Apache service

 

FTP

(HS 2.5 RC 2 and up)

FTP config file templates are included into the hsphere-update package and installed in the following locations:

/hsphere/pkg/scripts/templates/proftpd/shared.proftpd.conf.tmpl.default
/hsphere/pkg/scripts/templates/proftpd/local.proftpd.conf.tmpl.default

To customize these templates, perform:

  1. Create custom config template:
    1. Download H-Sphere updater for your version, e.g.:

      wget http://www.psoft.net/shiv/HS/releases/U25.0/U25.0/U25.0P1

    2. Run H-Sphere update script for your version, e.g.:

      sh ./U25.0P1

    3. Execute the hspackages wrapper with the ctemplates=ftpd option:

      hspackages ctemplates=ftpd [OPTIONS]

      Custom templates will be placed into the following locations:
      /hsphere/local/config/ftpd/proftpd.conf.tmpl.custom
      /hsphere/shared/config/ftpd/proftpd.conf.tmpl.custom

      Important: Please carefully read the about hspackages ctemplates and especially the note about its options!

  2. Edit *.custom files according to your needs.
  3. To immediately apply changes, run:

    /hsphere/shared/config/ftpd/configure-proftpd.sh

  4. Restart FTP service

 

MySQL

MySQL config file templates are included into the hsphere-update package and installed in the following locations:

Linux: /hsphere/pkg/scripts/templates/FreeBSD/my.cnf_tmpl.default
FreeBSD: /hsphere/pkg/scripts/templates/Linux/my.cnf_tmpl.default

To customize these templates, perform:

  1. Create custom config template:
    1. Download H-Sphere updater for your version, e.g.:

      wget http://www.psoft.net/shiv/HS/releases/U25.0/U25.0/U25.0P1

    2. Run H-Sphere update script for your version, e.g.:

      sh ./U25.0P1

    3. Execute the hspackages wrapper with the ctemplates=mysql option:

      hspackages ctemplates=mysql [OPTIONS]

      Custom templates will be placed into the following location:
      /hsphere/local/config/mysql/my.cnf_tmpl.custom
      More on customizing config templates by H-Sphere updater.

      Important: Please carefully read the about hspackages ctemplates and especially the note about its options!

  2. Edit /hsphere/local/config/mysql/my.cnf_tmpl.custom according to your needs.
  3. To immediately apply changes, run the conf file generating script which is as a rule executed in the package postinstall section:

    /hsphere/local/config/mysql/scripts/config_mysql

 

PostgreSQL

PostgreSQL config file templates are included into the hsphere-update package and installed in the following locations:

Linux: /hsphere/pkg/scripts/templates/FreeBSD/postgresql.conf_tmpl.default
FreeBSD: /hsphere/pkg/scripts/templates/Linux/postgresql.conf_tmpl.default

To customize these templates, perform:

  1. Create custom config template:
    1. Download H-Sphere updater for your version, e.g.:

      wget http://www.psoft.net/shiv/HS/releases/U25.0/U25.0/U25.0P1

    2. Run H-Sphere update script for your version, e.g.:

      sh ./U25.0P1

    3. Execute the hspackages wrapper with the ctemplates=pgsql option:

      hspackages ctemplates=pgsql [OPTIONS]

      Custom templates will be placed into the following location:
      /hsphere/local/config/pgsql/postgresql.conf_tmpl.custom

      Important: Please carefully read the about hspackages ctemplates and especially the note about its options!

  2. Edit /hsphere/local/config/pgsql/postgresql.conf_tmpl.custom according to your needs.

    Important: By default, PostgreSQL listens on localhost (parameter virtual_host=127.0.0.1 in config file). Change this parameter if required.

  3. To immediately apply changes, run the conf file generating script which is as a rule executed in the package postinstall section:

    /hsphere/local/config/pgsql/scripts/config_pgsql

 

DNS

/etc/resolv.conf

Bind 9.3.3 RC 1 and up

Since hsphere-bind-9.3.3rc1-1 it is possible to customize template for /etc/resolv.conf.

Default template is located at /hsphere/pkg/scripts/templates/named/named.conf.tmpl.default

  1. Create custom config template:
    1. Download H-Sphere updater for your version, e.g.:

      wget http://www.psoft.net/shiv/HS/releases/U25.0/U25.0/U25.0P4

    2. Run H-Sphere update script for your version, e.g.:

      sh ./U25.0P4

    3. Execute the hspackages wrapper with the ctemplates=named option:

      hspackages ctemplates=named [OPTIONS]

      Custom template will be placed into the following location:
      /etc/named.conf.tmpl.custom

      Important: Please carefully read the about hspackages ctemplates and especially the note about its options!

  2. Edit *.custom files according to your needs.
  3. To immediately apply changes, run the conf file generating script which is as a rule executed in the postinstall section of the package:

    /hsphere/local/config/bind/scripts/config_bind

Bind earlier than 9.3.3 RC 1

To leave /etc/resolv.conf unchanged during the update when MyDNS is used, perform:

touch /etc/resolv.conf.custom

If the latter file exists, then you can customize your /etc/resolv.conf file without the risk of its being overwritten.

Important: Starting with hsphere-bind-9.3.1-2, the directive include ~named/local/custom.conf is added into /etc/named.conf.

 

Customizing Other Files Included into H-Sphere Packages

WARNING:
It is not recommended that you customize the files included into H-Sphere packages by yourself. Any alterations made to them are at your own risk!

Besides customization of some major service configuration files (for Web, mail, DNS, databases, etc.), we have implemented for your convenience a possibility to customize other files included into H-Sphere packages. For this, we have created a configuration file /hsphere/local/config/customs/customs.conf and a special template /hsphere/local/config/customs/customs.conf.tmpl that will help you to save customized H-Sphere packages files during future updates.

To customize a file included into H-Sphere Package and save the changes:

  1. Make necessary changes to the file you want to customize.
  2. Copy a template of custom files to a configuration file:
    cp -p /hsphere/local/config/customs/customs.conf.tmpl /hsphere/local/config/customs/customs.conf
  3. Go to the customs.conf file
  4. Add the full path to the customized file(-s) under the mask of the relevant package, e.g.:
    [hsphere-imap-h2.5]
    /etc/rc.d/init.d/courier-imapd
    /etc/rc.d/init.d/courier-imapd-ssl
    /hsphere/local/config/mail/imap/etc/imapd
    /hsphere/local/config/mail/imap/etc/imapd-ssl

Please note that during the package updates all custom files will be saved in the /hsphere/local/config/customs/$package_mask/ directory. The default files of H-Sphere packages, in their turn, will be stored at /hsphere/local/config/customs/default/$package_mask/. The above mentioned locations store the latest versions of both custom and default files, no matter custom or default file is being used.

 


Related Docs:  

H-Sphere Updater Customizing Cron Jobs



© Copyright 1998-2007. Positive Software Corporation.
All rights reserved.