Author Archives: Geneva Sibanda

About Geneva Sibanda

I assist companies in the Areas of Network Infrastructure Design and Implementation: (from Windows Active Directory Security, networking, etc.).

Failed to get available update data. Drupal 8

Last checked: 2 years 6 months ago (Check manually)

There was a problem getting update information. Try again later.

Solution:

Run this to clear cache and checked by system.

SQL query

root@en-db-03:~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.41-MariaDB-0+deb9u1 Debian 9.9

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use myD2B;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [myD2B]> show tables;
+——————————+
| Tables_in_esgDB |
+——————————+
| batch |
| block_content |
| block_content__body |
| block_content_field_data |
| block_content_field_revision |
| block_content_revision |
| block_content_revision__body |
| cache_bootstrap |
| cache_config |
| cache_container |
| cache_data |
| cache_default |
| cache_discovery |
| cache_dynamic_page_cache |
| cache_entity |
| cache_menu |
| cache_page |
| cache_render |
| cache_toolbar |
| cachetags |
| comment |
| comment__comment_body |
| comment_entity_statistics |
| comment_field_data |
| config |
| file_managed |
| file_usage |
| flood |
| history |
| key_value |
| key_value_expire |
| menu_link_content |
| menu_link_content_data |
| menu_tree |
| node |
| node__body |
| node__comment |
| node__field_image |
| node__field_tags |
| node_access |
| node_field_data |
| node_field_revision |
| node_revision |
| node_revision__body |
| node_revision__comment |
| node_revision__field_image |
| node_revision__field_tags |
| queue |
| router |
| search_dataset |
| search_index |
| search_total |
| semaphore |
| sequences |
| sessions |
| shortcut |
| shortcut_field_data |
| shortcut_set_users |
| taxonomy_index |
| taxonomy_term_data |
| taxonomy_term_field_data |
| taxonomy_term_hierarchy |
| url_alias |
| user__roles |
| user__user_picture |
| users |
| users_data |
| users_field_data |
| watchdog |
+——————————+
69 rows in set (0.00 sec)

MariaDB [myD2B]> delete from key_value where collection=’update_fetch_task’;
Query OK, 2 rows affected (0.01 sec)

MariaDB [myD2B]>

How to backup and Restore ISPConfig 3

I recently backup and restored an ISPConfig 3 server

root@za-02-802:#mkdir -p /backups/os/ispconfigbkup
root@za-02-802:#cd /backups/os/ispconfigbkup

Back up all of the databases on a server:

root@za-02-802:/backups/os/ispconfigbkup# mysqldump -u root -p –all-databases > all-database.sql
root@za-02-802:/backups/os/ispconfigbkup# tar -pczf completeserverbackup.tar.gz /backups/os/all-database.sql /home /var/vmail /var/log /var/www /var/lib /etc /opt/letsencrypt /usr/local/ispconfig

Restore to a New Server or Reinstallation

root@za-02-802:#mkdir -p /backups/os/ispconfigbkup
root@za-02-802:~# cd /backups/os/ispconfigbkup
root@za-02-802:/backups/os/ispconfigbkup# tar xvfz completeserverbackup.tar.gz
root@za-02-802:/backups/os/ispconfigbkup# mysql -u root -p < all-database.sql

How to Upgrade IOS Image on Cisco Catalyst Switch 2960x

Firstly before upgrading IOS, you need to obtain the latest IOS version by logging on to Cisco Software Central at https://software.cisco.com/ and selecting your device type and version.

Please note that configure, price, and order Cisco products, software, and services. Available to partners and to customers with a direct purchasing agreement.

In my case I will be upgrading IOS image for Cisco Catalyst 2960X-24TS-L Switch. The downloaded c2960x-universalk9-mz.152-6.E2.bin file must be copied to your TFTP server as we will transfer the IOS image and perform our upgrade IOS via TFTP.

login as: admin
Using keyboard-interactive authentication.
Password:


UNAUTHORIZED ACCESS TO THIS DEVICE IS PROHIBITED.

You must have explicit, authorized permission to access or configure this device. Unauthorized attempts and actions to access or use this system may result in civil and/or criminal penalties. All activities performed on this device are logged and monitored.


HO_SW01>en
Password:
HO_SW01#dir
Directory of flash:/

2 -rwx 3828 Dec 17 2018 12:20:59 +00:00 private-config.text
3 -rwx 616 Nov 24 2018 14:59:06 +00:00 vlan.dat
4 -rwx 3096 Dec 17 2018 12:20:59 +00:00 multiple-fs
5 -rwx 624 Nov 16 2018 19:16:47 +00:00 express_setup.debug
6 drwx 512 Jun 5 2016 20:12:07 +00:00 c2960x-universalk9-mz.152-2.E3
671 drwx 512 Jun 5 2016 20:12:07 +00:00 dc_profile_dir
673 -rwx 2688 Nov 17 2018 13:46:40 +00:00 config.text.renamed
674 -rwx 1915 Nov 17 2018 13:46:40 +00:00 private-config.text.renamed
675 -rwx 2835 Dec 17 2018 12:20:59 +00:00 config.text

122185728 bytes total (95062016 bytes free)

HO_SW01#show switch
Switch/Stack Mac Address : 0056.2b8c.7200
H/W Current

Switch# Role Mac Address Priority Version State

*1 Master 0056.2b8c.7200 1 4 Ready

122185728 bytes total (68257280 bytes free)

HO_SW01#show version

Switch Ports Model SW Version SW Image
—— —– —– ———- ———-
*1 28 WS-C2960X-24TS-L 15.2(2)E3 C2960X-UNIVERSALK9-M

Configuration register is 0xF

HO_SW01#show boot
BOOT path-list : flash:/c2960x-universalk9-mz.152-2.E3/c2960x-universalk9-mz.152-2.E3.bin
Config file : flash:/config.text
Private Config file : flash:/private-config.text
Enable Break : yes
Manual Boot : no
Allow Dev Key : yes
HELPER path-list :
Auto upgrade : yes
Auto upgrade path :
NVRAM/Config file
buffer size: 524288
Timeout for Config
Download: 0 seconds
Config Download
via DHCP: disabled (next boot: disabled)

HO_SW01#delete /f /r flash:/c2960x-universalk9-mz.152-2.E3

HO_SW01#copy tftp flash1
Address or name of remote host []? 10.11.1.33
Source filename []? c2960x-universalk9-mz.152-6.E2.bin
Destination filename [flash1]? c2960x-universalk9-mz.152-6.E2.bin
Accessing tftp://10.11.1.33/c2960x-universalk9-mz.152-6.E2.bin…
Loading c2960x-universalk9-mz.152-6.E2.bin from 10.11.1.33 (via Vlan1): !!!!!!!!!!!!!O!!O!!O!!!!O!!!!!!!!!!!O!!!!!!!!!!!!!!!!!!!!!!!!!!!!O!OO!!!!!!!!!!!!O!!O!!O!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK – 26590208 bytes]

26590208 bytes copied in 443.670 secs (59932 bytes/sec)

HO_SW01#verify /md5 flash1:c2960x-universalk9-mz.152-6.E2.bin
…………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………Done!
verify /md5 (flash:c2960x-universalk9-mz.152-6.E2.bin) = 94167367c0a8ebde238177a4b9d9b5c4

HO_SW01#config t
Enter configuration commands, one per line. End with CNTL/Z.
HO_SW01(config)#boot system switch all flash:c2960x-universalk9-mz.152-6.E2.bin
HO_SW01(config)#end
HO_SW01#show boot
BOOT path-list : flash:c2960x-universalk9-mz.152-6.E2.bin
Config file : flash:/config.text
Private Config file : flash:/private-config.text
Enable Break : yes
Manual Boot : no
Allow Dev Key : yes
HELPER path-list :
Auto upgrade : yes
Auto upgrade path :
NVRAM/Config file
buffer size: 524288
Timeout for Config
Download: 0 seconds
Config Download
via DHCP: disabled (next boot: disabled)
HO_SW01#write mem
Building configuration…
[OK]
HO_SW01#show switch
Switch/Stack Mac Address : 0056.2b8c.7200
H/W Current
Switch# Role Mac Address Priority Version State

*1 Master 0056.2b8c.7200 1 4 Ready

HO_SW01#reload
Proceed with reload? [confirm]
login as: admin
Using keyboard-interactive authentication.
Password:


UNAUTHORIZED ACCESS TO THIS DEVICE IS PROHIBITED.

You must have explicit, authorized permission to access or configure this device. Unauthorized attempts and actions to access or use this system may result in civil and/or criminal penalties. All activities performed on this device are logged and monitored.


HO_SW01>en
Password:
HO_SW01#show boot
BOOT path-list : flash:c2960x-universalk9-mz.152-6.E2.bin
Config file : flash:/config.text
Private Config file : flash:/private-config.text
Enable Break : yes
Manual Boot : no
Allow Dev Key : yes
HELPER path-list :
Auto upgrade : yes
Auto upgrade path :
Boot optimization : disabled
NVRAM/Config file
buffer size: 524288
Timeout for Config
Download: 0 seconds
Config Download
via DHCP: disabled (next boot: disabled)
HO_SW01#show version

Switch Ports Model SW Version SW Image
—— —– —– ———- ———-
*1 30 WS-C2960X-24TS-L 15.2(6)E2 C2960X-UNIVERSALK9-M

Configuration register is 0xF

HO_SW01#

Warning:

I am not responsible for any damage to your Cisco Catalyst 2960X-24TS-L Switch. If you point the finger at me for messing up your Cisco Catalyst 2960X-24TS-L Switch, I will laugh at you.

How to Configure the Cisco Switch to Run SSH

For SSH to work, your Cisco switch needs an RSA public/private key pair. The VTY relies on SSH for its secure transport.

Follow these steps to set up your Cisco Switch to run SSH:

Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname HO1
HO1(config)#ip domain-name magwinya.co.za
HO1(config)#crypto key generate rsa
% You already have RSA keys defined named HO1.magwinya.co.za.
% Do you really want to replace them? [yes/no]:
HO1(config)#ip ssh version 2
HO1(config)#line vty 0 4
HO1(config-line)#transport input ssh
HO1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration…
[OK]

Warning:

I am not responsible for any damage to your Cisco Catalyst Switch. If you point the finger at me for messing up your Cisco Catalyst Switch, I will definitely laugh at you.



How to Restrict VTY – SSH access to a specific IP

Controlling Access to a VTY via SSH to a specific IP helps improve security to your Cisco Switches or Routers.

You can control who can access the virtual terminal lines (vtys) to a router or Cisco Switch by applying an access list to inbound vtys.

Switch(config)#access-list 1 remark “Restrict SSH Access”
Switch(config)#access-list 1 permit host 10.11.1.15 log
Switch(config)# line vty 0 4
Switch(config-line)#access-class 1 in
Switch(config-line)#end
Switch#copy running-config startup-config
Destination filename [startup-config]?
Building configuration…
[OK]
Switch#

Perform the above steps when you want to control access to a vty coming into the Cisco router or Cisco Switch by using an access list.

Warning:

I am not responsible for any damage to your Cisco Catalyst Switch. If you point the finger at me for messing up your Cisco Catalyst Switch, I will definitely laugh at you.

How to configure banner MOTD on Cisco switch

In this article I show you how to configure banner MOTD on Cisco switch.

To configure the message-of-the-day (MOTD) banner that displays when the user logs in to a Cisco 2900 Series switch, use the banner motd command.

Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#
Switch(config)#banner motd !
Enter TEXT message. End with the character ‘!’.
————————————————

UNAUTHORIZED ACCESS TO THIS DEVICE IS PROHIBITED.

You must have explicit, authorized permission to access or configure this device. Unauthorized attempts and actions to access or use this system may result in civil and/or criminal penalties. All activities performed on this device are logged and monitored.

————————————————
!
Switch(config)#

The above example shows how to configure a multiple-line MOTD banner.

Warning:

I am not responsible for any damage to your Cisco Catalyst Switch. If you point the finger at me for messing up your Cisco Catalyst Switch, I will definitely laugh at you.

How to Initially Configure a Cisco Switch Tutorial

Configuring the Switch for the First Time.

This guide describes how to initially configure a Catalyst 2900 series switch.

To configure your switch you need a Cisco Console Cable, coupled with USB to 1 Serial (9 Pin) Port. This is totally dependent to the model of your Laptop.

Step 1: Connect to your Cisco Switch via Cisco Console Cable and the Console Interface.

Step 2: Configuration Your Switch Line and Console Ports.

You need to press ENTER and see the user EXEC prompt (Switch>)

Type enable to enter enable mode:
Switch> enable
The prompt changes to the enable prompt (#):
Switch#
Switch# enable

Step 3: At the enable prompt (#), enter the configure terminal command to enter global configuration mode:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#

Step 4: At the global configuration mode prompt, enter the line console 0 to configure your switch Line and console Ports.

Switch(config)#line console 0
Switch(config-line)# exec-timeout 30 0
Switch(config-line)# password yourpasswordhere
Switch(config-line)#logging synchronous
Switch(config-line)#login local
Switch(config-line)#exit
Switch(config)#end
Switch#

Step 5: At the global configuration mode prompt, enter the line vty 0 4 to configure your switch Line.

Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#line vty 0 4
Switch(config-line)# exec-timeout 30 0
Switch(config-line)# password yourpasswordhere
Switch(config-line)# login local
Switch(config-line)# transport input ssh
Switch(config-line)#exit
Switch(config)#enable secret yourpasswordhere
Switch(config)#service password-encryption

Step 6: At the global configuration mode prompt, the VLAN interfaces must be configured with an IP address.

Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface vlan 1
Switch(config-if)#ip address 10.11.1.250 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#ip default-gateway 10.11.1.1
Switch(config)#username sibanda password 7 yourpasswordhere
Switch(config)#exit
Switch#copy running-config startup-config

This example shows how to use the show running-config command to confirm the configuration of the
static route:
Switch# show running-config
Building configuration…

To be continued…

Warning:

I am not responsible for any damage to your Cisco Catalyst Switch. If you point the finger at me for messing up your Cisco Catalyst Switch, I will definitely laugh at you.

NQF Levels

National Qualifications Framework NQF Levels

All qualifications are graded on the NQF (National Qualifications Framework), so you’ve probably seen mention of the NQF before.

The objectives of the NQF are to:

    • Create an integrated national framework for learning achievements
    • Facilitate access to, and mobility and progression within education, training and career paths
    • Enhance the quality of education and training
    • Accelerate the redress of past unfair discrimination in education, training and employment opportunities
    • Contribute to the full personal development to each learner and the social and economic development of the nation at large

SAQA is responsible for running the National Qualifications Framework, or NQF. The NQF originally consisted of eight levels but was later increased to ten levels. The NQF levels run from Adult Basic Education and Training all the way up to doctoral degrees.

NQF Level Qualification Type
HIGHER EDUCATION AND TRAINING CERTIFICATE (HETC)
10 Post-doctoral research degrees

Doctorate

9 Masters degree
8 Professional qualifications
Honours degrees
7 Diplomas

National 1st Degrees

6 Higher Certificates
5 National certificates and
Occupational Awards
FURTHER EDUCATION AND TRAINING CERTIFICATE (FETC)
4 Grade 12
3 Grade 11
2 Grade 10
GENERAL EDUCATION AND TRAINING CERTIFICATE (GETC)
1 Grade 9
Abet level 4
GET certificate

 

How to change the Hostname on a CentOS 7 server via the command line (SSH)

By default, your server is started with the server’s given name as the hostname. Some software, requires a valid Fully Qualified Domain Name (FQDN) for the hostname to be used during their DNS resolution. This article describes how to change a server hostname in CentOS.

Step 1 – Login to your server as a user with root privilege.

[root@en-030 ~]#

Step 2 – Check current hostname:

[root@en-030 ~]# hostname -f
localhost.localdomain

Step 3 – Now here’s the magic command to change default CentOS 7 hostname without having to reboot your server: by running the command line below:

[root@en-030 ~]# hostnamectl set-hostname en-030.magwinya.co.za --static

Step 4 – You may also want to find out status of your server and its hostname using hostnamectl command:

[root@en-030 ~]# hostnamectl status

Your output should look something like this:

[root@en-030 ~]# hostnamectl status
   Static hostname: en-030.magwinya.co.za
         Icon name: computer-server
           Chassis: server
        Machine ID: da8c65185c6b43ee9312d647d153b8fc
           Boot ID: c50ca6a8ecb742079a7a0ef358a2c27e
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-693.2.2.el7.x86_64
      Architecture: x86-64

It recommended that static name match the fully-qualified domain name (FQDN) used for the machine in DNS.

Conclusion

Congratulations! you have successfully configured hostname on CentOS 7 server via command line. You can now easily resolve fully qualified domain name (fqdn) server. Try it out today! Feel free to comment me if you have any questions.

Installing PowerDNS (With MySQL Backend) on Debian

PowerDNS is a DNS server, written in C++ and licensed under the GPL. It runs on most Unix derivatives. PowerDNS features a large number of different backends ranging from simple BIND style zonefiles to relational databases and load balancing/failover algorithms. A DNS recursor is provided as a separate program.

Installation of the PowerDNS Authoritative server on UNIX systems can be done in several ways:

Install updates:

# apt-get install --fix-broken && apt-get update -y && sudo apt-get upgrade -y && apt-get dist-upgrade -y && apt-get autoremove -y 

Installing MySQL

In order to install MySQL, we run

# apt-get install mysql-server mysql-client 

We want MySQL to listen on all interfaces (this is important for MySQL database replication!), not just localhost, therefore we edit /etc/mysql/my.cnf and comment out the line bind-address = 127.0.0.1:
vi /etc/mysql/my.cnf

Then we restart MySQL:

# service mysql restart 

Now check that networking is enabled. Run

# netstat -tap | grep mysql 

The output should look like this:

root@NS01~# netstat -tap | grep mysql
tcp        0      0 localhost:mysql         *:*                     LISTEN      952/mysqld 

Installing PowerDNS

To install PowerDNS, we run

# apt-get install -y pdns-server pdns-backend-mysql 

You will be prompted to configure the MySQL backend. We will perform this process manually in a moment, so use the arrow keys to select , and press ENTER to finish the installation.

Now we connect to MySQL:

# mysql -u root -p 

Type in your MySQL root password, and you should be on the MySQL shell. On the MySQL shell, we create a database for PowerDNS:

CREATE DATABASE powerdns; 

 grant all privileges on powerdns.* to power_user@localhost identified by 'TypeYourPasswordHere';

FLUSH PRIVILEGES;

Now we create the tables needed by PowerDNS...

use powerdns;

CREATE TABLE domains (
  id                    INT AUTO_INCREMENT,
  name                  VARCHAR(255) NOT NULL,
  master                VARCHAR(128) DEFAULT NULL,
  last_check            INT DEFAULT NULL,
  type                  VARCHAR(6) NOT NULL,
  notified_serial       INT DEFAULT NULL,
  account               VARCHAR(40) DEFAULT NULL,
  PRIMARY KEY (id)
) Engine=InnoDB;

CREATE UNIQUE INDEX name_index ON domains(name);


CREATE TABLE records (
  id                    INT AUTO_INCREMENT,
  domain_id             INT DEFAULT NULL,
  name                  VARCHAR(255) DEFAULT NULL,
  type                  VARCHAR(10) DEFAULT NULL,
  content               VARCHAR(64000) DEFAULT NULL,
  ttl                   INT DEFAULT NULL,
  prio                  INT DEFAULT NULL,
  change_date           INT DEFAULT NULL,
  disabled              TINYINT(1) DEFAULT 0,
  ordername             VARCHAR(255) BINARY DEFAULT NULL,
  auth                  TINYINT(1) DEFAULT 1,
  PRIMARY KEY (id)
) Engine=InnoDB;

CREATE INDEX nametype_index ON records(name,type);
CREATE INDEX domain_id ON records(domain_id);
CREATE INDEX recordorder ON records (domain_id, ordername);


CREATE TABLE supermasters (
  ip                    VARCHAR(64) NOT NULL,
  nameserver            VARCHAR(255) NOT NULL,
  account               VARCHAR(40) NOT NULL,
  PRIMARY KEY (ip, nameserver)
) Engine=InnoDB;


CREATE TABLE comments (
  id                    INT AUTO_INCREMENT,
  domain_id             INT NOT NULL,
  name                  VARCHAR(255) NOT NULL,
  type                  VARCHAR(10) NOT NULL,
  modified_at           INT NOT NULL,
  account               VARCHAR(40) NOT NULL,
  comment               VARCHAR(64000) NOT NULL,
  PRIMARY KEY (id)
) Engine=InnoDB;

CREATE INDEX comments_domain_id_idx ON comments (domain_id);
CREATE INDEX comments_name_type_idx ON comments (name, type);
CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);


CREATE TABLE domainmetadata (
  id                    INT AUTO_INCREMENT,
  domain_id             INT NOT NULL,
  kind                  VARCHAR(32),
  content               TEXT,
  PRIMARY KEY (id)
) Engine=InnoDB;

CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind);


CREATE TABLE cryptokeys (
  id                    INT AUTO_INCREMENT,
  domain_id             INT NOT NULL,
  flags                 INT NOT NULL,
  active                BOOL,
  content               TEXT,
  PRIMARY KEY(id)
) Engine=InnoDB;

CREATE INDEX domainidindex ON cryptokeys(domain_id);


CREATE TABLE tsigkeys (
  id                    INT AUTO_INCREMENT,
  name                  VARCHAR(255),
  algorithm             VARCHAR(50),
  secret                VARCHAR(255),
  PRIMARY KEY (id)
) Engine=InnoDB;

CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);

When using the InnoDB storage engine, we suggest adding the following lines to the 'create table records' command above:

CONSTRAINT `records_ibfk_1` FOREIGN KEY (`domain_id`) REFERENCES `domains`
(`id`) ON DELETE CASCADE

Or, if you have already created the tables, execute:

ALTER TABLE `records` ADD CONSTRAINT `records_ibfk_1` FOREIGN KEY (`domain_id`)
REFERENCES `domains` (`id`) ON DELETE CASCADE;

Configure PowerDNS

We have to configure PowerDNS to use our new database.

First, remove the existing configuration files:

# rm /etc/powerdns/pdns.d/*

Now we can create the MYSQL configuration file:

# vi /etc/powerdns/pdns.d/pdns.local.gmysql.conf 

Enter the following data into the file. Remember to add your own database settings for gmysql-dbname, gmysql-user, and especially gmysql-password.


# MySQL Configuration file

launch=gmysql

gmysql-host=localhost
gmysql-dbname=powerdns
gmysql-user=powerdns_user
gmysql-password=powerdns_user_password

Restart PowerDNS to apply changes:

# service pdns restart 

Check if PowerDNS is listening:

#netstat -tap | grep pdns

Check if PowerDNS responds correctly:

#dig @127.0.0.1

You should see an output similar to:

root@NS01:~# dig @127.0.0.1

; <<>> DiG 9.9.5-9+deb8u13-Debian <<>> @127.0.0.1
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18854
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1680
;; QUESTION SECTION:
;.                              IN      NS

;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Sat 09 09:10:04 SAST 2017
;; MSG SIZE  rcvd: 28

NB: You won't encounter the following error if you follow this guide:

pdns[23281]: Backend reported permanent error which prevented lookup (GSQLBa.

The installation is not finished...I do not issue any guarantee that this will work for you! but worked for me.

PowerDNS
comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. This is free software, and you are welcome to redistribute.

Reference:

https://doc.powerdns.com/md/authoritative/installation/