Saturday, November 16, 2024
Google search engine
HomeGuest BlogsHow to Setup ISPConfig DNS Only on CentOS 7

How to Setup ISPConfig DNS Only on CentOS 7

ISPConfig is an open source hosting control panel developed by company ISPConfig UG for Linux. ISPConfig is licensed under BSD license. It is capable of managing multiple servers from one control panel. In this guide, I’ll show you how to set up and use ISPConfig to manage Bind DNS Server.

ISPConfig can manage below software packages and daemons:

  • HTTP: Apache2 and nginx
  • SMTP: Postfix
  • POP3/IMAP: Courier and Dovecot (1.2.x)
  • FTP: PureFTPd
  • DNS: BIND and MyDNS
  • Database: MySQL
  • Statistics: Webalizer and AWStats
  • Virtualization: OpenVZ

For a list of all services and features, check ISPconfig Features page.

Setup ISPConfig DNS Only

To have a functioning ISPConfig DNS only server, we will:

  • Install and configure Bind
  • Install and configure ISPConfig GUI

Step 1: Install and Configure Bind DNS Server

Start by installing epel-release then bind package

sudo yum -y install epel-release

Install bind:

sudo yum -y install bind bind-utils haveged vim

Once bind has been installed, backup configuration file and create a new one:

sudo mv /etc/named.conf /etc/named.conf.bak

Create a new configuration file

sudo vim /etc/named.conf

with below content:

options {
      listen-on port 53 { any; };
      listen-on-v6 port 53 { any; };
      directory       "/var/named";
      dump-file       "/var/named/data/cache_dump.db";
      statistics-file "/var/named/data/named_stats.txt";
      memstatistics-file "/var/named/data/named_mem_stats.txt";
      allow-query     { any; };
      allow-recursion {"none";};
      recursion no;
};
logging {
      channel default_debug {
              file "data/named.run";
              severity dynamic;
      };
};
zone "." IN {
      type hint;
      file "named.ca";
};
include "/etc/named.conf.local";

Create a named.conf.local then start named service

sudo touch /etc/named.conf.local
sudo systemctl enable named.service
sudo systemctl start named.service

Confirm the service is in running state:

$ systemctl status named.service
● named.service - Berkeley Internet Name Domain (DNS)
   Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2023-08-23 14:28:14 UTC; 4s ago
  Process: 1768 ExecStart=/usr/sbin/named -u named -c ${NAMEDCONF} $OPTIONS (code=exited, status=0/SUCCESS)
  Process: 1765 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi (code=exited, status=0/SUCCESS)
 Main PID: 1770 (named)
   CGroup: /system.slice/named.service
           └─1770 /usr/sbin/named -u named -c /etc/named.conf

Aug 23 14:28:14 cent7.mylab.io named[1770]: set up managed keys zone for view _default, file 'managed-keys.bind'
Aug 23 14:28:14 cent7.mylab.io named[1770]: none:104: 'max-cache-size 90%' - setting to 3323MB (out of 3693MB)
Aug 23 14:28:14 cent7.mylab.io named[1770]: configuring command channel from '/etc/rndc.key'
Aug 23 14:28:14 cent7.mylab.io named[1770]: command channel listening on 127.0.0.1#953
Aug 23 14:28:14 cent7.mylab.io named[1770]: configuring command channel from '/etc/rndc.key'
Aug 23 14:28:14 cent7.mylab.io named[1770]: command channel listening on ::1#953
Aug 23 14:28:14 cent7.mylab.io named[1770]: managed-keys-zone: loaded serial 0
Aug 23 14:28:14 cent7.mylab.io named[1770]: all zones loaded
Aug 23 14:28:14 cent7.mylab.io named[1770]: running
Aug 23 14:28:14 cent7.mylab.io systemd[1]: Started Berkeley Internet Name Domain (DNS).

Step 2: Install and Configure ISPConfig

ISPConfig requires:

  • MySQL Database
  • PHP

Install MariaDB Database server

Add MariaDB YUM repository:

cat <<EOF | sudo tee /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.6/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

Install MariaDB Server and Client packages on CentOS 7:

sudo yum -y install MariaDB-server MariaDB-client

Start and enable MariaDB service:

sudo systemctl enable --now mariadb

Secure MariaDB by running mysql_secure_installation.

sudo maradb-secure-installation 

Add Remi repository for installing PHP:

We will install all PHP packages from the Remi repository. Add it like below:

sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install yum-utils
sudo yum-config-manager --disable 'remi-php*'
sudo yum-config-manager --enable remi-php74

Install PHP and required modules

Use the following commands to install PHP and its modules

sudo yum install php php-cli
sudo yum install php-{devel,mysqlnd,gd,imap,ldap,pear,xml,mbstring,mcrypt,snmp,soap,tidy} -y
sudo yum -y install curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel mod_fcgid php-cli wget

Confirm PHP installation by checking the version:

$ php --version
PHP 7.4.33 (cli) (built: Aug  1 2023 09:00:17) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

Install httpd:

sudo yum -y install ntp httpd httpd-devel mod_ssl perl-DateTime-Format-HTTP perl-DateTime-Format-Builder

Set PHP timezone:

$ sudo vim /etc/php.ini
date.timezone = Africa/Nairobi

Restart httpd:

sudo systemctl restart httpd

Install and configure ISPConfig DNS Only

As of this writing, the latest release of ISPConfig is 3.1. Install this using commands below:

cd /tmp 
wget https://ispconfig.org/downloads/ISPConfig-3.2.11.tar.gz

Extract the archive:

tar xfz ISPConfig-3.2.11.tar.gz

Start installation:

cd ispconfig3*/install/
sudo php -q install.php

You should get an initial screen similar to below:

--------------------------------------------------------------------------------
 _____ ___________   _____              __ _         ____
|_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
  | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
  | |  `--. \  __/  | |    / _ \| '_ \|  _| |/ _` |  |_ |
 _| |_/\__/ / |     | \__/\ (_) | | | | | | | (_| | ___\ \
 \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                              __/ |
                                             |___/ 
--------------------------------------------------------------------------------


>> Initial configuration  

Operating System: CentOS Linux 7.9.2009

    Following will be a few questions for primary configuration so be careful.
    Default values are in [brackets] and can be accepted with <ENTER>.
    Tap in "quit" (without the quotes) to stop the installer.

Choose the expert mode of installation, and select install Web Service and DNS

Select language (en,de) [en]: en

Installation mode (standard,expert) [standard]: expert

Full qualified hostname (FQDN) of the server, eg server1.domain.tld  [nms-02.eadc.]: dns-01.example.com

MySQL server hostname [localhost]:

MySQL server port [3306]:

MySQL root username [root]:

MySQL root password []: <set-myslq-root-password>

MySQL database to create [dbispconfig]:

MySQL charset [utf8]:

The next two questions are about the internal ISPConfig database user and password.
It is recommended to accept the defaults which are 'ispconfig' as username and a random password.
If you use a different password, use only numbers and chars for the password.

ISPConfig mysql database username [ispconfig]:

ISPConfig mysql database password [f04c5ec8076ebc8b0083cacfad7c0084]:

Shall this server join an existing ISPConfig multiserver setup (y,n) [n]:

Apache and nginx detected. Select server to use for ISPConfig: (apache,nginx) [apache]: 

Adding ISPConfig server record to database.

Configure Mail (y,n) [y]: n

[WARN] autodetect for Jailkit failed
Force configure Jailkit (y,n) [n]: n

Skipping Jailkit

[WARN] autodetect for pureftpd failed
Force configure pureftpd (y,n) [n]: n

Skipping pureftpd

Configure DNS Server (y,n) [y]: y

Configuring BIND
The Web Server option has to be enabled when you want run a web server or when this node shall host the ISPConfig interface.
Configure Web Server (y,n) [y]: y

Configuring Apache
Configuring vlogger
[WARN] autodetect for OpenVZ failed
Force configure OpenVZ (y,n) [n]: n

Skipping OpenVZ

Configure Firewall Server (y,n) [y]: n

[WARN] autodetect for Metronome XMPP Server failed
Force configure Metronome XMPP Server (y,n) [n]: n

Skipping Metronome XMPP Server

[WARN] autodetect for Fail2ban failed
Force configure Fail2ban (y,n) [n]: n

Skipping Fail2ban

Configuring Apps vhost
Install ISPConfig Web Interface (y,n) [y]: y

Installing ISPConfig
ISPConfig Port [8080]: 

Admin password [4876a034]: 

Do you want a secure (SSL) connection to the ISPConfig web interface (y,n) [y]: y

Generating RSA private key, 4096 bit long modulus
....................................++
....................................................................................................................................++
e is 65537 (0x10001)
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:KE
State or Province Name (full name) []: Nairobi
Locality Name (eg, city) [Default City]: Nairobi
Organization Name (eg, company) [Default Company Ltd]:Computingforgeeks Limited
Organizational Unit Name (eg, section) []:Infrastructure
Common Name (eg, your name or your server's hostname) []:dns-01.example.com
Email Address []:[email protected]

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
writing RSA key
			

Configuring DBServer
Installing ISPConfig crontab
Installing ISPConfig crontab
no crontab for root
Detect IP addresses
Restarting services ...
done..

Open ISPConfig on the firewall:

sudo firewall-cmd --add-port=8080/tcp --permanent
sudo firewall-cmd --reload

You should now be able to access ISPConfig Web Dashboard:

https://server-ip|hostname:8080
ispconfig dns only login

You can start creating DNS zone files and managing records.

ispconfig dns only records min

Similar articles:

How to Install and Configure Dnsmasq on Ubuntu

Install PowerDNS and PowerDNS-Admin on Ubuntu / Debian with MariaDB Backend

RELATED ARTICLES

Most Popular

Recent Comments