본문 바로가기
아빠방/Tech

MariaDB 설치

by 탱탱이아빠 2016. 4. 13.

오픈소스 DB인 MariaDB를 설치해보기로 했다.


현재 시스템 사항은 아래와 같다.


[root@MyOS ~]# uname -a


Linux MyOS 2.6.32-573.18.1.el6.x86_64 #1 SMP Tue Feb 9 22:46:17 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

[root@MyOS ~]# 


[root@MyOS ~]# cat /etc/redhat-release 


CentOS release 6.7 (Final)


바이너리로 설치하기 위해 yum을 이용했다.


[root@MyOS ~]# yum install MariaDB-server MariaDB-client


Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Determining fastest mirrors

 * base: centos.mirror.cdnetworks.com

 * extras: centos.mirror.cdnetworks.com

 * updates: centos.mirror.cdnetworks.com

base                                                 | 3.7 kB     00:00     

extras                                               | 3.4 kB     00:00     

extras/primary_db                                    |  37 kB     00:00     

updates                                              | 3.4 kB     00:00     

updates/primary_db                                   | 4.6 MB     00:00     

No package MariaDB-server available.

No package MariaDB-client available.

Error: Nothing to do


헐... 그런데 설치가 지원되지 않았다. 혹시 yum의 문제인듯 하여 yum을 업데이트 했는데... 뭐이리 업데이트 할게 많은지... 어쨌든...이런저런 메시지들이 출력되고 업데이트가 완료되었다.


[root@MyOS ~]# yum update


Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Update Process

Loading mirror speeds from cached hostfile

 * base: centos.mirror.cdnetworks.com

 * extras: centos.mirror.cdnetworks.com

 * updates: centos.mirror.cdnetworks.com

Resolving Dependencies

--> Running transaction check

---> Package bind-libs.x86_64 32:9.8.2-0.37.rc1.el6_7.6 will be updated

.

.

.

Dependencies Resolved


========================================================================================

 Package                                         Arch                          Version                                           Repository                      Size

========================================================================================

Installing:

 kernel                                          x86_64                        2.6.32-573.22.1.el6                               updates                     30 M

 kernel-devel                                  x86_64                        2.6.32-573.22.1.el6                               updates                     10 M

.

.

.

Transaction Summary

========================================================================================

Install       2 Package(s)

Upgrade      42 Package(s)


Total download size: 135 M

Is this ok [y/N]:

.

.

.

Downloading Packages:

(1/44): bind-libs-9.8.2-0.37.rc1.el6_7.7.x86_64.rpm                                                                                | 887 kB     00:00     

(2/44): bind-utils-9.8.2-0.37.rc1.el6_7.7.x86_64.rpm                                                                               | 186 kB     00:00     

(3/44): ca-certificates-2015.2.6-65.0.1.el6_7.noarch.rpm                                                                         | 1.2 MB     00:00     

.

.

.

-------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                 9.1 MB/s | 135 MB     00:14     

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Updating   : krb5-libs-1.10.3-42z1.el6_7.x86_64                                                                                                          1/86 

  Updating   : nspr-4.11.0-0.1.el6_7.x86_64                                                                                                                  2/86 

  Updating   : nss-util-3.21.0-0.3.el6_7.x86_64                                                                                                              3/86 

.

.

.

Installed:

  kernel.x86_64 0:2.6.32-573.22.1.el6                                            kernel-devel.x86_64 0:2.6.32-573.22.1.el6                                   

Updated:

  bind-libs.x86_64 32:9.8.2-0.37.rc1.el6_7.7      bind-utils.x86_64 32:9.8.2-0.37.rc1.el6_7.7    ca-certificates.noarch 0:2015.2.6-65.0.1.el6_7   

.

.

.

Complete!

[root@MyOS ~]#


이제 되겠지 하는 마음으로 다시한번 설치 실행... 그러나 역시 진행되지 않았다.


[root@MyOS ~]# yum install mariadb


Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 * base: centos.mirror.cdnetworks.com

 * extras: centos.mirror.cdnetworks.com

 * updates: centos.mirror.cdnetworks.com

No package mariadb available.

Error: Nothing to do


그래서 이번엔 리포지터리를 수정했다.  


[root@MyOS ~]# vi /etc/yum.repos.d/MariaDB.repo


[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/5.5/centos6-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1


다시한번 yum을 업데이트 했더니 MariaDB관련 업데이트가 진행되었다.


[root@MyOS ~]# yum update


Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Update Process

Loading mirror speeds from cached hostfile

 * base: centos.mirror.cdnetworks.com

 * extras: centos.mirror.cdnetworks.com

 * updates: centos.mirror.cdnetworks.com

mariadb                                                                                                                                        | 2.9 kB     00:00     

mariadb/primary_db                                                                                                                        |  20 kB     00:00     

Resolving Dependencies

--> Running transaction check

---> Package MariaDB-client.x86_64 0:5.5.48-1.el6 will be obsoleting

--> Processing Dependency: MariaDB-common for package: MariaDB-client-5.5.48-1.el6.x86_64

---> Package MariaDB-compat.x86_64 0:5.5.48-1.el6 will be obsoleting

---> Package MariaDB-devel.x86_64 0:5.5.48-1.el6 will be obsoleting

---> Package MariaDB-shared.x86_64 0:5.5.48-1.el6 will be obsoleting

---> Package mysql.x86_64 0:5.1.73-5.el6_7.1 will be obsoleted

---> Package mysql-devel.x86_64 0:5.1.73-5.el6_7.1 will be obsoleted

---> Package mysql-libs.x86_64 0:5.1.73-5.el6_7.1 will be obsoleted

--> Running transaction check

---> Package MariaDB-common.x86_64 0:5.5.48-1.el6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


========================================================================================

 Package                                     Arch                                Version                                   Repository                            Size

========================================================================================

Installing:

 MariaDB-client           x86_64           5.5.48-1.el6               mariadb             10 M     replacing  mysql.x86_64 5.1.73-5.el6_7.1

 MariaDB-compat        x86_64           5.5.48-1.el6               mariadb             2.7 M     replacing  mysql-libs.x86_64 5.1.73-5.el6_7.1

 MariaDB-devel           x86_64           5.5.48-1.el6               mariadb             5.7 M    replacing  mysql-devel.x86_64 5.1.73-5.el6_7.1

 MariaDB-shared         x86_64           5.5.48-1.el6               mariadb             1.1 M    replacing  mysql-libs.x86_64 5.1.73-5.el6_7.1

Installing for dependencies:

 MariaDB-common       x86_64          5.5.48-1.el6               mariadb              23 k


Transaction Summary

========================================================================================

Install       5 Package(s)


Total download size: 20 M

Is this ok [y/N]: y

Downloading Packages:

(1/5): MariaDB-5.5.48-centos6-x86_64-client.rpm                                                                                        |  10 MB     00:05     (2/5): MariaDB-5.5.48-centos6-x86_64-common.rpm                                                                                    |  23 kB     00:00     (3/5): MariaDB-5.5.48-centos6-x86_64-compat.rpm                                                                                     | 2.7 MB     00:00     (4/5): MariaDB-5.5.48-centos6-x86_64-devel.rpm                                                                                         | 5.7 MB     00:00   (5/5): MariaDB-5.5.48-centos6-x86_64-shared.rpm                                                                                        | 1.1 MB     00:00     

-------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                 2.4 MB/s |  20 MB     00:08     

warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 1bb943db: NOKEY

Retrieving key from https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

Importing GPG key 0x1BB943DB:

 Userid: "MariaDB Package Signing Key <package-signing-key@mariadb.org>"

 From  : https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : MariaDB-compat-5.5.48-1.el6.x86_64                                                                                                      1/8 

  Installing : MariaDB-common-5.5.48-1.el6.x86_64                                                                                                    2/8 

  Installing : MariaDB-shared-5.5.48-1.el6.x86_64                                                                                                       3/8 

  Installing : MariaDB-devel-5.5.48-1.el6.x86_64                                                                                                         4/8 

  Installing : MariaDB-client-5.5.48-1.el6.x86_64                                                                                                         5/8 

  Erasing    : mysql-devel-5.1.73-5.el6_7.1.x86_64                                                                                                       6/8 

  Erasing    : mysql-5.1.73-5.el6_7.1.x86_64                                                                                                               7/8 

  Erasing    : mysql-libs-5.1.73-5.el6_7.1.x86_64                                                                                                          8/8 

  Verifying  : MariaDB-shared-5.5.48-1.el6.x86_64                                                                                                       1/8 

  Verifying  : MariaDB-common-5.5.48-1.el6.x86_64                                                                                                    2/8 

  Verifying  : MariaDB-devel-5.5.48-1.el6.x86_64                                                                                                         3/8 

  Verifying  : MariaDB-client-5.5.48-1.el6.x86_64                                                                                                         4/8 

  Verifying  : MariaDB-compat-5.5.48-1.el6.x86_64                                                                                                      5/8 

  Verifying  : mysql-libs-5.1.73-5.el6_7.1.x86_64                                                                                                          6/8 

  Verifying  : mysql-5.1.73-5.el6_7.1.x86_64                                                                                                               7/8 

  Verifying  : mysql-devel-5.1.73-5.el6_7.1.x86_64                                                                                                       8/8 


Installed:

  MariaDB-client.x86_64 0:5.5.48-1.el6     MariaDB-compat.x86_64 0:5.5.48-1.el6     MariaDB-devel.x86_64 0:5.5.48-1.el6     MariaDB-shared.x86_64 0:5.5.48-1.el6    


Dependency Installed:

  MariaDB-common.x86_64 0:5.5.48-1.el6                                                                                                                                

Replaced:

  mysql.x86_64 0:5.1.73-5.el6_7.1                    mysql-devel.x86_64 0:5.1.73-5.el6_7.1                    mysql-libs.x86_64 0:5.1.73-5.el6_7.1                   

Complete!

[root@MyOS ~]#


이제는 되겠지... 다시한번 설치 시작 (서버와 클라이언트를 모두 설치하는걸로 했다.)


[root@MyOS ~]# yum install MariaDB-server MariaDB-client


Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 * base: centos.mirror.cdnetworks.com

 * extras: centos.mirror.cdnetworks.com

 * updates: centos.mirror.cdnetworks.com

Package MariaDB-client-5.5.48-1.el6.x86_64 already installed and latest version

Resolving Dependencies

--> Running transaction check

---> Package MariaDB-server.x86_64 0:5.5.48-1.el6 will be installed

--> Processing Dependency: perl(DBI) for package: MariaDB-server-5.5.48-1.el6.x86_64

--> Running transaction check

---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


========================================================================================

 Package                                     Arch                                Version                                   Repository                            Size

========================================================================================

Installing:

 MariaDB-server                              x86_64                              5.5.48-1.el6                              mariadb                      43 M

Installing for dependencies:

 perl-DBI                                    x86_64                              1.609-4.el6                               base                             705 k


Transaction Summary

========================================================================================

Install       2 Package(s)


Total download size: 44 M

Installed size: 177 M

Is this ok [y/N]: y

Downloading Packages:

(1/2): MariaDB-5.5.48-centos6-x86_64-server.rpm                                                                                         |  43 MB     00:08   (2/2): perl-DBI-1.609-4.el6.x86_64.rpm                                                                                                        | 705 kB     00:00     

-------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                 5.0 MB/s |  44 MB     00:08     

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing : perl-DBI-1.609-4.el6.x86_64                                                                                                                        1/2 

  Installing : MariaDB-server-5.5.48-1.el6.x86_64                                                                                                              2/2 

chown: cannot access `/var/lib/mysql': No such file or directory

160412 16:49:31 [Note] /usr/sbin/mysqld (mysqld 5.5.48-MariaDB) starting as process 4660 ...

160412 16:49:32 [Note] /usr/sbin/mysqld (mysqld 5.5.48-MariaDB) starting as process 4668 ...


PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !

To do so, start the server, then issue the following commands:


'/usr/bin/mysqladmin' -u root password 'new-password'

'/usr/bin/mysqladmin' -u root -h MyOS password 'new-password'


Alternatively you can run:

'/usr/bin/mysql_secure_installation'


which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.


See the MariaDB Knowledgebase at http://mariadb.com/kb or the

MySQL manual for more instructions.


Please report any problems at http://mariadb.org/jira


The latest information about MariaDB is available at http://mariadb.org/.

You can find additional information about the MySQL part at:

http://dev.mysql.com

Support MariaDB development by buying support/new features from MariaDB

Corporation Ab. You can contact us about this at sales@mariadb.com.

Alternatively consider joining our community based development effort:

http://mariadb.com/kb/en/contributing-to-the-mariadb-project/


  Verifying  : MariaDB-server-5.5.48-1.el6.x86_64                                                                                                            1/2 

  Verifying  : perl-DBI-1.609-4.el6.x86_64                                                                                                                      2/2 


Installed:

  MariaDB-server.x86_64 0:5.5.48-1.el6                                                                                                                                


Dependency Installed:

  perl-DBI.x86_64 0:1.609-4.el6                                                                                                                                       


Complete!

[root@MyOS ~]#


다행이도 정상적으로 설치되었고... 데몬을 실행시켜봤는데 역시 정상적으로 실행되었다.


[root@MyOS ~]# service mysql start


Starting MySQL.. SUCCESS!


초기 계정에 비번을 설정하기 위해 설정과정을 진행했다. (전부 Y 혹은 엔터로 넘기로 비번만 설정)


[root@MyOS ~]# /usr/bin/mysql_secure_installation 


/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found


NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


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): 

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

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: 

Re-enter new 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] 

 ... 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] 

 ... 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] 

 - 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] 

 ... Success!


Cleaning up...


All done!  If you've completed all of the above steps, your MariaDB

installation should now be secure.


Thanks for using MariaDB!




드디어 완료...













반응형

댓글