์ƒˆ์†Œ์‹

์ธ๊ธฐ ๊ฒ€์ƒ‰์–ด

๐Ÿ’ป Linux

CentOS7 ์›น ์„œ๋ฒ„์™€ DB์„œ๋ฒ„ ๋”ฐ๋กœ ๊ตฌ์ถ• ํ›„ ์—ฐ๋™

  • -
๋ฐ˜์‘ํ˜•
# DB์™€ web ๋ถ„๋ฆฌ ๊ตฌ์ถ•
# ์„œ๋ฒ„ ๊ตฌ์ถ•
CentOS7 First vmware

# ๋ธŒ๋ฆฟ์ง€ ์„ค์ •
centos newwork Adapter - nat์—์„œ bridged๋กœ ๋ณ€๊ฒฝ
vim /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO="static"
IPADDR=192.168.0.41
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=8.8.8.8

systemctl restart network

# httpd, php, mariadb, mariadb-server, php-mysqlnd ์„ค์น˜
yum -y install httpd php mariadb mariadb-server php-mysqlnd

systemctl restart httpd
systemctl restart mariadb
systemctl status httpd
systemctl status mariadb
systemctl enable httpd
systemctl enable mariadb

# ๋ฐฉํ™”๋ฒฝ
systemctl stop firewalld
systemctl diable firewalld
setenforce 0

# XE ์„œ๋ฒ„ ๊ตฌ์ถ•
cd /home/centos/๋‹ค์šด๋กœ๋“œ

mv xe.zip /var/www/html

cd /var/www/html

unzip xe.zip

yum -y install php-*
yum -y --skip-broken install php-*

vim /etc/httpd/conf/httpd.conf
>> :set nu
>> 151
>> AllowOverride All

systemctl restart httpd
chmod 707 xe
cd xe

systemctl restart httpd

# DDOS ๊ณต๊ฒฉ ๋ฐฉ์–ดํ•˜๊ธฐ ๋ช…๋ น์–ด
iptables -I INPUT -p tcp --dport 80 -m state --state NEW -m recent --update --seconds 1 --hitcount 10 -j DROP
# DB ๊ตฌ์ถ•
Centos7 Second vmware

# ๋ธŒ๋ฆฟ์ง€ ์„ค์ •
centos newwork Adapter - nat์—์„œ bridged๋กœ ๋ณ€๊ฒฝ
vim /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO="static"
IPADDR=192.168.0.42
NETMASK=255.255.255.0
GATEWAY=192.168.0.2
DNS1=8.8.8.8

systemctl restart network

# ๋ฐฉํ™”๋ฒฝ ํ•ด์ œ
systemctl stop firewalld
systemctl diable firewalld
setenforce 0

# DB์„ค์น˜
yum -y install mariadb mariadb-server
yum -y --skip-broken install php php-*

systemctl restart mariadb
systemctl enable mariadb

# mariadb database ์˜ค๋ฅ˜
mysql
GRANT ALL PRIVILEGES ON wpDB.* TO wpUser@'%' IDENTIFIED BY '1234';
# wpDB์— ์ ‘๊ทผํ•ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๋ชจ๋“  ๋ช…๋ น์–ด์˜ ๊ถŒํ•œ์„ 
# ์–ด๋””์„œ ์ ‘์†ํ•˜๋“  wpUser์—๊ฒŒ ์‚ฌ์šฉ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•จ
GRANT ALL PRIVILEGES ON wpDB.* TO wpUser@localhost IDENTIFIED BY '1234';
# wpDB์— ์ ‘๊ทผํ•ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๋ชจ๋“  ๋ช…๋ น์–ด์˜ ๊ถŒํ•œ์„ 
# ๋กœ์ปฌ์—์„œ ์ ‘์†ํ• ๋•Œ wpUser์—๊ฒŒ ์‚ฌ์šฉ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•จ
EXIT

mysql -u wpUser -p1234
CREATE DATABASE wpDB; #wpDB๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค ์ƒ์„ฑ ๊ฐ€๋Šฅ

# mariadb database ์™ธ๋ถ€ ์ ‘์† ํ—ˆ์šฉ
mysql -u root -p

use mysql; #database๋ฅผ mysql๋กœ ๋ณ€๊ฒฝ
select host,user from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '1234';
# *.*์€ ๋ชจ๋“  DB์ ‘๊ทผ, '%' ๋ชจ๋“  IP์— ๋Œ€ํ•ด ํ—ˆ์šฉ
flush privileges; # grant all ๋ช…๋ น์–ด ์ ์šฉ

# ๋ฐฉํ™”๋ฒฝ ์„ค์ •
systemctl restart firewalld
firewall-cmd --zone=public --permanent --add-port=3306/tcp
# CentOS์—์„œ ๊ธฐ๋ณธ์ ์œผ๋กœ 3306port๊ฐ€ ๋ฐฉํ™”๋ฒฝ์—์„œ ์ฐจ๋‹จ๋˜์–ด์žˆ๊ธฐ์— ์ฐจ๋‹จ ํ•ด์ œ
firewall-cmd --reload #๋ฐฉํ™”๋ฒฝ ์žฌ๋กœ๋”ฉ
# ์„œ๋ฒ„์™€ ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค ์—ฐ๋™ ํ™•์ธ
mysql -h 192.168.0.42 -u webUser -p1234;
# webUser ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค๋ฅผ ๊ตฌ์ถ•ํ•œ centos second ip์ฃผ์†Œ ์ž…๋ ฅ , 
# ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๊ณ„์ • ๋น„๋ฐ€๋ฒˆํ˜ธ ์ž…๋ ฅ

Welcome to the MariaDB monitor.  Commands end with ; or \\g.
Your MariaDB connection id is 13
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.

# ์ ‘์† ์™„๋ฃŒ ํ™•์ธ

# ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค ํ™•์ธ
SHOW DATABASES;

# webDB ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค ํ™•์ธ
๋ฐ˜์‘ํ˜•

'๐Ÿ’ป Linux' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

CentOS7 pure-ftpd  (0) 2022.04.20
CentOS7 Vsftpd ์„ค์น˜ , Ubuntu Vsftpd ์„ค์น˜  (0) 2022.04.20
CentOS7 DDOS ๊ณต๊ฒฉ ๋ฐ ๋ฐฉ์–ด  (0) 2022.04.20
CentOS7 HTTPS ๋ณด์•ˆ  (0) 2022.04.20
CentOS7 python,tomcat ์›น ๊ตฌ์ถ•  (0) 2022.04.20
Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.