Maria DB 설치 방법에 대한 가이드 포스트이다.
이 포스트는 ‘ThinkGround Project#1‘의 일환으로 GCP에 Cent OS 이미지의 VM Instance를 생성하여 진행하고 있다.
![](https://i0.wp.com/thinkground.studio/wp-content/uploads/2019/04/190414_maria-db.png?resize=640%2C224)
이전 포스트(GCP VM Instance(Cent-OS) 기본 세팅하기)를 참고한 분들이라면 이미 yum update를 했을 것이니 여기서는 패스하도록 하겠다.
![cat MariaDB.repo](https://i0.wp.com/thinkground.studio/wp-content/uploads/2019/04/190414_cat-mariadb-repo.png?resize=532%2C127)
# vim /etc/yum.repos.d/MariaDB.repo
위 command를 입력하여 하기 cat으로 출력한 내용에 대해 입력할 수 있도록 하자. vim editer에 대해서 잘 모르는 분들이라면 타 포스트를 참고하면 기본적인 것들은 쉽게 사용할 수 있다. i를 눌러서 ‘insert’모드에 돌입하여 위 내용을 입력해주면 되고, 입력이 끝났으면 esc를 눌러 다시 ‘command’ 모드로 변경 후, ‘:wq’를 입력 후 enter를 눌러 빠져나오면 된다.
![yum install -y mariadb mariadb-server](https://i1.wp.com/thinkground.org/wp-content/uploads/2019/04/190414_yum-install-mariadb.png?fit=864%2C330&ssl=1)
# yum install -y mariadb mariadb-server
그 후에 yum을 통해 Maria DB 를 설치해준다. 여기서 -y는 이후 물어보는 질문에 대해 yes처리를 하겠다는 뜻이다. 그럼 자동으로 설치가 된다. 만약 여기서 설치가 제대로 되지 않는다면, yum update가 안되어있는 경우가 많으니 다시 확인해보는 것을 추천한다.
![](https://i0.wp.com/thinkground.studio/wp-content/uploads/2019/04/190414_systemctl-start-mariadb.png?resize=544%2C19)
# systemctl start mariadb
설치가 완료된 후 mariadb를 실행하는 커맨드이다.
![mysql_secure_installation_1](https://i0.wp.com/thinkground.studio/wp-content/uploads/2019/04/190414_mysql-secure-installation.png?resize=736%2C305)
![mysql_secure_installation_2](https://i0.wp.com/thinkground.studio/wp-content/uploads/2019/04/190414_mysql-secure-installation_2.png?resize=733%2C566)
![mysql_secure_installation_3](https://i0.wp.com/thinkground.studio/wp-content/uploads/2019/04/190414_mysql-secure-installation_3.png?resize=691%2C420)
# mysql_secure_installation
그 이후 보안설정을 해줘야 한다. 위에 캡쳐를 해두었으니 참고해서 진행하면 될 듯하다.
![systemctl enable mariadb](https://i0.wp.com/thinkground.studio/wp-content/uploads/2019/04/190414_systemctl-enable-mariadb.png?resize=454%2C18)
# systemctl enable mariadb
위 command를 통해 mariadb가 자동실행되게끔 설정해두면 기본 세팅은 끝난다.