Skip to content

Instantly share code, notes, and snippets.

@sasajib
Last active January 12, 2023 12:24
Show Gist options
  • Save sasajib/3bdf78761c973bc880c1e43afd0f4ffd to your computer and use it in GitHub Desktop.
Save sasajib/3bdf78761c973bc880c1e43afd0f4ffd to your computer and use it in GitHub Desktop.

Revisions

  1. sasajib renamed this gist Jan 12, 2023. 1 changed file with 0 additions and 0 deletions.
  2. sasajib revised this gist Jan 12, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions install_powerdns_ubuntu_20.04.md
    Original file line number Diff line number Diff line change
    @@ -72,4 +72,6 @@ Finally, restart the PowerDNS service to apply
    systemctl restart pdns
    ```

    now you have configured the powerdns, and api server is running on port `8081`


  3. sasajib revised this gist Jan 12, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_powerdns_ubuntu_20.04.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    PowerDNS is a widely used DNS server software that can be configured to use different backends, including SQLite3.
    In this article, we will show you how to install PowerDNS with SQLite3 on Ubuntu 22.04 and enable the backend service.

    #### #note: become root or use sudo
    #### # note: become root or use sudo

    ## Step 1: Configure DNS
    'systemd-resolved' conflict with port 53, The first step is to configure the DNS settings in the file.
  4. sasajib revised this gist Jan 12, 2023. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions install_powerdns_ubuntu_20.04.md
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@
    PowerDNS is a widely used DNS server software that can be configured to use different backends, including SQLite3.
    In this article, we will show you how to install PowerDNS with SQLite3 on Ubuntu 22.04 and enable the backend service.

    #### #note: become root or use sudo

    ## Step 1: Configure DNS
    'systemd-resolved' conflict with port 53, The first step is to configure the DNS settings in the file.
    ```sh
    @@ -66,5 +68,8 @@ Replace "some_api_key_123" with the desired password you want to use.

    ## Step 7: Restart PowerDNS
    Finally, restart the PowerDNS service to apply
    ```sh
    systemctl restart pdns
    ```


  5. sasajib created this gist Jan 12, 2023.
    70 changes: 70 additions & 0 deletions install_powerdns_ubuntu_20.04.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,70 @@
    # Installing PowerDNS with SQLite3 and Enabling the Backend Service

    PowerDNS is a widely used DNS server software that can be configured to use different backends, including SQLite3.
    In this article, we will show you how to install PowerDNS with SQLite3 on Ubuntu 22.04 and enable the backend service.

    ## Step 1: Configure DNS
    'systemd-resolved' conflict with port 53, The first step is to configure the DNS settings in the file.
    ```sh
    # nano /etc/systemd/resolved.conf
    DNS=1.1.1.1
    ```
    This will set the DNS server to 1.1.1.1, which is a popular public DNS server.

    Next, create a symbolic link
    ```sh
    ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
    ```

    This will ensure that the DNS settings are used by the system.

    ## Step 2: Disable systemd-resolved
    The next step is to disable the systemd-resolved service. This service is used by default in Ubuntu to handle DNS resolution and conflicts with PowerDNS. To disable the service, run the following command

    ```sh
    systemctl disable --now systemd-resolved
    ```

    ## Step 3: Install PowerDNS and SQLite3
    Now that the DNS settings are configured and the systemd-resolved service is disabled, we can install PowerDNS and SQLite3. To do this, run the following command:

    ```sh
    apt-get install sqlite3 pdns-server pdns-backend-sqlite3
    ```

    This command will install both PowerDNS and the SQLite3 backend for PowerDNS.

    ## Step 4: Configure SQLite3 for PowerDNS
    The next step is to configure PowerDNS to use SQLite3 as the backend.
    To do this, we will create a new file in the directory `/etc/powerdns/pdns.d/` called `sqlite.conf`.
    In this file, we will add the following lines:

    ```sh
    # nano /etc/powerdns/pdns.d/sqlite.conf
    launch=gsqlite3
    gsqlite3-database=/var/lib/powerdns/pdns.sqlite3
    ```
    This tells PowerDNS to use the SQLite3 backend and the location of the SQLite3 database.

    ## Step 5: Create the SQLite3 Database

    We will now create the SQLite3 database and configure the correct permissions on it with the following command:
    ```sh
    sqlite3 /var/lib/powerdns/pdns.sqlite3 < /usr/share/doc/pdns-backend-sqlite3/schema.sqlite3.sql
    sudo chown -R pdns:pdns /var/lib/powerdns
    ```

    ## Step 6: Configure PowerDNS
    Next, we will configure PowerDNS to allow API access. To do this, open the file /etc/powerdns/pdns.conf with a text editor and add the following lines:
    ```sh
    # nano /etc/powerdns/pdns.conf
    api=yes
    api-key=some_api_key_123
    ```
    Replace "some_api_key_123" with the desired password you want to use.


    ## Step 7: Restart PowerDNS
    Finally, restart the PowerDNS service to apply