2015년 11월 12일 목요일

CentOS7에 MariaDB yum설치

1. yum 설치를 위한 repository 생성 
vi /etc/yum.repos.d/MariaDB.repo

MariaDB.repo 내용([출처2]참고:2015.11.10현재 최신버전)

# MariaDB 10.1 CentOS repository list - created 2015-11-10 10:11 UTC  # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1

2. MariaDB 삭제전
기존에 설치되어있는 MariaDB 서버와 라이브러리는 삭제해두자
#yum remove mariadb-server mariadb-libs -y

3. yum설치 
#yum install MariaDB-server MariaDB-client MariaDB-common -y

4. MariaDB 실행
#service mysql start
혹은
#systemctl start mysql.service

5. MariaDB 자동실행 등록
#chkconfig mysql on
혹은
#systemctl enable mysql.service

6. MariaDB Security 설정
#mysql_secure_installation

In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 그냥엔터
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: ENTER YOUR PASSWORD
Re-enter new password: REPEAT YOUR PASSWORD
Password updated successfully!
Reloading privilege tables..
… Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
… Success!

Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
… Success!

By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
… Success!

Cleaning up…

All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

7. MariaDB 재시작
#service mysql restart
혹은
#systemctl restart mysql.service

8. 방화벽 열기
#firewall-cmd --permanent --zone=public --add-service=mysql

다음번에도 자동으로 방화벽을 열기위해 --permanent 옵션추가

9. 외부접근계정권한 생성
클 라이언트 툴에서 root로 접근해보면  host "xxx.xxx.xxx.xxx' is not allowed to connect to this mariadb server 라는 오류메시지가 나온다. 접근을 위한 계정등록을 해야지만 내부 혹은 외부에서 DB에 접근이 가능해진다.

먼저 터미널에서 DB콘솔 로그인
#mysql -u root -p

로컬에서만 접근가능한 계정생성 및 권한부여
MariaDB [(none)]> create user '신규계정아이디입력'@'localhost' identified by '패스워드입력';
MariaDB [(none)]> grant all privileges on *.* to '신규계정아이디입력'@'localhost';

외부에서 접근가능한 계정생성 및 권한부여(특정 IP로만 접근을 제한하고싶다면 %대신 IP입력)
MariaDB [(none)]> create user '신규계정아이디입력'@'%' identified by '패스워드입력';

MariaDB [(none)]> grant all privileges on *.* to '신규계정아이디입력'@'%';



[출처2]https://downloads.mariadb.org/mariadb/repositories/#mirror=kaist&distro=CentOS&distro_release=centos7-amd64--centos7&version=10.1

댓글 없음:

댓글 쓰기

vsftpd FTP 서버 접속은 성공하였으나, "디렉토리 목록 조회 실패" 현상 발생시

FTP Passive 모드를 활성화 필요. 1. vsftpd 설정 변경 /etc/vsftpd/vsftpd.conf 상에 아래 내용 추가 기입 #passive modpasv_enable=YES pasv_min_port=5001 pasv...