개인 서버에 Ubuntu LEMP WORDPRESS 설치하기 9

Contents

1. 개인 서버 만들기, 파워, 케이스, 메인보드, CPU쿨러, SSD, 메모리(RAM), CPU 선정과 주문 조립
2. 공유기 설정하기, 공유기1 브릿지 모드 설정, iptime 공유기2 IPTV 연결 설정
3. 개인 서버에 Ubuntu 22.04.4 LTS 설치하기, Universal-USB-Installer를 사용하여 부팅 가능한 USB를 생성하기
4. 개인 PC에 우분투 서버 접속용 3가지 SSH 설치, 자료실의 Putty, EditPlus, FileZilla 다운 후 설치하기
5. 우분투 서버 환경 date 설정하기
6. 웹 서버 Nginx 설치, 현재 iptables 규칙 초기화
7. Ubuntu sever 폴더 권한 설정, Nginx 페이지의 내용 수정과 권한 설정
8. Nginx 서버에 PHP8.3 설치, 자주 쓰이는 php8.3 모듈 설치하기
9. apt update와 upgrade가 완료 후 mariadb를 설치하기
10. MariaDB 관리 도구 phpMyAdmin 설치하기
11. 아사달에서 도메인 연결하기, 카페24에서 도메인 연결하기
12. HTTPS 적용을 위한 SSL 인증서 발급, Nginx에 acme-challenge 폴더 위치를 알리기 위하여 letsencrypt.conf 파일 만들기, Let’s Encrypt SSL 발급 받기
13. MariaDB에서 데이터베이스(DB) 만들기, phpMyAdmin에서 DB생성
14. 워드프레스 설치, 우분투 서버에 ko.wordpress.org/latest-ko_KR.zip 파일 설치, wordpress.zip 파일 압축 풀기, 서버 폴더 소유자 권한 및 사용자 그룹 변경
15. 워드프레스 설치 후 환경 설정, 우분투 서버에 wp-config.php에 임시디렉토리 설정, FTP 연결 정보 입력, Putty로 php.ini, nginx.conf를 수정

개인 서버에 Ubuntu LEMP WORDPRESS 설치하기 9

개인 서버에 Ubuntu sever LEMP(Linux-ubuntu+Nginx+MariaDB-Phpmyadmin+PHP8.3) WORDPRESS 설치하기

MariaDB는 MySQL 데이터베이스 관리 시스템의 포크(fork)이며, 오픈 소스 커뮤니티 주도의 프로젝트입니다. MySQL의 원 개발자인 몬티 와이드니어스(Monty Widenius)가 주도하여 2009년에 시작되었습니다. MariaDB는 MySQL과의 호환성을 유지하면서도 여러 가지 새로운 기능과 개선된 성능을 제공합니다.

MariaDB는 MySQL의 대안으로 널리 인정받고 있으며, 오픈 소스 데이터베이스 솔루션으로서 지속적으로 발전하고 있습니다. MySQL 사용자 뿐만 아니라 새로운 프로젝트를 시작하는 개발자들에게도 매력적인 선택이 될 수 있습니다.

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

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

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

junewoo@cvilla:~$ sudo apt-cache policy mariadb-server
mariadb-server:
  Installed: (none)
  Candidate: 1:10.6.16-0ubuntu0.22.04.1
  Version table:
 *** 1:10.6.16-0ubuntu0.22.04.1 500
        500 http://kr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages
        500 http://kr.archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages
        100 /var/lib/dpkg/status
     1:10.6.7-2ubuntu1 500
        500 http://kr.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
junewoo@cvilla:~$

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

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

URL : https://mariadb.org/mariadb/all-releases/#11-2

 

위 페이지에 최신 MariaDB 11.3.2가 안정적 버전이라고 설명되어 있습니다.

9-3. MariaDB 설치 환경을 설정해 보겠습니다.

명령창에 sudo apt-get install software-properties-common 를 입력합니다.

junewoo@cvilla:~$ 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.

다음 sudo apt-key adv –fetch-keys ‘https://mariadb.org/mariadb_release_signing_key.asc’ 를 입력합니다.

junewoo@cvilla:~$ sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.X8IB6fIcUY/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: "MariaDB Signing Key <signing-key@mariadb.org>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

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

junewoo@cvilla:~$ sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu bionic main'
Repository: 'deb [arch=amd64,arm64,ppc64el] https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu bionic main'
Description:
Archive for codename: bionic components: main
More info: https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Adding deb entry to /etc/apt/sources.list.d/archive_uri-https_ftp_harukasan_org_mariadb_repo_11_3_2_ubuntu-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-https_ftp_harukasan_org_mariadb_repo_11_3_2_ubuntu-jammy.list
Hit:1 http://kr.archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://kr.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Hit:3 http://kr.archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:4 http://kr.archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:5 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1,433 kB]
Get:6 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease [23.9 kB]
Get:7 http://kr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1,053 kB]
Get:8 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 Packages [123 kB]
Ign:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:10 https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu bionic InRelease
Ign:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:10 https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu bionic InRelease
Ign:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:10 https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu bionic InRelease
Err:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
  Could not connect to ftp.harukasan.org:443 (175.214.128.79). - connect (111: Connection refused) Cannot initiate the connection to ftp.harukasan.org:443 (2001:470:23:440::2). - connect (101: Network is unreachable) Could not connect to ftp.harukasan.org:443 (118.38.208.102), connection timed out
Err:10 https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu bionic InRelease
  Cannot initiate the connection to ftp.harukasan.org:443 (2001:470:23:440::2). - connect (101: Network is unreachable)
Fetched 2,862 kB in 38s (76.0 kB/s)
Reading package lists... Done
W: Failed to fetch https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu/dists/bionic/InRelease  Could not connect to ftp.harukasan.org:443 (175.214.128.79). - connect (111: Connection refused) Cannot initiate the connection to ftp.harukasan.org:443 (2001:470:23:440::2). - connect (101: Network is unreachable) Could not connect to ftp.harukasan.org:443 (118.38.208.102), connection timed out
W: Failed to fetch https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu/dists/bionic/InRelease  Cannot initiate the connection to ftp.harukasan.org:443 (2001:470:23:440::2). - connect (101: Network is unreachable)
W: Some index files failed to download. They have been ignored, or old ones used instead.
junewoo@cvilla:~$

MariaDB 설치를 위한 환경이 완료되었습니다.

9-4. apt를 업데이트 및 업그레이드합니다.

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

junewoo@cvilla:~$ sudo apt update
Hit:1 http://kr.archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://kr.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Hit:3 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease
Hit:4 http://kr.archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:5 http://kr.archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:6 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1,433 kB]
Get:7 http://kr.archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [848 kB]
Get:8 http://kr.archive.ubuntu.com/ubuntu jammy-security/universe Translation-en [162 kB]
Ign:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:10 https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu bionic InRelease
Ign:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:10 https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu bionic InRelease
Ign:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:10 https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu bionic InRelease
Err:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
  Could not connect to ftp.harukasan.org:443 (175.214.128.79). - connect (111: Connection refused) Cannot initiate the connection to ftp.harukasan.org:443 (2001:470:23:440::2). - connect (101: Network is unreachable) Could not connect to ftp.harukasan.org:443 (118.38.208.102), connection timed out
Err:10 https://ftp.harukasan.org/mariadb/repo/11.3.2/ubuntu bionic InRelease
  Cannot initiate the connection to ftp.harukasan.org:443 (2001:470:23:440::2). - connect (101: Network is unreachable)
Fetched 2,672 kB in 38s (70.9 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
15 packages can be upgraded. Run 'apt list --upgradable' to see them.

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

junewoo@cvilla:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  libmagickwand-6.q16-6 libmagickcore-6.q16-6 imagemagick-6-common
Learn more about Ubuntu Pro at https://ubuntu.com/pro
The following packages have been kept back:
  dpkg libgpgme11
The following packages will be upgraded:
  php8.2-bcmath php8.2-cli php8.2-common php8.2-curl php8.2-fpm php8.2-gd
  php8.2-intl php8.2-mbstring php8.2-mysql php8.2-opcache php8.2-readline
  php8.2-xml php8.2-zip
13 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 5,962 kB of archives.
After this operation, 4,096 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-zip amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [29.6 kB]
Get:2 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-xml amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [123 kB]
Get:3 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-readline amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [13.6 kB]
Get:4 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-opcache amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [370 kB]
Get:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-mysql amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [131 kB]
Get:6 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-mbstring amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [537 kB]
Get:7 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-intl amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [161 kB]
Get:8 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-gd amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [32.9 kB]
Get:9 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-cli amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [1,887 kB]
Get:10 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-fpm amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [1,893 kB]
Get:11 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-curl amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [40.4 kB]
Get:12 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-bcmath amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [16.5 kB]
Get:13 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.2-common amd64 8.2.16-3+ubuntu22.04.1+deb.sury.org+1 [727 kB]
Fetched 5,962 kB in 36s (164 kB/s)
(Reading database ... 113852 files and directories currently installed.)
Preparing to unpack .../00-php8.2-zip_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-zip (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../01-php8.2-xml_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-xml (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../02-php8.2-readline_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-readline (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../03-php8.2-opcache_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-opcache (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../04-php8.2-mysql_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-mysql (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../05-php8.2-mbstring_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-mbstring (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../06-php8.2-intl_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-intl (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../07-php8.2-gd_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-gd (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../08-php8.2-cli_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-cli (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../09-php8.2-fpm_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-fpm (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../10-php8.2-curl_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-curl (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../11-php8.2-bcmath_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-bcmath (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Preparing to unpack .../12-php8.2-common_8.2.16-3+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.2-common (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) over (8.2.15-1+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-common (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-mysql (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-bcmath (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-zip (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-opcache (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-readline (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-mbstring (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-intl (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-curl (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-xml (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-gd (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-cli (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.2-fpm (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for php8.2-cli (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Processing triggers for php8.2-fpm (8.2.16-3+ubuntu22.04.1+deb.sury.org+1) ...
Scanning processes...
Scanning candidates...
Scanning processor microcode...
Scanning linux images...

Running kernel seems to be up-to-date.

The processor microcode seems to be up-to-date.

Restarting services...
Service restarts being deferred:
 /etc/needrestart/restart.d/dbus.service
 systemctl restart networkd-dispatcher.service
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
junewoo@cvilla:~$

중간에 Do you want to continue? [Y/n]  물으면 Y라고 답합니다.

9-5. apt update와 upgrade가 완료 후 mariadb를 설치합니다.

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

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

junewoo@cvilla:~$ 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-11.3 mariadb-client-core-11.3 mariadb-common mariadb-server-11.3 mariadb-server-core-11.3 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-11.3 mariadb-client-core-11.3 mariadb-common mariadb-server mariadb-server-11.3 mariadb-server-core-11.3
  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/11.3/ubuntu bionic/main amd64 libmariadb3 amd64 1:11.3.23+maria~bionic [148 kB]
Get:24 https://ftp.harukasan.org/mariadb/repo/11.3/ubuntu bionic/main amd64 mariadb-client-core-10.4 amd64 1:11.3.23+maria~bionic [782 kB]
Get:25 https://ftp.harukasan.org/mariadb/repo/11.3/ubuntu bionic/main amd64 mariadb-client-10.4 amd64 1:11.3.23+maria~bionic [1173 kB]
Get:26 https://ftp.harukasan.org/mariadb/repo/11.3/ubuntu bionic/main amd64 mariadb-server-core-10.4 amd64 1:11.3.23+maria~bionic [6310 kB]
Get:27 https://ftp.harukasan.org/mariadb/repo/11.3/ubuntu bionic/main amd64 mariadb-server-10.4 amd64 1:11.3.23+maria~bionic [4663 kB]
Get:28 https://ftp.harukasan.org/mariadb/repo/11.3/ubuntu bionic/main ppc64el mariadb-server all 1:11.3.23+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%3a11.3.23+maria~bionic_all.deb ...
Unpacking mysql-common (1:11.3.23+maria~bionic) ...

 

9-6. MariaDB가 잘 설치 되었는지 확인합니다.

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

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

junewoo@cvilla:~$  service mysql status
● mariadb.service - MariaDB 10.6.16 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor prese>
     Active: active (running) since Wed 2024-03-06 15:08:19 KST; 1 day 9h ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 83564 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 16 (limit: 9032)
     Memory: 178.4M
        CPU: 12min 18.938s
     CGroup: /system.slice/mariadb.service
             └─83564 /usr/sbin/mariadbd

Mar 06 15:08:19 cvilla mariadbd[83564]: Version: '10.6.16-MariaDB-0ubuntu0.22.0>
Mar 06 15:08:19 cvilla systemd[1]: Started MariaDB 10.6.16 database server.
Mar 06 15:08:19 cvilla /etc/mysql/debian-start[83580]: Upgrading MySQL tables i>
Mar 06 15:08:19 cvilla mariadbd[83564]: 2024-03-06 15:08:19 0 [Note] InnoDB: Bu>
Mar 06 15:08:19 cvilla /etc/mysql/debian-start[83583]: Looking for 'mariadb' as>
Mar 06 15:08:19 cvilla /etc/mysql/debian-start[83583]: Looking for 'mariadb-che>
Mar 06 15:08:19 cvilla /etc/mysql/debian-start[83583]: This installation of Mar>
Mar 06 15:08:19 cvilla /etc/mysql/debian-start[83583]: There is no need to run >
Mar 06 15:08:19 cvilla /etc/mysql/debian-start[83583]: You can use --force if y>
Mar 06 15:08:19 cvilla /etc/mysql/debian-start[83591]: Checking for insecure ro>
lines 1-23/23 (END)
junewoo@cvilla:~$

 

9-7. 중간 중간 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! 라고 문구가 뜨면 됩니다.

junewoo@cvilla:~$ 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!

9-8. MariaDB를 설치한 후 php-mysql 모듈을 설치합니다.

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

junewoo@cvilla:~$ sudo apt-cache policy php8.3-mysql
[sudo] password for junewoo:
php8.3-mysql:
  Installed: 8.3.3-1+ubuntu22.04.1+deb.sury.org+1
  Candidate: 8.3.3-1+ubuntu22.04.1+deb.sury.org+1
  Version table:
 *** 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 500
        500 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status
junewoo@cvilla:~$

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

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

명령창에 sudo apt-get install php8.3-mysql 를 입력하여 설치합니다.

junewoo@cvilla:~$ sudo apt-get install php8.3-mysql
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
php8.3-mysql is already the newest version (8.3.3-1+ubuntu22.04.1+deb.sury.org+1).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
junewoo@cvilla:~$

 

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

언어값이 다르면 글자가 깨져 보인다 거나 이모지가 깨져서 나옵니다.

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 를 입력합니다.

junewoo@cvilla:~$ sudo touch /etc/mysql/conf.d/mariadb.cnf
junewoo@cvilla:~$ 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에서 마우스 오른쪽 버튼을 누르시면 붙여 넣기가 쉽게 됩니다.

nano 실행 창 에서 CTRL + X 하신 후 Y버튼 그리고 파일명이 나오면 Enter를 누릅니다.

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

junewoo@cvilla:~$ sudo service mysql restart
junewoo@cvilla:~$

9-10. 우분투 시스템을 재부팅 해야 합니다.

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

junewoo@cvilla:~$ sudo shutdown now -r

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

Using username "ubuntu".
Authenticating with public key "              " from agent
Welcome to Ubuntu 22.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 Mar 30 19:31:45 KST 2024

  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 Mar 30 19:28:35 2024 from 
junewoo@cvilla:~$

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

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

10. 개인 서버에 Ubuntu LEMP WORDPRESS 설치하기

Leave a Comment