8. 오라클 클라우드에서 우분투 LEMP - MariaDB 설치하기

2020. 6. 3. 06:30Oracle Cloud

반응형

Contents

0. 오라클 클라우드에서 Ubuntu LEMP(Linux+Nginx+MariaDB+PHP7)에 WORDPRESS 설치하기
1. 오라클 클라우드 무료 가입 (Oracle Cloud Free Tier)하기
2. 오라클 클라우드에서 Ubuntu(우분투) 인스턴스 서버 생성하기 (네트워크 셋팅을 포함)
3. 오라클 클라우드 SSH 접속 및 SFTP 등 서버 접속 환경 설정하기
4. 오라클 클라우드 우분투 서버 환경 설정하기
5. Nginx 서버 설치하기
6. Linux 폴더 권한 설정 확인하기
7. Nginx 서버에 PHP7 설치하기
8. MariaDB 설치하기
9. phpMyAdmin 설치하기
10. 도메인 연결하기
11. sendmail 설치하기
12. HTTPS 적용을 위한 SSL 인증서 발급받기
13. DB 생성하기
14. Wordpress 설치하기
15. Wordpress 설치 후 서버 및 Wordpress 환경 설정하기

* 해당 내용은 오라클 제품을 다루고 있지만 이는 개인적인 테스트 결과이며, 오라클 공식 문서는 아님을 미리 밝힙니다.

이번에는 MariaDB를 설치해 보겠습니다.

MariaDB는 MySQL이 오라클에 인수된 후 라이선스 문제를 해결하기 위해 나온 DBMS입니다. 현재 MySQL은 오라클에 인수 된 이후 기능 추가가 되지 않아 현재로써는 MySQL대비 성능이 높아진 것으로 알려져 있습니다.

그러나 MariaDB는 MySQL 5.5버전을 기반으로 모든 기능이 호환되도록 제작되었습니다. 그래서 MySQL용으로 제작된 phpMyAdmin도 동작합니다.

그래서 서버를 신규로 설치하신다면 MySQL을 선택해야 할지 MariaDB를 선택해야 할지 고민할 필요는 없다고 보입니다. 

 

8-1. 마리아DB에 대한 apt 캐시 정책을 알아보겠습니다.

명령창에서 sudo apt-cache policy mariadb-server 를 입력합니다.

ubuntu@wordpress:~$ sudo apt-cache policy mariadb-server
mariadb-server:
  Installed: (none)
  Candidate: 1:10.1.44-0ubuntu0.18.04.1
  Version table:
     1:10.1.44-0ubuntu0.18.04.1 500
        500 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updat                                          es/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Pac                                          kages
     1:10.1.29-6 500
        500 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/unive                                          rse amd64 Packages

현재 설치는 되어 있지 않으며 캐시서버에는 10.1 버전이 설치되어 있습니다.

8-2. MariaDB 페이지에 가서 확인해 보겠습니다.

URL : https://downloads.mariadb.org/mariadb/repositories/#mirror=serverion

 

MariaDB - Setting up MariaDB Repositories - MariaDB

To generate the entries select an item from each of the boxes below. Once an item is selected in each box, your customized repository configuration will appear below. 1. Choose a Distro SLES openSUSE Arch Linux Mageia Fedora CentOS RedHat Mint Ubuntu Debia

downloads.mariadb.org

확인을 해 보니 10.4 버전이 최신 버전입니다.

위에 어떻게 MariaDB 10.4를 설치하면 되는지 잘 설명되어 있습니다.

그리고 선택 시 여기서 4. Choose a Mirror에서 Show All Mirrors를 선택하시고 Harukasan - South Korea 를 선택하시기 바랍니다.

8.-3. MariaDB를 설치를 위해 안내지시를 따라 환경을 설치해 보겠습니다.

우선 명령창에 sudo apt-get install software-properties-common 를 입력하겠습니다.

그 후에 sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' 를 입력하고

그 다음 sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic main' 를 입력합니다.

해당 내용은 위의 내용보다는 https://downloads.mariadb.org/mariadb/repositories/#mirror=serverion 를 보시고 안내에 따라 입력하시면 최신 버전으로 설치가 가능하실 겁니다.

ubuntu@wordpress:~$ sudo apt-get install software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
software-properties-common is already the newest version (0.96.24.32.12).
software-properties-common set to manually installed.
The following package was automatically installed and is no longer required:
  grub-pc-bin
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
ubuntu@wordpress:~$ sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
Executing: /tmp/apt-key-gpghome.e4WFbGv1vX/gpg.1.sh --fetch-keys https://mariadb.org/mariadb_release_signing_key.asc
gpg: requesting key from 'https://mariadb.org/mariadb_release_signing_key.asc'
gpg: key F1656F24C74CD1D8: 6 signatures not checked due to missing keys
gpg: key F1656F24C74CD1D8: public key "MariaDB Signing Key <signing-key@mariadb.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1
ubuntu@wordpress:~$ sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic main'
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:2 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Hit:3 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic InRelease
Get:4 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:6 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [949 kB]
Get:7 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease [6265 B]
Get:8 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1075 kB]
Get:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main amd64 Packages [16.2 kB]
Get:10 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main arm64 Packages [15.8 kB]
Get:11 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main ppc64el Packages [15.7 kB]
Fetched 2331 kB in 15s (153 kB/s)
Reading package lists... Done

8-4. MariaDB 설치를 위한 환경이 완료 되었으면 이제 apt를 업데이트 및 업그레이드하고 mariadb-server를 apt로 설치해 보겠습니다.

(설명에는 apt update만 되어 있는데... 오라클 클라우드 서버에서는 upgrade를 한번 하라고 나타나는군요.)

명령창에서 sudo apt update 를 입력합니다.

ubuntu@wordpress:~$ sudo apt update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:2 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Hit:3 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates InRelease
Get:5 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Hit:6 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Fetched 163 kB in 3s (62.1 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
7 packages can be upgraded. Run 'apt list --upgradable' to see them.

apt update와 upgrade가 완료되었으면 이제 mariadb를 설치해 봅니다.

명령창에서 sudo apt install mariadb-server 를 입력합니다.

중간에 After this operation, 199 MB of additional disk space will be used. 라면서 이어서 설치하겠냐고 물으면
Do you want to continue? [Y/n]  Y라고 답합니다.

ubuntu@wordpress:~$ sudo apt install mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  grub-pc-bin libicu60
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  galera-4 libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
  libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmariadb3 libmysqlclient20 libterm-readkey-perl
  libtimedate-perl liburi-perl mariadb-client-10.4 mariadb-client-core-10.4 mariadb-common mariadb-server-10.4 mariadb-server-core-10.4 mysql-common socat
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx mariadb-test tinyca
The following NEW packages will be installed:
  galera-4 libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
  libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmariadb3 libmysqlclient20 libterm-readkey-perl
  libtimedate-perl liburi-perl mariadb-client-10.4 mariadb-client-core-10.4 mariadb-common mariadb-server mariadb-server-10.4 mariadb-server-core-10.4
  mysql-common socat
0 upgraded, 28 newly installed, 0 to remove and 0 not upgraded.
Need to get 25.0 MB of archives.
After this operation, 199 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libdbi-perl amd64 1.640-1 [724 kB]
Get:2 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main ppc64el mysql-common all 1:10.4.13+maria~bionic [5556 B]
Get:3 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libaio1 amd64 0.3.110-5ubuntu0.1 [6476 B]
Get:4 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 socat amd64 1.7.3.2-2ubuntu2 [342 kB]
Get:5 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libhtml-tagset-perl all 3.20-3 [12.1 kB]
Get:6 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 liburi-perl all 1.73-1 [77.2 kB]
Get:7 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libhtml-parser-perl amd64 3.72-3build1 [85.9 kB]
Get:8 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libcgi-pm-perl all 4.38-1 [185 kB]
Get:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main ppc64el mariadb-common all 1:10.4.13+maria~bionic [3528 B]
Get:10 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libfcgi-perl amd64 0.78-2build1 [32.8 kB]
Get:11 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libcgi-fast-perl all 1:2.13-1 [9940 B]
Get:12 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmysqlclient20 amd64 5.7.30-0ubuntu0.18.04.1 [690 kB]
Get:13 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main amd64 galera-4 amd64 26.4.4-bionic [9443 kB]
Get:14 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/universe amd64 libdbd-mysql-perl amd64 4.046-1 [82.0 kB]
Get:15 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libencode-locale-perl all 1.05-1 [12.3 kB]
Get:16 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libhtml-template-perl all 2.97-1 [59.0 kB]
Get:17 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libtimedate-perl all 2.3000-2 [37.5 kB]
Get:18 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libhttp-date-perl all 6.02-1 [10.4 kB]
Get:19 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libio-html-perl all 1.001-1 [14.9 kB]
Get:20 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 liblwp-mediatypes-perl all 6.02-1 [21.7 kB]
Get:21 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libhttp-message-perl all 6.14-1 [72.1 kB]
Get:22 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/universe amd64 libterm-readkey-perl amd64 2.37-1build1 [24.4 kB]
Get:23 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main amd64 libmariadb3 amd64 1:10.4.13+maria~bionic [148 kB]
Get:24 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main amd64 mariadb-client-core-10.4 amd64 1:10.4.13+maria~bionic [782 kB]
Get:25 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main amd64 mariadb-client-10.4 amd64 1:10.4.13+maria~bionic [1173 kB]
Get:26 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main amd64 mariadb-server-core-10.4 amd64 1:10.4.13+maria~bionic [6310 kB]
Get:27 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main amd64 mariadb-server-10.4 amd64 1:10.4.13+maria~bionic [4663 kB]
Get:28 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic/main ppc64el mariadb-server all 1:10.4.13+maria~bionic [3184 B]
Fetched 25.0 MB in 58s (429 kB/s)
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 101364 files and directories currently installed.)
Preparing to unpack .../0-mysql-common_1%3a10.4.13+maria~bionic_all.deb ...
Unpacking mysql-common (1:10.4.13+maria~bionic) ...
Selecting previously unselected package mariadb-common.
Preparing to unpack .../1-mariadb-common_1%3a10.4.13+maria~bionic_all.deb ...
Unpacking mariadb-common (1:10.4.13+maria~bionic) ...
Selecting previously unselected package galera-4.
Preparing to unpack .../2-galera-4_26.4.4-bionic_amd64.deb ...
Unpacking galera-4 (26.4.4-bionic) ...
Selecting previously unselected package libdbi-perl.
Preparing to unpack .../3-libdbi-perl_1.640-1_amd64.deb ...
Unpacking libdbi-perl (1.640-1) ...
Selecting previously unselected package libmariadb3:amd64.
Preparing to unpack .../4-libmariadb3_1%3a10.4.13+maria~bionic_amd64.deb ...
Unpacking libmariadb3:amd64 (1:10.4.13+maria~bionic) ...
Selecting previously unselected package mariadb-client-core-10.4.
Preparing to unpack .../5-mariadb-client-core-10.4_1%3a10.4.13+maria~bionic_amd64.deb ...
Unpacking mariadb-client-core-10.4 (1:10.4.13+maria~bionic) ...
Selecting previously unselected package mariadb-client-10.4.
Preparing to unpack .../6-mariadb-client-10.4_1%3a10.4.13+maria~bionic_amd64.deb ...
Unpacking mariadb-client-10.4 (1:10.4.13+maria~bionic) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../7-libaio1_0.3.110-5ubuntu0.1_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-5ubuntu0.1) ...
Selecting previously unselected package mariadb-server-core-10.4.
Preparing to unpack .../8-mariadb-server-core-10.4_1%3a10.4.13+maria~bionic_amd64.deb ...
Unpacking mariadb-server-core-10.4 (1:10.4.13+maria~bionic) ...
Selecting previously unselected package socat.
Preparing to unpack .../9-socat_1.7.3.2-2ubuntu2_amd64.deb ...
Unpacking socat (1.7.3.2-2ubuntu2) ...
Setting up mysql-common (1:10.4.13+maria~bionic) ...
Setting up mariadb-common (1:10.4.13+maria~bionic) ...
Selecting previously unselected package mariadb-server-10.4.
(Reading database ... 101764 files and directories currently installed.)
Preparing to unpack .../00-mariadb-server-10.4_1%3a10.4.13+maria~bionic_amd64.deb ...
Unpacking mariadb-server-10.4 (1:10.4.13+maria~bionic) ...
Selecting previously unselected package libhtml-tagset-perl.
Preparing to unpack .../01-libhtml-tagset-perl_3.20-3_all.deb ...
Unpacking libhtml-tagset-perl (3.20-3) ...
Selecting previously unselected package liburi-perl.
Preparing to unpack .../02-liburi-perl_1.73-1_all.deb ...
Unpacking liburi-perl (1.73-1) ...
Selecting previously unselected package libhtml-parser-perl.
Preparing to unpack .../03-libhtml-parser-perl_3.72-3build1_amd64.deb ...
Unpacking libhtml-parser-perl (3.72-3build1) ...
Selecting previously unselected package libcgi-pm-perl.
Preparing to unpack .../04-libcgi-pm-perl_4.38-1_all.deb ...
Unpacking libcgi-pm-perl (4.38-1) ...
Selecting previously unselected package libfcgi-perl.
Preparing to unpack .../05-libfcgi-perl_0.78-2build1_amd64.deb ...
Unpacking libfcgi-perl (0.78-2build1) ...
Selecting previously unselected package libcgi-fast-perl.
Preparing to unpack .../06-libcgi-fast-perl_1%3a2.13-1_all.deb ...
Unpacking libcgi-fast-perl (1:2.13-1) ...
Selecting previously unselected package libmysqlclient20:amd64.
Preparing to unpack .../07-libmysqlclient20_5.7.30-0ubuntu0.18.04.1_amd64.deb ...
Unpacking libmysqlclient20:amd64 (5.7.30-0ubuntu0.18.04.1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../08-libdbd-mysql-perl_4.046-1_amd64.deb ...
Unpacking libdbd-mysql-perl (4.046-1) ...
Selecting previously unselected package libencode-locale-perl.
Preparing to unpack .../09-libencode-locale-perl_1.05-1_all.deb ...
Unpacking libencode-locale-perl (1.05-1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../10-libhtml-template-perl_2.97-1_all.deb ...
Unpacking libhtml-template-perl (2.97-1) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../11-libtimedate-perl_2.3000-2_all.deb ...
Unpacking libtimedate-perl (2.3000-2) ...
Selecting previously unselected package libhttp-date-perl.
Preparing to unpack .../12-libhttp-date-perl_6.02-1_all.deb ...
Unpacking libhttp-date-perl (6.02-1) ...
Selecting previously unselected package libio-html-perl.
Preparing to unpack .../13-libio-html-perl_1.001-1_all.deb ...
Unpacking libio-html-perl (1.001-1) ...
Selecting previously unselected package liblwp-mediatypes-perl.
Preparing to unpack .../14-liblwp-mediatypes-perl_6.02-1_all.deb ...
Unpacking liblwp-mediatypes-perl (6.02-1) ...
Selecting previously unselected package libhttp-message-perl.
Preparing to unpack .../15-libhttp-message-perl_6.14-1_all.deb ...
Unpacking libhttp-message-perl (6.14-1) ...
Selecting previously unselected package libterm-readkey-perl.
Preparing to unpack .../16-libterm-readkey-perl_2.37-1build1_amd64.deb ...
Unpacking libterm-readkey-perl (2.37-1build1) ...
Selecting previously unselected package mariadb-server.
Preparing to unpack .../17-mariadb-server_1%3a10.4.13+maria~bionic_all.deb ...
Unpacking mariadb-server (1:10.4.13+maria~bionic) ...
Setting up libhtml-tagset-perl (3.20-3) ...
Setting up libmariadb3:amd64 (1:10.4.13+maria~bionic) ...
Setting up galera-4 (26.4.4-bionic) ...
Setting up libencode-locale-perl (1.05-1) ...
Setting up libtimedate-perl (2.3000-2) ...
Setting up socat (1.7.3.2-2ubuntu2) ...
Setting up libio-html-perl (1.001-1) ...
Setting up mariadb-client-core-10.4 (1:10.4.13+maria~bionic) ...
Setting up libterm-readkey-perl (2.37-1build1) ...
Setting up mariadb-client-10.4 (1:10.4.13+maria~bionic) ...
Setting up liblwp-mediatypes-perl (6.02-1) ...
Setting up libaio1:amd64 (0.3.110-5ubuntu0.1) ...
Setting up mariadb-server-core-10.4 (1:10.4.13+maria~bionic) ...
Setting up liburi-perl (1.73-1) ...
Setting up libhtml-parser-perl (3.72-3build1) ...
Setting up libcgi-pm-perl (4.38-1) ...
Setting up libmysqlclient20:amd64 (5.7.30-0ubuntu0.18.04.1) ...
Setting up libfcgi-perl (0.78-2build1) ...
Setting up libdbi-perl (1.640-1) ...
Setting up mariadb-server-10.4 (1:10.4.13+maria~bionic) ...
Failed to stop mysql.service: Unit mysql.service not loaded.
Created symlink /etc/systemd/system/mysql.service → /lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /lib/systemd/system/mariadb.service.
Setting up libhttp-date-perl (6.02-1) ...
Setting up libhtml-template-perl (2.97-1) ...
Setting up libcgi-fast-perl (1:2.13-1) ...
Setting up libhttp-message-perl (6.14-1) ...
Setting up mariadb-server (1:10.4.13+maria~bionic) ...
Setting up libdbd-mysql-perl (4.046-1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...

8-5. 이제 MariaDB가 제대로 설치 되었는지 확인합니다.

명령창에서 service mysql status 를 입력합니다.

정상적으로 설치 되었으면 Active : active (runnging) 라고 뜰 것입니다.

● mariadb.service - MariaDB 10.4.13 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since Sat 2020-05-30 17:28:30 KST; 46s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
 Main PID: 13903 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 32 (limit: 1123)
   CGroup: /system.slice/mariadb.service
           └─13903 /usr/sbin/mysqld

8-6. 그런데 MaridDB 설치시 암호를 묻지 않았습니다?

  • 명령창에서 sudo mysql_secure_installation 를 입력합니다.
  • 그러면 암호가 없어 암호를 생성하기 시작합니다.
  • Enter current password for root (enter for none): (Enter 키)
  • Switch to unix_socket authentication [Y/n] n
  • Change the root password? [Y/n] y
  • New password: MariaDB에 사용할 암호를 넣으세요.
    Re-enter new password: MariaDB에 사용할 암호를 한번 더 넣으세요.
  • Remove anonymous users? [Y/n] y
  • Disallow root login remotely? [Y/n] n
  • Remove test database and access to it? [Y/n] y
  • Reload Privilege tables now? [Y/n] y

하시면 Thanks for using MariaDB! 라고 문구가 뜰겁니다.

ubuntu@wordpress:~$ sudo mysql_secure_installation

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
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

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

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the 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] 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] n
 ... skipping.

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.

Thanks for using MariaDB!

8-7. 이제 MariaDB를 설치했으니 php-mysql 모듈을 설치해 보겠습니다.

명령창에 sudo apt-cache policy php7.4-mysql 를 입력합니다.

ubuntu@wordpress:~$ sudo apt-cache policy php7.4-mysql
php7.4-mysql:
  Installed: 7.4.6-1+ubuntu18.04.1+deb.sury.org+1
  Candidate: 7.4.6-1+ubuntu18.04.1+deb.sury.org+1
  Version table:
 *** 7.4.6-1+ubuntu18.04.1+deb.sury.org+1 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

저는 현재 설치가 된 것으로 나오고 있습니다.

혹시 설치가 되지 않았다고 Installed : (none)라고 뜨신다면

명령창에 sudo apt-get install php7.4-mysql 를 입력하여 설치해 주십시요.

sudo apt-get install php7.4-mysql

8-8. 이제 MariaDB에서 중요한 테이블 언어셋 기본값을 설정하겠습니다.

언어값이 다르면 글자가 깨져보인다거나 이모지가 깨져보이는 등 나중에 셋팅하고 나서 언어셋을 바꾸느라 난리가 날 수 있습니다.;;;

모바일 이모지까지 표현이 가능한 utf8mb4로 언어셋을 지정해 보겠습니다.

MariaDB 환경설정 위치는 /etc/mysql/conf.d/ 에 파일명이 mariadb.cnf로 있습니다.

mysqld_safe_syslog.cnf 파일만 있다면 신규로 생성해서 제작해야 합니다.

명령창에서 sudo touch /etc/mysql/conf.d/mariadb.cnf 를 입력한 후
sudo nano /etc/mysql/conf.d/mariadb.cnf 를 입력합니다.

ubuntu@wordpress:~$ sudo touch /etc/mysql/conf.d/mariadb.cnf
ubuntu@wordpress:~$ sudo nano /etc/mysql/conf.d/mariadb.cnf

그럼 nano에디터에서 빈 화면이 나타납니다.

[client]
default-character-set=utf8mb4

[mysql]
default-character-set=utf8mb4

[mysqld]
collation-server = utf8mb4_unicode_ci
character-set-server = utf8mb4
collation_server = utf8mb4_unicode_ci
character_set_server = utf8mb4

해당 내용을 입력 후 (위 내용을 드래그해서 복사하신 후 PuTTY에서 마우스 오른쪽 버튼을 누르시면 붙습니다.

CTRL + X 하신 후 Y버튼 그리고 파일명이 나오면 Enter를 눌러주십시요.

8-9. 그 다음 MariaDB를 재시작하여 주십니다.

명령창에서 sudo service mysql restart 를 입력합니다.

ubuntu@wordpress:~$ sudo service mysql restart

8-10. 그 후에 우분투 시스템을 재부팅 해야 합니다.

명령창에 sudo shutdown now -r 를 입력합니다.

ubuntu@wordpress:~$ sudo shutdown now -r

* 우분투를 재부팅하지 않으면 새로 접속시에 *** System restart required *** 라는 문구가 나타나며 리부팅 하라는 메시지가 나타납니다.

Using username "ubuntu".
Authenticating with public key "              " from agent
Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 5.0.0-1014-oracle x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sat May 30 19:31:43 KST 2020

  System load:  0.0               Processes:           125
  Usage of /:   5.0% of 44.97GB   Users logged in:     0
  Memory usage: 40%               IP address for ens3: 
  Swap usage:   0%


8 packages can be updated.
0 updates are security updates.


*** System restart required ***
Last login: Sat May 30 19:28:35 2020 from 
ubuntu@wordpress:~$

가장 힘든 DB설치까지 마치셨습니다.

이제 도메인 연결하고 SSL 인증서 받아 HTTPS 적용하고 DB생성하여 워드프레스 설치만 하시면 됩니다.

15개 단원 중 절반정도 진행이라고 할 수 있는데... 가장 힘든(?) 구간은 넘어왔다고 생각됩니다.

다음은 꼭 해야 하는 것은 아니지만 DB를 편하게 관리할 수 있는 phpMyAdmin을 설치해 보겠습니다.

Contents

0. 오라클 클라우드에서 Ubuntu LEMP(Linux+Nginx+MariaDB+PHP7)에 WORDPRESS 설치하기
1. 오라클 클라우드 무료 가입 (Oracle Cloud Free Tier)하기
2. 오라클 클라우드에서 Ubuntu(우분투) 인스턴스 서버 생성하기 (네트워크 셋팅을 포함)
3. 오라클 클라우드 SSH 접속 및 SFTP 등 서버 접속 환경 설정하기
4. 오라클 클라우드 우분투 서버 환경 설정하기
5. Nginx 서버 설치하기
6. Linux 폴더 권한 설정 확인하기
7. Nginx 서버에 PHP7 설치하기
8. MariaDB 설치하기
9. phpMyAdmin 설치하기
10. 도메인 연결하기
11. sendmail 설치하기
12. HTTPS 적용을 위한 SSL 인증서 발급받기
13. DB 생성하기
14. Wordpress 설치하기
15. Wordpress 설치 후 서버 및 Wordpress 환경 설정하기

* 해당 내용은 오라클 제품을 다루고 있지만 이는 개인적인 테스트 결과이며, 오라클 공식 문서는 아님을 미리 밝힙니다.

반응형