Skip to content

Installation (Composer)

Note: This is an alternative way to install and update Poweradmin using Composer.

Prerequisites

  • PHP 8.2 or higher
  • Composer 2.x installed on your system
  • Required PHP extensions: intl, gettext, openssl, filter, tokenizer, xml, pdo, plus one of pdo_mysql / pdo_pgsql / pdo_sqlite

See System Requirements for the full list.

Installing Poweradmin

To install the latest stable version of Poweradmin, you can use the following Composer command:

composer create-project --no-dev poweradmin/poweradmin

This command will create a poweradmin folder in the current directory, download, and set up Poweradmin without development dependencies. After running the Composer command, you need to create or modify the configuration file at config/settings.php with your database and application settings.

Directory Structure

After installation, you should have the following structure:

poweradmin/
├── ...
├── config/
│ ├── settings.defaults.php
│ └── settings.php
├── lib/
├── ...
├── vendor/
├── composer.json
└── composer.lock

Basic Configuration

Here is an example of what the config/settings.php file should look like:

<?php

return [
    /**
     * Database Settings
     */
    'database' => [
        'host' => 'localhost',
        'name' => 'your_db_name',
        'user' => 'your_db_user',
        'password' => 'your_db_password',
        'type' => 'mysql', // or 'pgsql', 'sqlite'
    ],

    /**
     * Security Settings
     */
    'security' => [
        'session_key' => 'generate_a_strong_random_key_here',
    ],

    /**
     * DNS Settings
     */
    'dns' => [
        'hostmaster' => 'hostmaster.example.com',
        'ns1' => 'ns1.example.com',
        'ns2' => 'ns2.example.com',
    ],
];

See Basic Configuration for all available options.

SQLite Database Settings

If you are using SQLite, modify the database section in the config/settings.php file:

'database' => [
    'type' => 'sqlite',
    'file' => '/path/to/your/sqlite.db',
],

Important: Ensure proper file permissions and directory location for the SQLite database file.

Updating Poweradmin

composer create-project makes Poweradmin itself the root package, so there is no dependency to bump with composer update poweradmin/poweradmin. Update a Composer-installed copy the same way as any other source install: follow the upgrade guide, replace the application files with the new release, keep your config/settings.php, and apply the database migrations for every version you skip.

Post-Installation Steps

  1. Set up the database schema (see MySQL/MariaDB, PostgreSQL, or SQLite setup)
  2. Configure web server permissions
  3. Set up initial admin user (see instructions below)
  4. Configure PowerDNS connection

Creating the Initial Admin User Manually

If you're not using the web installer or prefer to set up your admin user directly in the database, follow these steps:

1. Generate a password hash

You'll need to create a secure password hash. You can use PHP from the command line to generate one:

php -r 'echo password_hash("your_secure_password", PASSWORD_BCRYPT, ["cost" => 12]) . "\n";'

This matches what the web installer does (bcrypt with cost 12). The default cost is configurable via security.password_cost in config/settings.php.

Copy the resulting hash which will look something like:

$2y$10$abcdefghijklmnopqrstuOzxLkPHAUXTCg9vRMf/Q4WrCQI3K.0jK

2. Insert the admin user into the database

The same SQL works for MySQL/MariaDB, PostgreSQL, and SQLite:

INSERT INTO users
    (username, password, fullname, email, description, perm_templ, active, use_ldap, auth_method)
VALUES
    ('admin', 'THE_PASSWORD_HASH_YOU_GENERATED', 'Administrator', 'admin@example.com', 'System Administrator', 1, 1, 0, 'sql');

Note: Administrative rights come from the perm_templ column on the users row, not from a separate join table. Permission template id = 1 is the seeded "Administrator template with full rights".

3. Verify user creation

You should now be able to log in to Poweradmin at /login with username admin and the password you hashed in step 1.

Troubleshooting

For common installation issues and solutions, see Debugging.