최신 게시글(DB)
2023.06.26 / 02:01

CentOS7.9 버전에서의 마리아DB를 오프라인 설치 - rpm 설치 직접

디도스
추천 수 98

오늘은 Linux,

그 중에도 CentOS7.9 버전에서의

마리아DB를 오프라인으로 설치해보겠습니다!

CentOS7.x 버전이라면 이 가이드만 보셔도 문제 없으실 거예요!:D

다음 번에는 우분투에서도 설치해보도록 할게요 :D

 

먼저 저의 환경을 정리해볼게요!


 

[물리서버]

OS : CentOS7.9 (Core)

* 외부 통신은 방화벽에서 차단

 


위와 같이 외부 통신이 불가하기 때문에

yum으로 패키지 파일을 다운받을 수 없어요 :(

그래서 패키지 파일을 받기 위해

Virtual Box를 이용하여

온라인으로 다운로드 받을텐데,

가상 서버OS를 물리 서버와 동일하게 만들어 줍니다!

 


 

OS 버전을 확인 해볼게요.

cat /etc/*release*

[root@localhost ~]# cat /etc/*release* CentOS Linux release 7.9.2009 (Core) Derived from Red Hat Enterprise Linux 7.8 (Source) NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7" CentOS Linux release 7.9.2009 (Core) CentOS Linux release 7.9.2009 (Core) cpe:/o:centos:centos:7
[root@localhost ~]#

버전은 CentOS Linux release 7.9.2009 (Core)

가상 서버에서 인터넷이 되는지 확인 해볼게요!

ping 8.8.8.8 또는 ping 168.126.63.1

* 아래 커멘드에서 -c5는 5회 출력한다는 뜻이에요!

-c 옵션을 넣지 않으면 ctrl+c로 종료하기 전까지 무한대로 통신한답니다!

[root@localhost ~]# ping 168.126.63.1 -c5
PING 168.126.63.1 (168.126.63.1) 56(84) bytes of data. 
64 bytes from 168.126.63.1: icmp_seq=1 ttl=55 time=9.95 ms 
64 bytes from 168.126.63.1: icmp_seq=2 ttl=55 time=11.9 ms 
64 bytes from 168.126.63.1: icmp_seq=3 ttl=55 time=11.1 ms 
64 bytes from 168.126.63.1: icmp_seq=4 ttl=55 time=11.9 ms 
64 bytes from 168.126.63.1: icmp_seq=5 ttl=55 time=10.3 ms 
--- 168.126.63.1 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, 
time 4057ms rtt min/avg/max/mdev = 9.951/11.063/11.972/0.817 ms 
[root@localhost ~]#

인터넷이 되는 것 까지 확인 했으면,

MariaDB를 설치하기 위한 패키지가 뭔지 알아야겠죠?

위의 링크를 클릭하면 MariaDB RPM 파일과

파일마다 설명이 자세히 나와있어요!

필요한 부분을 선택하여 설치하도록 합시다:D

 


저는 MariaDB-Client와 MariaDB-Server를

설치하려고 해요.

하지만 설치파일에 의존성 패키지가 포함될 수 있으니

확인 해보도록 할게요!

yum install -y mariadb-server mariadb

아래 커멘드에서 -y는 모든 설치에 다 yes를 하는 옵션입니다.

실제 작업에서는 -y 옵션을 사용하지 않고 뭐가 어떻게 설치되는지 확인 해야 돼요!

[
[root@localhost ~]# yum install -y mariadb-server mariadb
Loaded plugins: fastestmirror Determining fastest mirrors * base: ftp.kaist.ac.kr * 
extras: ftp.kaist.ac.kr * updates: ftp.kaist.ac.kr base | 3.6 kB 00:00 extras | 
2.9 kB 00:00 updates | 2.9 kB 00:00 (1/4): base/7/x86_64/group_gz | 153 kB 00:00 (2/4):
extras/7/x86_64/primary_db | 243 kB 00:00 (3/4): base/7/x86_64/primary_db | 6.1 MB 00:01 (4/4):
updates/7/x86_64/primary_db | 11 MB 00:02 Resolving Dependencies --> Running transaction check
---> Package mariadb.x86_64 1:5.5.68-1.el7 will be installed 
[중략] ================================================================================ 
Package Arch Version Repository Size
================================================================================ 
Installing: mariadb x86_64 1:5.5.68-1.el7 base 8.8 M mariadb-server x86_64 1:5.5.68-1.el7 base 1
1 M Installing for dependencies: perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k perl-Compr
ess-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k perl-DBD-MySQL x86_64 4.023-6.el7 base 140 k perl-DB
I x86_64 1.627-4.el7 base 802 k perl-IO-Compress noarch 2.061-2.el7 base 260 k perl-Net-Daemon 
noarch 0.48-5.el7 base 51 k perl-PlRPC noarch 0.2020-14.el7 base 36 k [생략]

위와 같이 설치되는

패키지 리스트를 확인할 수 있어요.

확인 후에는 패키지를 별도로 다운로드 하기 위해

다시 삭제해요.

yum erase -y mariadb-server mariadb

[root@localhost ~]# yum erase -y mariadb-server mariadb perl-Compress-Raw-Bzip2 perl-Compress-Raw-Zlib perl-
DBD-MySQL perl-DBI perl-IO-Compress.noarch perl-Net-Daemon.noarch perl-PlRPC.noarch Loaded plugins:
fastestmirror Resolving Dependencies --> Running transaction check ---> Package mariadb.x86_64 1:5.5.68-1.el7 will
be erased ---> Package mariadb-server.x86_64 1:5.5.68-1.el7 will be erased ---> Package perl-Compress-Raw-
Bzip2.x86_64 0:2.061-3.el7 will be erased ---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be erased ---
> Package perl-DBD-MySQL.x86_64 0:4.023-6.el7 will be erased ---> Package perl-DBI.x86_64 0:1.627-4.el7 will be
erased ---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be erased ---> Package perl-Net-Daemon.noarch
0:0.48-5.el7 will be erased ---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be erased --> Finished Dependency
Resolution Dependencies Resolved
================================================================================ Package Arch
Version Repository Size
================================================================================ Removing: mariadb
x86_64 1:5.5.68-1.el7 @base 49 M mariadb-server x86_64 1:5.5.68-1.el7 @base 58 M perl-Compress-Raw-Bzip2 x86_64
2.061-3.el7 @base 57 k perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 @base 137 k perl-DBD-MySQL x86_64 4.023-
6.el7 @base 323 k perl-DBI x86_64 1.627-4.el7 @base 1.9 M perl-IO-Compress noarch 2.061-2.el7 @base 795 k perl-
Net-Daemon noarch 0.48-5.el7 @base 116 k perl-PlRPC noarch 0.2020-14.el7 @base 69 k Transaction Summary
================================================================================ Remove 9 Packages
Installed size: 110 M Downloading packages: Running transaction check Running transaction test Transaction test
succeeded Running transaction Erasing : 1:mariadb-server-5.5.68-1.el7.x86_64 1/9 Erasing : perl-DBD-MySQL-4.023-
6.el7.x86_64 2/9 Erasing : perl-DBI-1.627-4.el7.x86_64 3/9 Erasing : perl-PlRPC-0.2020-14.el7.noarch 4/9 Erasing : perl-
IO-Compress-2.061-2.el7.noarch 5/9 Erasing : perl-Net-Daemon-0.48-5.el7.noarch 6/9 Erasing : perl-Compress-Raw-
Bzip2-2.061-3.el7.x86_64 7/9 Erasing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 8/9 Erasing : 1:mariadb-5.5.68-
1.el7.x86_64 9/9 Verifying : perl-IO-Compress-2.061-2.el7.noarch 1/9 Verifying : 1:mariadb-server-5.5.68-1.el7.x86_64
2/9 Verifying : perl-DBD-MySQL-4.023-6.el7.x86_64 3/9 Verifying : 1:mariadb-5.5.68-1.el7.x86_64 4/9 Verifying : 1:perl-
Compress-Raw-Zlib-2.061-4.el7.x86_64 5/9 Verifying : perl-Net-Daemon-0.48-5.el7.noarch 6/9 Verifying : perl-DBI-
1.627-4.el7.x86_64 7/9 Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 8/9 Verifying : perl-PlRPC-0.2020-
14.el7.noarch 9/9 Removed: mariadb.x86_64 1:5.5.68-1.el7 mariadb-server.x86_64 1:5.5.68-1.el7 perl-Compress-Raw-
Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64 0:4.023-6.el7 perl-
DBI.x86_64 0:1.627-4.el7 perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-
PlRPC.noarch 0:0.2020-14.el7 
Complete!

삭제가 끝났으면 다시 패키지만 별도의 경로에

다운로드 해요!

저는 /root/MariaDB_Packages 라는

디렉터리를 만들어 저장할 거예요!

cd /root

mkdir MariaDB_Packages

yum install -y mariadb-server.x86_64 mariadb.x86_64 perl-Compress-Raw-Bzip2.x86_64 perl-Compress-Raw-Zlib.x86_64 perl-DBD-MySQL.x86_64 perl-DBI.x86_64 perl-IO-Compress.noarch perl-Net-Daemon.noarch perl-PlRPC.noarch boost-program-options lsof rsync --downloadonly --downloaddir=/root/MariaDB_Packages

[root@localhost ~]# cd /root
[root@localhost ~]# mkdir MariaDB_Packages
[root@localhost ~]# yum install -y mariadb-server.x86_64 mariadb.x86_64 perl-Compress-Raw-Bzip2.x86_64 perl-
Compress-Raw-Zlib.x86_64 perl-DBD-MySQL.x86_64 perl-DBI.x86_64 perl-IO-Compress.noarch perl-Net-
Daemon.noarch perl-PlRPC.noarch boost-program-options lsof rsync --downloadonly --
downloaddir=/root/MariaDB_Packages
Loaded plugins: fastestmirror Determining fastest mirrors * base: mirror.navercorp.com * extras:
mirror.navercorp.com * updates: mirror.navercorp.com base | 3.6 kB 00:00 extras | 2.9 kB 00:00 updates | 2.9 kB 00:00
(1/4): base/7/x86_64/group_gz | 153 kB 00:00 [중략] Install 11 Packages Total download size: 22 M Installed size: 112
M Background downloading packages, then exiting: 경고: /root/MariaDB_Packages/boost-program-options-1.53.0-
28.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Public key for boost-program-options-
1.53.0-28.el7.x86_64.rpm is not installed (1/11): boost-program-options-1.53.0-28.el7.x86_64.rpm | 156 kB 00:00
(2/11): lsof-4.87-6.el7.x86_64.rpm | 331 kB 00:00 (3/11): mariadb-5.5.68-1.el7.x86_64.rpm | 8.8 MB 00:02 (4/11): perl-
Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00 (5/11): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm |
57 kB 00:00 (6/11): perl-DBD-MySQL-4.023-6.el7.x86_64.rpm | 140 kB 00:00 (7/11): perl-DBI-1.627-4.el7.x86_64.rpm |
802 kB 00:00 (8/11): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00 (9/11): perl-Net-Daemon-0.48-
5.el7.noarch.rpm | 51 kB 00:00 (10/11): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00 (11/11): mariadb-server-
5.5.68-1.el7.x86_64.rpm | 11 MB 00:04 -------------------------------------------------------------------------------- Total 4.9 MB/s | 22
MB 00:04 exiting because "Download Only" specified
 

다운로드 완료 후 해당 경로에서 파일을 확인해요!

cd MariaDB_Packages/

ls

[root@localhost ~]# cd MariaDB_Packages/ [root@localhost MariaDB_Packages]# ls boost-program-options-1.53.0-
28.el7.x86_64.rpm lsof-4.87-6.el7.x86_64.rpm mariadb-5.5.68-1.el7.x86_64.rpm mariadb-server-5.5.68-
1.el7.x86_64.rpm perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm
perl-DBD-MySQL-4.023-6.el7.x86_64.rpm perl-DBI-1.627-4.el7.x86_64.rpm perl-IO-Compress-2.061-2.el7.noarch.rpm
perl-Net-Daemon-0.48-5.el7.noarch.rpm perl-PlRPC-0.2020-14.el7.noarch.rpm
[root@localhost ~]# cd MariaDB_Packages/ 
[root@localhost MariaDB_Packages]# ls 
boost-program-options-1.53.0-28.el7.x86_64.rpm 
lsof-4.87-6.el7.x86_64.rpm
mariadb-5.5.68-1.el7.x86_64.rpm
mariadb-server-5.5.68-1.el7.x86_64.rpm
perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm 
perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm
perl-DBD-MySQL-4.023-6.el7.x86_64.rpm 
perl-DBI-1.627-4.el7.x86_64.rpm 
perl-IO-Compress-2.061-2.el7.noarch.rpm
perl-Net-Daemon-0.48-5.el7.noarch.rpm 
perl-PlRPC-0.2020-14.el7.noarch.rpm
 

정상적으로 다운로드 받아진 것이 확인되면 설치파일을 WinSCP등의 프로그램으로 옮깁니다.


설치 하려던 서버에 설치를 해 볼 거예요! :D

먼저 파일을 옮긴 후 확인합니다.

[root@localhost ~]# cd MariaDB_Packages/ [root@localhost MariaDB_Packages]# ls boost-program-options-1.53.0-
28.el7.x86_64.rpm lsof-4.87-6.el7.x86_64.rpm mariadb-5.5.68-1.el7.x86_64.rpm mariadb-server-5.5.68-
1.el7.x86_64.rpm perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm
perl-DBD-MySQL-4.023-6.el7.x86_64.rpm perl-DBI-1.627-4.el7.x86_64.rpm perl-IO-Compress-2.061-2.el7.noarch.rpm
perl-Net-Daemon-0.48-5.el7.noarch.rpm perl-PlRPC-0.2020-14.el7.noarch.rpm [root@localhost MariaDB_Packages]#
 

파일이 잘 옮겨졌다면 설치를 해 볼거예요!

종속성 문제가 있어서 순서가 중요한데요,

perl-Compress-Raw-Zlib

mariadb

perl-Net-Daemon

perl-Compress-Raw-Bzip2

perl-IO-Compress

perl-PlRPC

perl-DBI

perl-DBD-MySQL

mariadb-server

boost-program-options

lsof

순서로 설치하면 됩니다!

또는 rpm -Uvh *.rpm 으로 설치하면

순서대로 알아서 해줍니다!

rpm -Uvh *.rpm

[root@localhost MariaDB_Packages]# rpm -Uvh *.rpm 경고: boost-program-options-1.53.0-28.el7.x86_64.rpm:
Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY 준비 중... ################################# [100%
] Updating / installing... 1:perl-Net-Daemon-0.48-5.el7 ################################# [ 9%] 2:perl-
Compress-Raw-Zlib-1:2.061-4.################################# [ 18%] 3:perl-Compress-Raw-Bzip2-2.061-
3.e################################# [ 27%] 4:perl-IO-Compress-2.061-2.el7
################################# [ 36%] 5:perl-PlRPC-0.2020-14.el7 #################################
[ 45%] 6:perl-DBI-1.627-4.el7 ################################# [ 55%] 7:perl-DBD-MySQL-4.023-6.el7
################################# [ 64%] 8:mariadb-1:5.5.68-1.el7 ################################# [
73%] 9:mariadb-server-1:5.5.68-1.el7 ################################# [ 82%] 10:lsof-4.87-6.el7
################################# [ 91%] 11:boost-program-options-1.53.0-
28.e################################# [100%]

 

설치가 잘 되었다면 MariaDB를 실행해봅시다!

systemctl start mariadb

systemctl status mariadb

[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# systemctl status mariadb
● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled
; vendor preset: disabled) Active: active (running) since 목 2021-10-14 18:10:02 KST; 6s ago Process: 8530
ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS) Process: 8446
ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS) Main PID: 8529
(mysqld_safe) CGroup: /system.slice/mariadb.service ├─8529 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─8694 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql... 10월 14 18:09:58 localhost.localdomain
mariadb-prepare-db-dir[8446]: Alterna... 10월 14 18:09:58 localhost.localdomain mariadb-prepare-db-dir[8446]:
'/usr/b... 10월 14 18:09:58 localhost.localdomain mariadb-prepare-db-dir[8446]: which w... 10월 14 18:09:58
localhost.localdomain mariadb-prepare-db-dir[8446]: databas... 10월 14 18:09:58 localhost.localdomain mariadb-
prepare-db-dir[8446]: strongl... 10월 14 18:09:58 localhost.localdomain mariadb-prepare-db-dir[8446]: See the... 10월
14 18:09:58 localhost.localdomain mariadb-prepare-db-dir[8446]: MySQL m... 10월 14 18:09:59 localhost.localdomain
mysqld_safe[8529]: 211014 18:09:59 my... 10월 14 18:09:59 localhost.localdomain mysqld_safe[8529]: 211014
18:09:59 my... 10월 14 18:10:02 localhost.localdomain systemd[1]: Started MariaDB database ... Hint: Some lines were
ellipsized, use -l to show in full.

MariaDB 설치 직후에는

root 패스워드를 변경해 주어야 합니다.

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

 

' ' 작은 따옴표 안에

설정할 패스워드를 입력하면 변경 됩니다.

 


여기까지, 설치가 완료 되었습니다!!

동작하는지 볼까요?

mysql -u root -p

[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9
Server version: 5.5.68-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases; +--------
------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3
rows in set (0.00 sec) MariaDB [(none)]> use mysql; Reading table information for completion of table and column
names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [mysql]>

잘 작동하네요! :D

이것으로 CentOS7.x에서

Off-line으로 MariaDB설치하기를

마치겠습니다! :D

읽어주셔서 감사합니다 :D