Wednesday 24 October 2018

How to Setup a MariaDB Server v10.2 in an iocage Jail on FreeNAS 11.1

بسم الله الرحمن الرحيم


Abstract



Tutorial on how to setup MariaDB Database Server v10.2.17 in an iocage Jail on FreeNAS 11.1.


Assumptions and Prerequisites



  • OS: FreeNAS 11.1-U6
  • FreeNAS Host: fn
  • FreeNAS Network Interface: igb0
  • FreeNAS IP: 10.0.0.2
  • FreeNAS Subnet Mask: 24
  • Jail Container: iocage
  • iocage Version: 1.0 Alpha
  • Jail Release: 11.1-RELEASE
  • Jail Name: test
  • Jail Network Interface: vnet0
  • Jail Network Config: DHCP
  • Jail Default Route: 10.0.0.1
  • IP Version: IPv4
  • Bridge Network Interface: bridge0
  • DNS 1: 10.0.0.1 
  • Domain: example.com
  • ZPool Volume: tank
  • Database: MariaDB
  • Database Version: 10.2.17
  • Setup iocage Jail


Install MariaDB


root@test:~ # pkg install mariadb102-server



MariaDB Configuration


Choose the configuration file from template for Database server eg: my-small.cnf, my-medium.cnf, my-large.cnf, or my-huge.cnf
root@test:~ # cp /usr/local/share/mysql/my-small.cnf /usr/local/etc/my.cnf 



Enable MariaDB Server to start on boot


root@test:~ # sysrc mysql_enable="yes"


Start MariaDB Server


root@test:~ # service mysql-server start


Configure and Secure MariaDB Server for production


root@test:~ # mysql_secure_installation

   Enter current password for root (enter for none): [Press Enter]
   Set root password? [Y/n]: y
   Remove anonymous users? [Y/n]: y
   Disallow root login remotely? [Y/n]: y
   Remove test database and access to it? [Y/n]: y
   Reload privilege tables now? [Y/n]: y


Test Login of 'root' user


root@test:~ # mysql -u root -p


Test SQL Queries


MariaDB [(none)]> select user,host,password from mysql.user;
MariaDB [(none)]> show databases; 
MariaDB [(none)]> exit;



Helpful Commands


Search for package
root@test:~ # pkg search mariadb


Resource Links


No comments: