ssh 폴더에 id_rsa, id_rsa.pub 업로드 함
ssh-copy-id -i .ssh/id_rsa root@10.18.0.100
ssh-copy-id -i .ssh/id_rsa bong@10.18.0.101 # 우분투는 다름
# web03 윈도우는 키로 안들가고 원격접속으로 들어갔음
chmod 400 .ssh/id_rsa
yum install -y bash-completion
yum install -y httpd
ss -ant
sudo su -root
sudo su - root
exit
sudo apt update
sudo apt install -y nginx
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
firewall-cmd --list-all
vi /var/www/html/index.html
# :43 가서 web01로 바꿔줌
sudo find / -name index.html
sudo cat /var/www/html/index.nginx-debian.html
wget http://10.18.0.102:8080/Downloads/aws.tar
sudo tar xvf aws.tar -C /var/www/html/index.nginx-debian.html
sudo vi /var/www/html/index.html
# :43 가서 web02로 바꿔줌
yum install -y samba
mkdir -p /var/samba/share
chmod 777 /var/samba/share
adduser kosa
passwd kosa
smbpasswd -a kosa
vi /etc/samba/smb.conf
# [print$] 스크립트 밑에다가 추가
[share]
comment = Share Directory
path = /var/samba/share
browserable = yes
writable = yes
valid users = kosa
create mask = 0777
directory mask = 0777
systemctl enable --now smb nmb
systemctl restart smb nmb
firewall-cmd --permanent --add-service=samba
firewall-cmd --reload
firewall-cmd --list-all
검색 -> \10.18.0.100 접속 -> kosa/kosa
ls /var/samba/share
sudo apt install smbclient -y
smbclient //10.18.0.100/share -U kosa
exit로 나오고
이제 nfs ㄱㄱㄱ
sudo apt update
sudo apt install nfs-common nfs-kernel-server portmap -y
sudo mkdir /share && cd $_
sudo touch test.txt
sudo vi /etc/exports
/share 10.18.0.0/24(rw,sync)
$ sudo chmod 707 /share
systemctl restart nfs-server
exportfs -v
rpm -qa | grep nfs-utils
yum install -y nfs-utils
showmount -e 10.18.0.101
mkdir share
mount -t nfs 10.18.0.101:/share share
df -h
vi /etc/fstab
10.18.0.101:/share /root/share nfs defaults 0 0
https://continuetochallenge.tistory.com/135
-> nfs-client 설치 완료
this pc -> computer -> 네트워크 드라이브
제어판 -> 프로그램 및 기능 -> windows 기능 켜기/끄기
nfs 싹다 선택
ssh-copy-id -i .ssh/id_rsa root@10.18.0.103
ssh -i .ssh/id_rsa root@10.18.0.103
hostnamectl set-hostname ns
yum install -y bash-completion
yum -y install bind bind-chroot bind-utils
vi /etc/named.conf
options {
listen-on port 53 { 127.0.0.1; 192.168.0/21; 10.18.0/24; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { localhost; 192.168.0/21; 10.18.0/24; };
forwarders { 8.8.8.8; 8.8.4.4; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view "internal" {
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/var/named/bonghyeon.shop.zones"; # 호스팅 영역 생성
};
vi /var/named/bonghyeon.shop.zones
zone "bonghyeon.shop" IN {
type master;
file "bonghyeon.shop.db";
allow-update { none; };
};
zone "0.18.10.in-addr.arpa" IN {
type master;
file "0.18.10.in-addr.arpa.db";
allow-update { none; };
};
vi /var/named/bonghyeon.shop.db
$TTL 86400
@ IN SOA bonghyeon.shop. root.bonghyeon.shop.(
2022041401 ; Serial
3h ; Refresh
1h ; Retry
1w ; Expire
1h ) ; Minimum
IN NS ns.bonghyeon.shop.
IN MX 10 ns.bonghyeon.shop.
ns IN A 10.18.0.103
web01 IN A 10.18.0.100
web02 IN A 10.18.0.101
web03 IN A 10.18.0.102
vi /var/named/0.18.10.in-addr.arpa.db
$TTL 86400
@ IN SOA bonghyeon.shop. root.bonghyeon.shop.(
2022041401 ; Serial
3h ; Refresh
1h ; Retry
1w ; Expire
1h ) ; Minimum
IN NS ns.bonghyeon.shop.
103 IN PTR ns.bonghyeon.shop.
100 IN PTR web01.bonghyeon.shop.
101 IN PTR web02.bonghyeon.shop.
102 IN PTR web03.bonghyeon.shop
systemctl enable --now named
firewall-cmd --permanent --add-service=dns
firewall-cmd --reload
vi /etc/dhcp/dhcpd.conf
option domain-name-servers 10.18.0.103, 8.8.8.8, 8.8.4.4; # ns ip 맨앞에 추가
systemctl restart dhcpd
vi /etc/sysconfig/network-scripts/ifcfg-ens192
DNS1=10.18.0.103 # 추가해줌
systemctl restart network
systemctl restart NetworkManager
systemctl restart NetworkManager
cat /etc/resolv.conf
-> DNS 확인
sudo systemctl restart networking
cat /etc/resolv.conf
ipconfig /renew
ipconfig /all
yum install -y mariadb-server
systemctl enable --now mariadb
mysql_secure_installation
systemctl restart mariadb
mysql -u root -p
CREATE USER 'kosa'@'%' IDENTIFIED BY 'kosa0220'; # % :로컬뿐만아니라 리모트에서도 db에 접속할수있게
CREATE DATABASE IF NOT EXISTS wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'kosa'@'%';
quit
firewall-cmd --permanent --add-service=mysql
firewall-cmd --reload
yum install -y mysql
mysql -h ns.bonghyeon.shop -u kosa -p
sudo apt update
sudo apt install -y mysql-client
mysql -h ns.bonghyeon.shop -u kosa -p
yum install -y haproxy
vi /etc/haproxy/haproxy.cfg
global
daemon
defaults
mode http
frontend http-in
bind *:80
acl firefox hdr_sub(User-Agent) Firefox
acl chrome hdr_sub(User-Agent) Chrome
default_backend backend_servers
use_backend bk_firefox if firefox
use_backend bk_trident if Chrome
backend backend_servers
balance roundrobin
# cookie SVID insert indirect nocache maxlife 10s
server web01 10.18.0.100:80 cookie w1 check
server web02 10.18.0.101:80 cookie w2 check
server web03 10.18.0.103:80 cookie w3 check
backend bk_firefox
server web01 web01.bonghyeon.shop:80
backend bk_chrome
server web02 web02.bonghyeon.shop:80