๊ธ€ ์ž‘์„ฑ์ž: ๋˜ฅํด๋ฒ .
๋ฐ˜์‘ํ˜•

LEMP ์Šคํƒ


LEMP์Šคํƒ์ด๋ž€ Linux + Nginx + MySQL(MariaDB)๋กœ ๊ตฌ์„ฑํ•˜์—ฌ ๋™์  ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ตฌ์„ฑ์„ ์ผ์ปซ๋Š” ๋ง์ด๋‹ค.

๋น„์Šทํ•œ ๋ง๋กœ LAMP์Šคํƒ์ด๋ผ๊ณ  LEMP์Šคํƒ์—์„œ Nginx๋Œ€์‹  Apache๋กœ ๊ตฌ์„ฑํ•œ ์Šคํƒ๋„ ์—ญ์‹œ ์œ ๋ช…ํ•˜๋‹ค.

์ด ๊ธ€์—์„œ๋Š” LEMP ์Šคํƒ์„ ์„ค์น˜ํ•˜๋Š” ๋ฒ•์„ ์„œ์ˆ ํ•˜๊ฒ ๋‹ค!

์•„๋งˆ ๋ฆฌ๋ˆ…์Šค๋ฅผ ๋‹ค๋ฃจ๋ฉด์„œ ๊ฐ€์žฅ ์ฒ˜์Œ์— ๋‚œ๊ด€์„ ๊ฒช๋Š”๋ฐ ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ธํŒ…์ด๋ผ๊ณ  ์ƒ๊ฐํ•œ๋‹ค.

์„ค์น˜ ์ˆœ์„œ๊ฐ€ ๊ผฌ์ด๊ธฐ๋งŒ ํ•˜๋”๋ผ๋„ ์„ค์น˜๊ฐ€ ์•ˆ๋˜๋Š” ๊ฒฝ์šฐ๋„ ์žˆ๊ณ ,

์—ฌ๋Ÿฌ๋ชจ๋กœ ๊ณจ์น˜๊ฐ€ ์•„ํ”„๋‹ค (๊ทธ๋ž˜์„œ docker๊ฐ™์€ ๊ฐ€์ƒํ™” ๋„๊ตฌ๋ฅผ ์“ฐ๋Š”๊ฑฐ์ง€๋งŒ ใ…Žใ…Ž)

Nginx ์„ค์น˜ํ•˜๊ธฐ


Nginx๋Š” ์›น ์„œ๋ฒ„ ์ข…๋ฅ˜ ์ค‘ ํ•˜๋‚˜๋กœ Apache ์›น ์„œ๋ฒ„์™€ ๋”๋ถˆ์–ด ๊ฐ€์žฅ ์ธ๊ธฐ๊ฐ€ ๋งŽ์€ ์›น์„œ๋ฒ„ ์ค‘ ํ•˜๋‚˜๋‹ค!

Nginx์™€ Apache๋Š” ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ์‹์ด ๋‹ค๋ฅธ๋ฐ ์ด ๊ธ€์—์„œ๋Š” ์„ค์น˜ ๋ฐ ์„ธํŒ…ํ•˜๋Š”๋ฐ ์ค‘์ ์„ ๋งž์ถฐ ํฌ์ŠคํŒ…ํ•˜๊ฒ ๋‹ค

๊ธฐ๋ณธ์ ์ธ CentOS ์ €์žฅ์†Œ๋กœ๋Š” Nginx๋ฅผ ์„ค์น˜ํ•  ์ˆ˜ ์—†์œผ๋ฏ€๋กœ EPEL ์ €์žฅ์†Œ๋ฅผ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ช…๋ น์–ด๋กœ ์„ค์น˜ํ•œ๋‹ค.

yum install epel-release -y

๋‹ค์Œ์œผ๋กœ Nginx๋ฅผ ์„ค์น˜ํ•œ๋‹ค.

yum install nginx -y

์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ๋ฆฌ๋ˆ…์Šค๋ฅผ ์žฌ์‹œ์ž‘ ํ•ด๋„ ์ž๋™์œผ๋กœ Nginx๊ฐ€ ๋Œ์•„๊ฐˆ ์ˆ˜ ์žˆ๊ฒŒ ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅ ํ•œ๋‹ค.

systemctl start nginx
systemctl enable nginx

systemctl๋Š” ์œ„์—์„œ ์–ธ๊ธ‰ ํ•œ ๋Œ€๋กœ ๋ฆฌ๋ˆ…์Šค๋ฅผ ์žฌ์‹œ์ž‘ํ•ด๋„ ๋ฐฑ๊ทธ๋ผ์šด๋“œ(๋ฐ๋ชฌ์ƒํƒœ)๋กœ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋™์ž‘์‹œ์ผœ์ฃผ๋Š” ๋ช…๋ ์–ด๋‹ค.

๋‹ค์‹œ ๊ฐ€์ƒ๋จธ์‹ ์—์„œ ๋ฒ—์–ด๋‚˜ ์œˆ๋„์šฐ ํ™˜๊ฒฝ์—์„œ ์›น ๋ธŒ๋ผ์šฐ์ €๋ฅผ ์‹คํ–‰ ์‹œํ‚จ๋’ค ์ฃผ์†Œ์ฐฝ์—

http://๊ฐ€์ƒ๋จธ์‹ ์ฃผ์†Œ

๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์›น์„œ๋ฒ„๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ•˜๋Š” ๊ฒƒ์„ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ๋‹ค.

๊ฐ€์ƒ๋จธ์‹  ๋„คํŠธ์›Œํฌ ์„ธํŒ…ํ•˜๋Š” ๋ฒ•์€ ๋‹ค์Œ ํฌ์ŠคํŒ…์„ ์ฐธ๊ณ ํ•˜์ž!

VirtualBox์—์„œ ๊ฐ€์ƒํ™˜๊ฒฝ ๊ตฌ์ถ•ํ•˜๊ธฐ

PHP 7.1 ์„ค์น˜ํ•˜๊ธฐ


PHP7.1 ์„ค์น˜๋ฅผ ํ•˜๊ธฐ์œ„ํ•ด์„œ๋Š” Nginx ์„ค์น˜์™€ ๋™์ผํ•˜๊ฒŒ PHP7.1 ํŒจํ‚ค์ง€๊ฐ€ ํฌํ•จ๋œ ์ถ”๊ฐ€์ ์ธ CentOS ์ €์žฅ์†Œ๊ฐ€ ํ•„์š”ํ•˜๋‹ค.

๋‹ค์Œ ๋ช…๋ น์–ด๋กœ ์ถ”๊ฐ€ ์ €์žฅ์†Œ๋ฅผ ์„ค์น˜ํ•˜์ž.

wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm

์ถ”๊ฐ€ ์ €์žฅ์†Œ๋ฅผ ์„ค์น˜ํ•˜๊ณ  ๋‚˜์„œ ๊ธฐ๋ณธ์ ์œผ๋กœ PHP7.1 ํŒจํ‚ค์ง€๊ฐ€ ๋น„ํ™œ์„ฑํ™” ๋˜์žˆ๋Š”๋ฐ ๋‹ค์Œ ๋ช…๋ น์–ด๋กœ ํ™œ์„ฑํ™”์‹œ์ผœ์•ผ ํ•œ๋‹ค.

yum install yum-utils -y
yum-config-manager --enable remi-php71

๋‹ค์Œ์œผ๋กœ ๊ธฐ๋ณธ์ ์ธ PHP ํŒจํ‚ค์ง€๋“ค์„ ์„ค์น˜ํ•œ๋‹ค

yum --enablerepo=remi,remi-php71 install php-fpm php-common -y

๋งˆ์ง€๋ง‰์œผ๋กœ ๊ธฐ๋ณธ PHP ๋ชจ๋“ˆ๋“ค์„ ์„ค์น˜ํ•œ๋‹ค.

yum --enablerepo=remi,remi-php71 install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml -y

Nginx & PHP ์„ธํŒ…ํ•˜๊ธฐ


์ด์ œ Nginx์™€ PHP๋ฅผ ๋‚ด ์ž…๋ง›๋Œ€๋กœ ์‚ฌ์šฉํ•˜๊ธฐ์œ„ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ณผ์ •์„ ๋”ฐ๋ผ ์„ธํŒ…ํ•œ๋‹ค.

๋จผ์ € Nginx ์„ค์ •์„ ๋ฐ”๊พธ๊ธฐ ์œ„ํ•ด์„œ vi ํŽธ์ง‘๊ธฐ๋กœ ๋‹ค์Œ ํŒŒ์ผ์„ ๋งŒ๋“ ๋‹ค.

vi /etc/nginx/conf.d/default.conf

nginx์˜ ์„ค์ • ํŒŒ์ผ ๊ฒฝ๋กœ๋Š” /etc/nginx ํด๋”์— ์œ„์น˜ํ•˜๊ณ ์žˆ๋‹ค.

server {
    listen   80;
    server_name 192.168.56.102;
    #server_name์—๋Š” ์œ„์™€๊ฐ™์ด ๊ฐ€์ƒํ™˜๊ฒฝ IP๋ฅผ ์ž…๋ ฅํ•œ๋‹ค

    root   /game/html;
    #์›๋ž˜๋Š” /usr/share/nginx/html ๊ฒฝ๋กœ๋กœ ์žกํ˜€์žˆ๋Š”๋ฐ, ๊ธฐ๋ณธ ํด๋”๋ฅผ ์ž๊ธฐ ์ž…๋ง›๋Œ€๋กœ ๋ฐ”๊พธ๋ฉด๋œ๋‹ค.
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ =404;
    }
    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /game/html;
          #์ด ๋ถ€๋ถ„ ์—ญ์‹œ ์ž๊ธฐ๊ฐ€ ์›ํ•˜๋Š” ํด๋”๋กœ ๋ฐ”๊ฟ”์ค€๋‹ค
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

server_name์—๋Š” ์ž์‹ ์˜ ๊ฐ€์ƒํ™˜๊ฒฝ IP๋ฅผ ์ž…๋ ฅํ•ด์•ผํ•œ๋‹ค!

๋˜ํ•œ, root ์˜†์— ์›๋ž˜ /usr/share/nginx/html๋กœ ์„ค์ •๋˜์–ด์žˆ์—ˆ๋‹ค.

ํ•˜์ง€๋งŒ! ๋‚˜๋Š” /game/html๋กœ ๋ฐ”๊ฟจ๋Š”๋ฐ ์ด ์˜๋ฏธ๋Š” ์šฐ๋ฆฌ๊ฐ€ nginx๋ฅผ ์„ค์น˜ ํ•  ๋•Œ ๋ธŒ๋ผ์šฐ์ €๋ฅผ ํ†ตํ•ด

"http://๊ฐ€์ƒ๋จธ์‹ ์ฃผ์†Œ"๋ฅผ ์ž…๋ ฅํ•˜๋ฉด nginx ๋ฉ”์ธ ํŽ˜์ด์ง€๊ฐ€ ๋ณด์—ฌ์กŒ๋Š”๋ฐ ๊ทธ ์›๋ฆฌ๋Š”

์‹ค์ œ๋กœ /usr/share/nginx/html/index.html ์ด ํŒŒ์ผ์ด ๋ธŒ๋ผ์šฐ์ €์— ๋ณด์—ฌ์ง„๊ฒƒ์ด๋‹ค

ํ•˜์ง€๋งŒ ๋‚˜๋Š” ๊ธฐ๋ณธ nginx ํด๋” ๊ฒฝ๋กœ๊ฐ€ ์•„๋‹Œ ๋‚ด๊ฐ€ ์„ค์ •ํ•œ ํด๋”๋ฅผ ์›น์„œ๋ฒ„์˜ ๊ธฐ๋ณธ ํด๋”๋กœ ์žก๊ณ ์‹ถ์–ด์„œ

root์—๋‹ค /game/html์ด๋ผ๋Š” ๊ฒฝ๋กœ๋ฅผ ์ ์–ด์ฃผ์—ˆ๋‹ค.

์•ž์œผ๋กœ ์›นํŽ˜์ด์ง€๋Š” ์ด ๊ฒฝ๋กœ์— ์œ„์น˜์‹œํ‚ฌ๊ฒƒ์ด๋‹ค!

๋˜ํ•œ ๋‹ค์Œ ๋ช…๋ น์–ด๋กœ ์—ญ์‹œ root๋ฅผ ๋‚ด๊ฐ€ ์œ„์น˜์‹œํ‚ฌ ํด๋”๋ฅผ ์ง€์ •์‹œ์ผœ์ค€๋‹ค.

vi /etc/nginx/nginx.conf

์—ฌ๊ธฐ์„œ root ํ•ญ๋ชฉ์„ ์ฐพ์•„์„œ ๋‚ด๊ฐ€ ์ง€์ •ํ•  ํด๋”๋กœ ๋ฐ”๊ฟ”์ฃผ๋ฉด ๋œ๋‹ค.

์„ค์ •์ด ์™„๋ฃŒ๋˜์—ˆ์œผ๋ฉด Nginx ์„œ๋น„์Šค๋ฅผ ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์žฌ์‹œ์ž‘ํ•œ๋‹ค.

systemctl restart nginx

๋‹ค์Œ์—๋Š” PHP-FPM๋ฅผ ์„ธํŒ…ํ•  ๊ฒƒ์ด๋‹ค.

PHP-FPM *์—†์ด๋„ Nginx๋งŒ์œผ๋กœ๋„ *์›น์„œ๋ฒ„๋ฅผ ์šด์˜ ํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ ์›น์„œ๋ฒ„๋งŒ์œผ๋กœ๋Š” ์ •์ ์ธ ํŽ˜์ด์ง€๋ฐ–์— ํ‘œํ˜„์„ ๋ชปํ•œ๋‹ค.

์ •์ ์ธ ํŽ˜์ด์ง€๋ž€ ์šฐ๋ฆฌ๊ฐ€ ๋งŒ๋“  htmlํŒŒ์ผ๋“ค์„ ๊ทธ๋ƒฅ ๋ณด์—ฌ์ฃผ๊ณ  ๋‹ค๋ฅธ ๊ณณ์œผ๋กœ ๋งํฌ์‹œํ‚ค๊ณ .. ์ด๋Ÿฌํ•œ ๊ธฐ๋Šฅ๋ฐ–์— ๋ชปํ•˜๋Š” ํŽ˜์ด์ง€๋ฅผ ๋œปํ•˜๋Š”๋ฐ ์šฐ๋ฆฌ๊ฐ€ ์›ํ•˜๋Š” ๊ฒƒ์€ ์‚ฌ์šฉ์ž๋กœ๋ถ€ํ„ฐ ์ž…๋ ฅ์„ ๋ฐ›์•„ DB์—๋„ ์ €์žฅ์‹œํ‚ค๊ณ , ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€๊ณต์‹œ์ผœ์„œ ์‚ฌ์šฉ์žํ•œํ…Œ ํ‘œํ˜„ํ•˜๊ณ  ์‹ถ์€ ๊ทธ๋Ÿฐ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์›ํ•œ๋‹ค!

๊ทธ๋Ÿฌ๊ธฐ ์œ„ํ•ด์„  ์ถ”๊ฐ€์ ์œผ๋กœ Nginx์™€ PHP๋ฅผ ์—ฐ๋™์‹œ์ผœ ๋™์ ์ธ ์›น์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ตฌ์ถ• ํ•  ์ˆ˜ ์žˆ๋‹ค!

PHP-FPM๋ฅผ ์„ค์ •ํ•˜๊ธฐ ์œ„ํ•ด์„œ ๋‹ค์Œ ํŒŒ์ผ์„ viํŽธ์ง‘๊ธฐ๋กœ ์—ฐ๋‹ค.

nano /etc/php-fpm.d/www.conf

๊ทธ๋ฆฌ๊ณ  ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ผ์ธ์„ ์ฐพ์•„ ํ•ด๋‹นํ•˜๋Š” ๋‚ด์šฉ๋Œ€๋กœ ๋ฐ”๊ฟ”์ค€๋‹ค.

user = apache๋ฅผ user = nginx๋กœ ์ˆ˜์ •

group = apache๋ฅผ group = nginx๋กœ ์ˆ˜์ •

;listen.owner = nobody๋ฅผ listen.owner = nginx๋กœ ์ˆ˜์ •

;listen.group = nobody๋ฅผ listen.group = nginx๋กœ ์ˆ˜์ •

listen = 127.0.0.1:9000 ๋ฅผ listen = /var/run/php-fpm/php-fpm.sock๋กœ ์ˆ˜์ •

 

๊ฐ„๋‹จํ•˜๊ฒŒ ์„ค์ • ํŒŒ์ผ์— ๋Œ€ํ•ด ์ฒจ์–ธํ•˜์ž๋ฉด,

ํ•˜๋‚˜์˜ ์žฅ๋น„์—์„œ Nginx์™€ PHP-FPM์ด ์šด์˜๋œ๋‹ค๋ฉด ์œ ๋‹›์Šค ์†Œ์ผ“ ๋ฐฉ์‹์ด ๋” ์œ ๋ฆฌํ•˜๋‹ค

๊ทธ๋ ‡๊ธฐ์—, listen์—๋‹ค unix ์†Œ์ผ“์„ ์ž‘์„ฑํ•ด์ฃผ์—ˆ๊ณ  PHP-FPM ์„œ๋น„์Šค์˜ ๊ถŒํ•œ์„ nginx๋ฅผ ์ˆ˜์ •์‹œ์ผฐ๋‹ค.

 

์ด์ œ ๋‚ด๊ฐ€ ์„ค์ •์—์„œ ์ง€์ •ํ•ด์ค€ ๊ธฐ๋ณธ ํด๋”(/game/html) ์— PHP-FPM์ด ์ž˜ ์ž‘๋™ํ•˜๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด

๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ช…๋ น์–ด๋กœ ํ…Œ์ŠคํŠธ phpํŒŒ์ผ์„ ํ•˜๋‚˜ ๋งŒ๋“ค์–ด์ค€๋‹ค.

vi /game/html/test.php
<?php
		phpinfo();

phpinfo()ํ•จ์ˆ˜๋Š” PHP์˜ ์„ค์ • ๋‚ด์šฉ์„ ๋ณด์—ฌ์ฃผ๋Š” ํ•จ์ˆ˜๋‹ค.

์ด์ œ ์œˆ๋„์šฐ๋กœ ๋Œ์•„๊ฐ€ ๋ธŒ๋ผ์šฐ์ € ์ฃผ์†Œ ์ž…๋ ฅ์ฐฝ์— http://๊ฐ€์ƒ๋จธ์‹ ์ฃผ์†Œ/test.php ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ž˜~ ์ž‘๋™ํ•˜๋Š” ๊ฒƒ์„ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ๋‹ค. (PHP๋ฅผ ์„ค์น˜ํ•˜์ง€ ์•Š์•˜์œผ๋ฉด ํ™”๋ฉด์ด ๋‚˜์˜ค์ง€ ์•Š์•˜์„ ๊ฒƒ์ด๋‹ค)

ํ˜น์‹œ 404 Not found๋‚˜ ๋‹ค๋ฅธ ์˜ค๋ฅ˜ ํŽ˜์ด์ง€๊ฐ€ ์ถœ๋ ฅํ•œ๋‹ค๋ฉด ์•„๋ž˜ ๊ณผ์ •์„ ์ถ”๊ฐ€์ ์œผ๋กœ ๋” ์ง„ํ–‰ํ•œ๋‹ค.

vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

๋‹ค์Œ๊ณผ ๊ฐ™์ด SELINUX๋ฅผ disabled๋กœ ์ˆ˜์ •ํ•˜๊ณ  ์žฌ๋ถ€ํŒ…ํ•œ๋‹ค.

SELINUX๋Š” ๋ฆฌ๋ˆ…์Šค์˜ ๋ณด์•ˆ์ ์ธ ๋ฉด์„ ๋‹ด๋‹นํ•˜๋Š”๋ฐ ๋กœ์ปฌ ๊ฐ€์ƒํ™˜๊ฒฝ์—์„œ๋Š” ๋ฌธ์ œ๊ฐ€ ์—†๊ธฐ ๋•Œ๋ฌธ์— ๋น„ํ™œ์„ฑํ™” ํ•ด์ฃผ์—ˆ์ง€๋งŒ ์‹ค์ œ ์ƒ์šฉ ํ™˜๊ฒฝ์—์„œ๋Š” SELINUX ์ •์ฑ…์— ์˜ˆ์™ธ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์ฃผ๋Š” ๊ฒƒ์ด ์ข‹๋‹ค

 

MySQL(MariaDB) ์„ค์น˜


์ด์ œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋กœ ์œ ๋ช…ํ•œ MySQL๋ฅผ ์„ค์น˜ํ•  ๊ฒƒ์ด๋‹ค.

CentOS7์—์„œ๋Š” MySQL์ด ์•„๋‹Œ MariaDB๊ฐ€ ๊ธฐ๋ณธ์œผ๋กœ ์žกํ˜€์„œ MariaDB๋ฅผ ์„ค์น˜ ํ•  ๊ฒƒ์ด๋‹ค.

MariaDB๋Š” MySQL์˜ ๋ผ์ด์„ผ์Šค์— ๋ฐ˜๋ฐœํ•˜์—ฌ ์˜คํ”ˆ ์†Œ์Šค RDBMS๋‹ค.

์ฆ‰ ๋ฌด๋ฃŒ๋ผ๋Š” ์‚ฌ์‹ค! MySQL ์†Œ์Šค์ฝ”๋“œ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜์˜€๊ธฐ ๋•Œ๋ฌธ์—

๊ธฐ์กด MySQL๊ณผ ๋˜‘๊ฐ™์ด ์‚ฌ์šฉํ•˜๋Š”๋ฐ ๋ฌธ์ œ๊ฐ€ ์—†๋‹ค๊ณ  ๋ณธ๋‹ค

๋‹ค์Œ ๋ช…๋ น์–ด๋กœ MariaDB๋ฅผ ์„ค์น˜ํ•œ๋‹ค.

yum install mariadb-server mariadb -y

์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์œผ๋ฉด ์„œ๋น„์Šค๋ฅผ ๋“ฑ๋กํ•œ๋‹ค.

systemctl start mariadb
systemctl enable mariadb

๋งˆ์ง€๋ง‰์œผ๋กœ ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ๊ธฐ๋ณธ์ ์ธ ์„ค์ •์„ ์ž…๋ ฅํ•œ๋‹ค.

mysql_secure_installation
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 authorization.

New password: password
Re-enter new password: password
Password updated successfully!
Reloading privilege tables..
 ... Success!

๋ฌป๋Š” ํ•ญ๋ชฉ์— ๋”ฐ๋ผ Y/N๋ฅผ ์ž๊ธฐ ์ž…๋ง›์— ๋”ฐ๋ผ ์„ ํƒํ•ด์„œ ์ž…๋ ฅํ•˜๊ณ  root ๊ณ„์ •์˜ ํŒจ์Šค์›Œ๋“œ๋ฅผ ์„ค์ •ํ•ด์ฃผ๋ฉด ์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋œ๋‹ค.

 

๋ฐ˜์‘ํ˜•