Wednesday, June 28, 2017

Debian: Install MariaDB on Debian 9 Stretch

Installing MariaDb on linux distribution is one of the most popular search on the internet. In this tutorial, we are going to install MariaDb database on its updated version. 

1. Configure apt source list. This is the first thing you need to doin order to install mariadb correctly. 

vi /etc/apt/source.list



2. Add this lines of code. The red text is the most important. You can check other mirror sites if you dont want the red text here https://downloads.mariadb.org/mariadb/repositories/ . Choose Distro/Release/Version and it will pop up all the mirror sites.

deb http://security.debian.org/debian-security stretch/updates main
deb-src http://security.debian.org/debian-security stretch/updates main
deb http://deb.debian.org/debian/ stretch-updates main non-free contrib
deb-src http://deb.debian.org/debian/ stretch-updates main non-free contrib
deb http://ftp.debian.org/debian/ stretch main non-free contrib
deb-src http://deb.debian.org/debian/ stretch main non-free contrib
deb http://kartolo.sby.datautama.net.id/mariadb/repo/10.2/debian stretch main
deb-src http://kartolo.sby.datautama.net.id/mariadb/repo/10.2/debian stretch main



3. We need to install software-properties-common because this is one of the dependencies of mayriadb server and after that we are going to install GPG keys and fetch it. After the installation we are going to update again our system and then install mariadb server to our system. 

apt install software-properties-common
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
apt update
apt install mariadb-server



Add password for root
Repeat password for root



4. MariaDB Configuration. We need to configure mariadb server to prevent hacker in hacking our system. By using the command mysql_secure_installation, we can change the root password, remove the bloated databases and some privileges to login remotely etc. 


mysql_sercure_installation



change root password? n
Remove anonymous users? Y
Disallow root login remotely? n
Remove test database and access to it? Y
Reload privilege tables now? Y



5. Test MariaDB. Finally, we can now test our installed mariadb database by accessing the command below. 


mysql -u root -p
show databases;



No comments:

Post a Comment