1. Oracle VirtualBox 설치 VirtualBox-7.2.4-170995-Win.exe Oracle_VirtualBox_Extension_Pack-7.2.4.vbox-extpack 확장 - 설치 : Oracle_VirtualBox_Extension_Pack-7.2.4.vbox-extpack 2. Oracle VirtualBox 관리자 - 새로만들기 - Virtual machine name and operating system VM Name : ZX1(10.10.0.100) VM Folder : C:\VMs\VBOX ISO Image : C:\VMs\Setup\ubuntu-24.04.4-live-server-amd64.iso (체크안함) Proceed with Unattended Installation : 무인설치건너뛰기 - Specify virtual hardware Base Memory : 4096 MB Number of CPUs : 2 - specify virtual hard disk Create a New Virtual Hard Dsik D:\VMs\VBOX\ZX1(10.10.0.100)\ZX1(10.10.0.100).vdi 25.00GB --완료 - 네트워크 어댑터1 : (체크)네트워크 어댑터 활성화 Attached to : NAT 포트포워딩 apache2 TCP 80 80 apache2_ssl TCP 443 443 어댑터2 : (체크)네트워크 어댑터 활성화 Attached to : 호스트전용어댑터 --시작 --ubuntu 설치 # 1. root 계정 비밀번호 활성화 sudo passwd root # 현재 비밀번호(@서버암호), 새 UNIX 비밀번호(@서버암호) 입력 # 2. root 계정으로 전환 su - # 3. netplan 고정 IP 설정 파일 정돈 (/etc/netplan/01-netcfg.yaml) rm -f /etc/netplan/50-cloud-init.yaml vi /etc/netplan/01-netcfg.yaml network: version: 2 ethernets: enp0s3: dhcp4: yes enp0s8: dhcp4: no addresses: [10.10.0.100/24] :wq netplan apply # 4. OpenSSH 보안 설정 vi /etc/ssh/sshd_config PermitRootLogin yes Ciphers aes128-ctr,aes192-ctr,aes256-ctr KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256 MACs hmac-sha2-256,hmac-sha2-512 :wq systemctl restart ssh # 5. 공유폴더 설정 # 기존 wwwroot 디렉터리 백업 및 정리 # 기존 폴더 백업 mv /storage/wwwroot /storage/wwwroot_backup # 마운트 포인트 새 디렉터리 생성 mkdir -p /storage/wwwroot ls -ld /storage/wwwroot # VirtualBox 게스트 확장(Guest Additions) 설치 sudo apt update sudo apt install -y build-essential dkms linux-headers-$(uname -r) sudo apt install -y virtualbox-guest-utils modinfo vboxsf # VirtualBox 공유 폴더 설정 # VBox콘솔메뉴 : 장치 - 공유폴더 - 머신폴더 하위에 추가 - 폴더선택 폴더경로 : D:\VMs\antigravity_wwwroot 폴더이름 : wwwroot (체크해제) 읽기전용 (체크해제) 자동마운트 --부팅 시 자동 마운트 설정 (/etc/fstab) (체크) Make Machine-permanent (체크해제) Make Global # 수동 마운트 테스트 및 웹 서버 권한 부여 sudo usermod -aG vboxsf $USER sudo usermod -aG vboxsf www-data sudo mount -t vboxsf -o rw,uid=$(id -u www-data),gid=$(id -g www-data),dmode=775,fmode=664 wwwroot /storage/wwwroot # 부팅 시 자동 마운트 설정 (/etc/fstab) vi /etc/fstab wwwroot /storage/wwwroot vboxsf rw,uid=www-data,gid=www-data,dmode=775,fmode=664,_netdev 0 0 :wq umount /storage/wwwroot mount -a (권한)chmod +x /storage/wwwroot/*.sh (실행)bash /storage/wwwroot/server.sh ####################################################### Proxmox 서버 부팅시간 5분 ####################################################### (ipTIME Router)http://192.168.0.1:8083/ui/ Macmini 2011,Macmini 5,2 : USB부팅 Alt Key (EFI Boot) Macmini 2011,Macmini 5,2 (vCPU x4, RAM x10GB, HDD 1TB) 1) END USER LICENSE AGREEMENT (EULA) - [I agree] 2) Proxmox Virtual Environment (PVE) [Option] --Proxmox 별도설치할경우 hdsize : 200 --전체 디스크 용량 중 200GB만 사용 swapsize : 8 --스왑 용량 8GB 고정 maxroot : 30 --루트 패키지 저장 공간 30GB 고정 minfree : (공백) maxvz : 0 --기본 씬 풀인 pve-data를 생성하지 않도록 0으로 설정 Target Harddisk : /dev/sda (931.51Gib, ST1000LM024 HN-M) --디스크 포맷 및 마운트 (Shell 작업) 데이터센터 - 노드 (node1) - Proxmox 쉘(Shell) 실행 --파티션 확장 도구 설치 # apt install -y parted --parted로 # sda의 205GiB부터 끝까지 sda4 파티션 생성 (기존 PVE 200GB 영역 충돌 방지) # parted -a optimal /dev/sda mkpart primary ext4 102401MiB 100% Yes/No? Y Ignore/Cancel? I --파일 시스템 포맷 (ext4) # mkfs.ext4 /dev/sda4 --마운트 포인트 생성 및 자동 마운트 등록 # mkdir -p /storage --부팅 시 자동 마운트 등록 (/etc/fstab) # echo "/dev/sda4 /storage ext4 defaults 0 2" >> /etc/fstab --마운트 즉시 적용 및 확인 # mount -a --마운트 및 여유 용량 정상 인식 확인 # df -h /storage --고정크기 디스크 데이터센터 - 스토리지 - 추가 - 디렉토리 ID : local-storage 디렉토리 : /storage (체크)사용 내용 : 디스크이미지, 백업, ISO이미지 --(Macmini)WOL 설정 지원 여부 확인 # apt update && apt install -y ethtool # ethtool nic0 | grep Wake-on Supports Wake-on: g Wake-on: g # vi /etc/systemd/system/wol.service [Unit] Description=Enable Wake-on-LAN for nic0 After=network.target [Service] Type=oneshot ExecStart=/sbin/ethtool -s nic0 wol g [Install] WantedBy=multi-user.target :wq # systemctl daemon-reload # systemctl enable --now wol.service --(Macmini)SMC 팬 제어 # apt update # apt install -y lm-sensors build-essential git --센서 감지 실행 # sensors-detect --mbpfan 다운로드 및 빌드 설치 # git clone https://github.com/dgraziotin/mbpfan # cd mbpfan # make # make install # modprobe applesmc --서비스 등록 및 자동 시작 설정 # cp mbpfan.conf /etc/mbpfan.conf # vi /etc/mbpfan.conf min_fan_speed = 2000 (기본 최소 RPM) max_fan_speed = 6200 (Mac mini 모델에 따라 다름) low_temp = 55 (55도부터 팬 속도를 천천히 올림) high_temp = 65 (65도 이상이면 팬을 적극적으로 돌림) max_temp = 85 (최대 속도로 팬 가동) # cp mbpfan.service /etc/systemd/system/ # systemctl daemon-reload # systemctl enable mbpfan.service # systemctl start mbpfan.service --부팅 시 항상 모듈이 로드되도록 등록 # echo "applesmc" >> /etc/modules # systemctl restart mbpfan.service # systemctl status mbpfan.service -------------------------------------------------------------------------- Proxmox 서버 부팅시간 5분 ####################################################### --Proxmox 설치(10분소요) Dell R420 (vCPU x32, RAM x64GB, SSD 250GB, HDD 1TB x3) Install Proxmox VE (Graphical) 1) END USER LICENSE AGREEMENT (EULA) - [I agree] 2) Proxmox Virtual Environment (PVE) Filesystem : ext4 Target Harddisk : /dev/sda (232.83Gib) [Next] 3) Location and Time Zone selection Country : South Korea Time zone : Asia/Seoul Keyboard Layout : U.S.English 4) Administration Password and Email Address Password : @서버암호 Confirm : @서버암호 Email : name@compnay 5) Management Network Configuration Management Interface : nic0 - 3x:07:54:05:b3:a9 (tg3) Hostname (FQDN) : node1.local --node(서버물리번호).local IP Address (CIDR) : 192.168.0.5 / 24 Gateway : 192.168.0.1 DNS Server : 8.8.8.8 (체크)Pin network interface names 6) Summary (체크)Automatically reboot after successful installation [Install] (10분소요) ####################################################### --Proxmox 접속 https://192.168.0.5:8006/ root@pam - Language : 한국어 - Korean (체크)사용자이름저장 - 로그인 데이터센터 - 노드 (node1) - Proxmox 쉘(Shell) 실행 --우분투의 모든패키지를 최신버전으로 업그레이드 # apt update && apt upgrade -y # apt install -y vim net-tools parted --Subscription 경고제거 완전 제거 (JavaScript 수정) cp /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js.bak sed -i '/data\.status/{s/\!//;s/active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js systemctl restart pveproxy.service --ISO이미지 업로드 데이터센터 - 노드 (node1) - local-storage(node1) - ISO 이미지 - 업로드 - ubuntu-24.04.4-live-server-amd64.iso starting file import from: /var/tmp/pveupload-215c434cca27452c7492d3a3288cf2ee target node: node1 target file: /var/lib/vz/template/iso/ubuntu-24.04.4-live-server-amd64.iso file size is: 3405469696 command: cp -- /var/tmp/pveupload-215c434cca27452c7492d3a3288cf2ee /var/lib/vz/template/iso/ubuntu-24.04.4-live-server-amd64.iso finished file import successfully TASK OK -------------------------------------------------------------------------- --네크워크추가 (내부네트워크-포트포워딩) 데이터센터 - 노드(node1) - 네크워크 - 생성 - Linux Bridge 이름 : vmbr1 IPv4/CIDR : 10.10.0.1/24 (체크)자동시작 [구성적용] 데이터센터 - 노드 (node1) - Proxmox 쉘(Shell) 실행 --호스트 패킷 포워딩 활성화 # cat /proc/sys/net/ipv4/ip_forward 1이 나오면 이미 활성화된 상태입니다 0이 나온다면 아래 단계를 진행하세요 # vi /etc/sysctl.conf net.ipv4.ip_forward=1 :wq --설정을 즉시 적용 # sysctl -p --마스커레이드(NAT Outbound) 설정 확인 # vi /etc/network/interfaces auto lo iface lo inet loopback iface nic0 inet manual auto vmbr0 iface vmbr0 inet static address 192.168.0.5/24 gateway 192.168.0.1 bridge-ports nic0 bridge-stp off bridge-fd 0 auto vmbr1 iface vmbr1 inet static address 10.10.0.1/24 bridge-ports none bridge-stp off bridge-fd 0 #포트포워딩활성화(NAT) post-up iptables -t nat -A POSTROUTING -s 10.10.0.0/24 -o vmbr0 -j MASQUERADE post-down iptables -t nat -D POSTROUTING -s 10.10.0.0/24 -o vmbr0 -j MASQUERADE #포트포워딩(WEB) post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to-destination 10.10.0.101:80 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to-destination 10.10.0.101:80 #포트포워딩(SSL) post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 443 -j DNAT --to-destination 10.10.0.101:443 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 443 -j DNAT --to-destination 10.10.0.101:443 #포트포워딩(CHAT) post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 9100 -j DNAT --to-destination 10.10.0.101:9100 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 9100 -j DNAT --to-destination 10.10.0.101:9100 #포트포워딩(MYSQL) post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 33210 -j DNAT --to-destination 10.10.0.201:3306 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 33210 -j DNAT --to-destination 10.10.0.201:3306 #포트포워딩(SAMBA) post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 44101 -j DNAT --to-destination 10.10.0.101:445 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 44101 -j DNAT --to-destination 10.10.0.101:445 post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 44210 -j DNAT --to-destination 10.10.0.210:445 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 44210 -j DNAT --to-destination 10.10.0.210:445 #포트포워딩(TELNET) post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 22101 -j DNAT --to-destination 10.10.0.101:22 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 22101 -j DNAT --to-destination 10.10.0.101:22 post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 22201 -j DNAT --to-destination 10.10.0.201:22 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 22201 -j DNAT --to-destination 10.10.0.201:22 post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 22210 -j DNAT --to-destination 10.10.0.210:22 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 22210 -j DNAT --to-destination 10.10.0.210:22 post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 22254 -j DNAT --to-destination 10.10.0.254:22 post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 22254 -j DNAT --to-destination 10.10.0.254:22 source /etc/network/interfaces.d/* :wq # ifreload -a --NAT 규칙 확인 # iptables -t nat -L -n -v Forward 규칙 확인 # iptables -L FORWARD -n -v --IP Forward 확인 # cat /proc/sys/net/ipv4/ip_forward -------------------------------------------------------------------------- --생성 : 가상머신 (체크)고급 1) 일반탭-이름 : ZX1 (체크)부팅시 시작 2) OS탭-(체크)CD/DVD디스크이미지파일(ISO)사용 ISO이미지 : ubuntu-24.04.4-live-server-amd64.iso 3) 시스템 : VirtIO SCSI single 4) 디스크탭-스토리지 : local-storage 디스크크기 : 48GB 포맷 : Raw 디스크이미지(raw) --고정크기 포맷 : QEMU 이미지유형(qcow2) --동적크기 5) CPU탭-소켓 : 1, 코어 : 1 --웹(4),DB(8) 6) 메모리탭-메모리(MiB) : 2048 7) 네트워크탭-브릿지: vmbr1 --내부네트워크 네트워크탭-브릿지: vmbr0 --외부네트워크 (체크해제)Firewall (체크)생성후 시작 (복원)가상머신 데이터센터 - 노드(node1) - local-storage(node1) - 백업 - 복원 스토리지 : local-storage VM : 101(VM번호) 대역폭 제한 : 기본값 0(제한없음) 대역폭 제한 : 야간,빠른복원일경우 0 (제한없음) 대역폭 제한 : 업무시간일경우 30-50 (MiB/s) 가용성확보 ####################################################### --우분투설치(Ubuntu24.04 + php8.3) --STEP1 : Ubuntu24.04 운영체제설치(10분소요) --STEP1-1 : Ubuntu24.04 운영체제설치 *Try or Install Ubuntu Server 1) Welcome:Use Up,Down and ENTER keys to select your language. : [English](엔터) 2) Intaller update available : [Continue without updating](엔터) 3) Keyboard configuration Layout: [English] Variant: [English] : [Done](엔터) Choose the type of installation **[X] Ubuntu Server 4) Network connections : [Done](엔터) 5) Configure proxy Proxy address: (공백) : [Done](엔터) Configure ubuntu archive mirror Mirror address : http://kr.archive.unbutu.com/ubuntu [Done](엔터) 6) Guided storage configuration (X)Use an entire disk [X]Set up this disk as an LVM group : [Done](엔터) 7) Storage configuration FILE SYSTEM SUMMARY : [Done](엔터) **7) Confirm destructive action : [Continue](엔터) **8) Profile configuration Your name : ubuntu Your server's name : ubuntu Pick a ubsername : ubuntu Choose a password : @서버암호 Confirm your a password : @서버암호 [Done](엔터) 9) SSH Setup : [Done](엔터) 10) Featured Server Snaps : [Done](엔터) [Reboot Now] Rebooting... (10분소요) --OS버전확인 login : ubuntu password : @서버암호 $ lsb_release -a :버전확인 --root암호설정 $ sudo passwd root passwd for ubuntu:[현재로그인계정암호] Enter new UNIX password:[root계정암호] Retry new UNIX password:[root계정암호] $ exit --root로그인 # ifconfig # ip link show # ls /sys/class/net ens18 lo # rm -f /etc/netplan/50-cloud-init.yaml # vi /etc/netplan/01-netcfg.yaml network: version: 2 ethernets: ens18: dhcp4: no addresses: [10.10.0.101/24] routes: - to: default via: 10.10.0.1 nameservers: addresses: [8.8.8.8, 168.126.63.1] :wq # netplan apply --우분투의 모든패키지를 최신버전으로 업그레이드 # apt update && apt upgrade -y --시간설정 # apt install timedatectl # timedatectl set-timezone Asia/Seoul # timedatectl --STEP1-2 : 네트워크설정 --네트워크도구설치 # apt install -y vim net-tools --STEP1-3 : telnet설정 --텔넷서버 설치 # apt install -y xinetd telnetd vsftpd openssh-server --텔넷서버 환경설정 추가 # vi /etc/xinetd.conf defaults{...} (추가:13) service telnet { disable = no flags = REUSE socket_type = stream wait = no user = root server = /usr/sbin/in.telnetd log_on_failure = USERID } :wq --텔넷서버 재시작 # systemctl restart xinetd --OpenSSH설정 --SSH 환경설정수정:root접속 # vi /etc/ssh/sshd_config # PermitRootLogin prohibit-password (추가:43) PermitRootLogin yes Ciphers aes128-ctr,aes192-ctr,aes256-ctr KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256 MACs hmac-sha2-256,hmac-sha2-512 :wq # systemctl restart ssh # systemctl status ssh Active: active (running) # ss -nlt LISTEN 0 128 0.0.0.0:22 0.0.0.0:* --방화벽 포트추가 (활성화)# ufw enable # ufw status Status: active # ufw allow ssh [SSH] MobaXterm 접속 --Proxmox 호스트가 10.10.0.254라는 가상머신 SSH접속 # ssh root@10.10.0.254 -------------------------------------------------------------------------- --STEP1-4 : vsftp설정 --vsftp환경설정수정 # vi /etc/vsftpd.conf anonymous_enable=NO local_enable=YES (수정:31-주석제거)write_enable=YES (수정:114-주석제거)chroot_local_user=YES (추가:115) allow_writeable_chroot=YES pasv_enable=YES pasv_min_port=40000 pasv_max_port=40100 :wq # systemctl restart vsftpd --FTP 환경설정수정:root접속 # vi /etc/ftpusers (수정:3)#root :wq ####################################################### --STEP2 : APACHE2+PHP 설치 --STEP2-1 : APACHE2+PHP 설치 # apt update && apt upgrade -y # apt install -y software-properties-common # add-apt-repository ppa:ondrej/php -y # ls /etc/apt/sources.list.d/ ondrej-ubuntu-php-noble.sources ubuntu.sources ubuntu.sources.curtin.orig # apt install -y apache2 php8.3 libapache2-mod-php8.3 php8.3-cli php8.3-common php8.3-fpm php8.3-mysql php8.3-gd php8.3-curl php8.3-mbstring php8.3-xml php8.3-zip php8.3-bcmath php8.3-intl php8.3-imap php8.3-imagick php-pear php8.3-dev --php버전확인 # php -v PHP 8.3.31 (cli) (built: May 7 2026 18:51:56) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.31, Copyright (c) Zend Technologies with Zend OPcache v8.3.31, Copyright (c), by Zend Technologies --STEP2-2 : PHP설정 # vi /etc/apache2/mods-available/php8.3.conf (추가:6) SetHandler application/x-httpd-php :wq --PHP디버깅 # vi /etc/php/8.3/apache2/php.ini (수정:208)short_open_tag = On #PHP 시작 태그를 표준 형태인 > ~/.bashrc echo 'export PATH=/var/www/.npm-global/bin:$PATH' >> ~/.profile --설치 경로 확인 www-data@ubuntu:~$ which pm2 /var/www/.npm-global/bin/pm2 www-data@ubuntu:~$ exit --관리자계정에서 PM2 list 보기 # vi ~/.bashrc (추가:100) alias pm2-www='sudo -u www-data -i pm2' :wq # source ~/.bashrc # pm2-www list --STEP2-5 : MySQL 설치 # apt update && apt upgrade -y # apt install -y mysql-server mysql-client php-mysql # mysql -V mysql Ver 8.0.45-0ubuntu0.24.04.1 for Linux on x86_64 ((Ubuntu)) --MySQL 접속 권한 및 계정 설정(@서버암호) # mysql -uroot -p@서버암호 -- 유저 정보 확인 mysql> SELECT HOST, USER, PLUGIN FROM mysql.user; -- 모든 IP(%)에서 접속 가능한 root 계정 생성 및 권한 부여 mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'root'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; -- 로컬 접속 플러그인 및 비밀번호 업데이트 mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '@서버암호'; -- root 계정을 모든 호스트(%)에서 접속 가능 mysql> ALTER USER 'root'@'%' IDENTIFIED BY '@서버암호'; -- 설정 반영 및 종료 mysql> FLUSH PRIVILEGES; mysql> EXIT; --MySQL 서비스 중지 # systemctl stop mysql --STEP2-6 : NFS, SAMBA 설치 # apt update && apt upgrade -y # apt install -y nfs-kernel-server nfs-common samba (백업)ZX1_apache2_php_nodejs_pm2_mysql_nfs_samba --백업 : 가상머신 데이터센터 - 노드(node1) - 100(ZX1) - 백업 스토리지 : local-storage 압축 : ZSTD(빠르고좋음) 모드 : 스냅샷 통지 : 글로벌 설정 사용 (복원)가상머신 데이터센터 - 노드(node1) - local-storage(node1) - 백업 - 복원 스토리지 : local-storage VM : 101(VM번호) 대역폭 제한 : 기본값 0(제한없음) 대역폭 제한 : 야간,빠른복원일경우 0 (제한없음) 대역폭 제한 : 업무시간일경우 30-50 (MiB/s) 가용성확보 (복원)백업파일경로 /storage/dump/vzdump-qemu-100-2026_07_05-16_47_53.vma.zst (백업 본체) vzdump-qemu-100-2026_07_05-16_47_53.log (작업 로그) vzdump-qemu-100-2026_07_05-16_47_53.vma.zst.notes (백업 메모) [SSH] MobaXterm 접속 # ssh root@10.10.0.254 --apache2_before ####################################################### --STEP3 : APACHE + PHP 환경설정 --STEP3-1 : APACHE2환경설정 # vi /etc/apache2/apache2.conf (수정:170-주석처리) # # Options Indexes FollowSymLinks # AllowOverride None # Require all granted # (추가:175) Options FollowSymLinks AllowOverride None Require all granted :wq --STEP3-2 : Apache logrotate 로그설정 # cp /etc/logrotate.d/apache2 /etc/logrotate.d/apache2.old # vi /etc/logrotate.d/apache2 (전체삭제)/var/log/apache2/*.log {..} /storage/logs/apache2/*.log { daily rotate 14 size 100M compress delaycompress missingok notifempty create 640 root adm sharedscripts postrotate systemctl reload apache2 > /dev/null endscript } :wq # vi /etc/apache2/sites-available/000-default.conf (수정:12) DocumentRoot /storage/wwwroot (추가:14)오류페이지처리 ErrorDocument 400 /core/error.html ErrorDocument 401 /core/error.html ErrorDocument 403 /core/error.html ErrorDocument 404 /core/error.html ErrorDocument 500 /core/error.html ErrorDocument 502 /core/error.html ErrorDocument 503 /core/error.html (수정:27) #ErrorLog ${APACHE_LOG_DIR}/error.log #CustomLog ${APACHE_LOG_DIR}/access.log combined ErrorLog /storage/logs/apache2/localhost-80-error.log CustomLog /storage/logs/apache2/localhost-80-access.log combined :wq mkdir -p /storage/wwwroot mkdir -p /storage/logs/apache2 chown -R www-data:www-data /storage/logs/apache2 chmod 750 /storage/logs/apache2 apache2ctl configtest a2enmod rewrite a2ensite 000-default.conf systemctl restart apache2 --HTTPS 포트(80)가 열려 있는지 확인하고 허용합니다. ufw delete allow 'Apache' ufw allow 'Apache Full' ufw allow 9100/tcp ufw status Status: active To Action From -- ------ ---- 22/tcp ALLOW Anywhere Apache Full ALLOW Anywhere 9100/tcp ALLOW Anywhere 22/tcp (v6) ALLOW Anywhere (v6) Apache Full (v6) ALLOW Anywhere (v6) 9100/tcp (v6) ALLOW Anywhere (v6) --접속경로(/storage/wwwroot) # vi /storage/wwwroot/phpinfo.html (접속)http://192.168.0.5/phpinfo.html ####################################################### ####################################################### --STEP3-3 : APACHE2 SSL서버인증서 설치 --Certbot 설치 --Let's Encrypt 인증서를 자동으로 발급하고 관리해주는 Certbot 패키지를 설치합니다. # apt update && apt upgrade -y # apt install certbot python3-certbot-apache -y --인증서가 Certbot에 등록상태 확인 # certbot certificates --웹루트경로 확인1 # grep -R "DocumentRoot" /etc/apache2/ --웹루트경로 확인2 # vi /etc/apache2/sites-available/000-default.conf DocumentRoot /storage/wwwroot --인증서만 재발급 - 인증서가 Certbot에 등록되어 있음 # certbot certonly --webroot -w /storage/wwwroot -d waitbook.co.kr -d www.waitbook.co.kr --email dkjang@naver.com --agree-tos # certbot certonly --webroot -w /storage/wwwroot -d cube2005.co.kr -d www.cube2005.co.kr --email dkjang@naver.com --agree-tos --별도의 독립된 인증서 발급 # certbot certonly --webroot -w /storage/wwwroot -d dev.cube2005.co.kr --email dkjang@naver.com --agree-tos What would you like to do? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: Keep the existing certificate for now 2: Renew & replace the certificate (may be subject to CA rate limits) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2 Renewing an existing certificate for cube2005.co.kr and www.cube2005.co.kr --인증서만 발급 - 인증서가 Certbot에 등록되어 있지않음 # certbot certonly --webroot -w /storage/wwwroot -d cube2005.co.kr -d www.cube2005.co.kr Saving debug log to /var/log/letsencrypt/letsencrypt.log Enter email address (used for urgent renewal and security notices) --1: 이메일 입력 (Enter 'c' to cancel): dkjang@naver.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.6-August-18-2025.pdf. You must agree in order to register with the ACME server. Do you agree? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --2: 서비스 약관 동의 (Y)es/(N)o: y - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing, once your first certificate is successfully issued, to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --3: EFF 뉴스레터 구독 여부 (Y)es/(N)o: n Account registered. Requesting a certificate for cube2005.co.kr and www.cube2005.co.kr Unable to change owner and uid of webroot directory Unable to change owner and uid of webroot directory --4: 도메인 소유권 확인 및 인증서 발급 도메인 선택: 목록에서 방금 설정한 도메인 번호 선택 (엔터) Which names would you like to activate HTTPS for? 1: cube2005.co.kr blank to select all options shown (Enter 'c' to cancel): 1 --5: HTTP 리다이렉트 설정 (HTTPS 전환) Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2 --Congratulations! You have successfully enabled https://cube2005.co.kr --인증서가 /etc/letsencrypt/live/cube2005.co.kr/ 경로에 저장되었다는 안내가 나옵니다. Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/cube2005.co.kr/fullchain.pem Key is saved at: /etc/letsencrypt/live/cube2005.co.kr/privkey.pem This certificate expires on 2026-08-07. These files will be updated when the certificate renews. Certbot has set up a scheduled task to automatically renew this certificate in the background. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If you like Certbot, please consider supporting our work by: * Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate * Donating to EFF: https://eff.org/donate-le - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - root@ubuntu:~# --(해결)Some challenges have failed. 윈도우방화벽(고급보안이포함된WindowsDefender방화벽)-인바운드규칙 : 80 AX1-설정-네트워크-포트포워딩 : apache2(80) ufw allow 'Apache Full' # ls /etc/letsencrypt/live/ --Let's Encrypt 인증서는 90일간 유효합니다. Certbot은 자동으로 갱신 타이머를 등록합니다. # certbot renew --dry-run --post-hook "systemctl reload apache2" Saving debug log to /var/log/letsencrypt/letsencrypt.log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Processing /etc/letsencrypt/renewal/cube2005.co.kr.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Account registered. Simulating renewal of an existing certificate for cube2005.co.kr and www.cube2005.co.kr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations, all simulated renewals succeeded: /etc/letsencrypt/live/cube2005.co.kr/fullchain.pem (success) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # vi /etc/apache2/sites-available/default-ssl.conf (주석:4) #DocumentRoot /var/www/html (추가:5) ServerName cube2005.co.kr ServerAlias www.cube2005.co.kr DocumentRoot /storage/wwwroot ErrorDocument 400 /core/error.html ErrorDocument 401 /core/error.html ErrorDocument 403 /core/error.html ErrorDocument 404 /core/error.html ErrorDocument 500 /core/error.html ErrorDocument 502 /core/error.html ErrorDocument 503 /core/error.html (추가:22) #ErrorLog ${APACHE_LOG_DIR}/error.log #CustomLog ${APACHE_LOG_DIR}/access.log combined ErrorLog /storage/logs/apache2/cube2005.co.kr-error.log CustomLog /storage/logs/apache2/cube2005.co.kr-access.log combined (추가:44) #SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem #SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key SSLCertificateFile /etc/letsencrypt/live/cube2005.co.kr/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/cube2005.co.kr/privkey.pem :wq --mod_ssl 모듈활성화 a2enmod ssl a2ensite default-ssl.conf apache2ctl configtest systemctl restart apache2 (안함)# ufw allow 80,443,9100/tcp --기존 인증서에 도메인 추가 (확장) --기존에 발급받은 도메인들을 모두 포함하고 새로운 도메인을 추가하여 명령어를 실행합니다. # certbot --apache --expand -d cube2005.co.kr -d www.cube2005.co.kr -d new-domain.com --특정 인증서 이름으로 도메인 리스트 교체 --인증서의 이름을 확인한 후 해당 인증서에 연결된 도메인들을 완전히 새로 고침합니다. # certbot certificates --해당 이름을 지정하여 도메인 리스트 업데이트 # certbot --apache --cert-name cube2005.co.kr -d new-domain.com -d www.new-domain.com --도메인을 변경한 후에는 Apache 가상 호스트 설정 파일의 ServerName과 ServerAlias도 새 도메인에 맞게 수정되었는지 확인해야 합니다. -------------------------------------------------------------------------- --STEP3-4 : composer 설치 # apt install -y composer Composer 2.7.1 # mkdir -p /storage/wwwroot/libs/composer # cd /storage/wwwroot/libs/composer --설치 스크립트 다운로드 # php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" --Composer 2 설치 # php composer-setup.php Composer (version 2.9.7) successfully # composer --version Continue as root/super user [yes]? yes Composer version 2.9.7 2026-02-09 15:26:28 PHP version 8.3.31 (/usr/bin/php8.3) Run the "diagnose" command to get more detailed diagnostics output. --mPDF 라이브러리 설치 # cd /storage/wwwroot/libs/composer # composer require mpdf/mpdf Continue as root/super user [yes]? yes # chown -R www-data:www-data ./vendor/ --Excel 라이브러리 설치 # cd /storage/wwwroot/libs/composer # composer require phpoffice/phpspreadsheet Continue as root/super user [yes]? yes -------------------------------------------------------------------------- --STEP3-5 : Node.js WSS 서버 연동 --WSS(Secure WebSocket) 적용 절차 --SSL 인증서 준비 --chat_server_wss_cube2005.sh 스크립트로 생성된 파일이 이 파일과 같은 경로에 있어야 합니다. mkdir -p /storage/wwwroot/chat cd /storage/wwwroot/chat npm install ws cp -L /etc/letsencrypt/live/cube2005.co.kr/privkey.pem /storage/wwwroot/chat/cube2005.co.kr_privkey.pem cp -L /etc/letsencrypt/live/cube2005.co.kr/fullchain.pem /storage/wwwroot/chat/cube2005.co.kr_fullchain.pem chown www-data:www-data /storage/wwwroot/chat/cube2005.co.kr_privkey.pem chown www-data:www-data /storage/wwwroot/chat/cube2005.co.kr_fullchain.pem chmod 600 /storage/wwwroot/chat/cube2005.co.kr_privkey.pem chmod 644 /storage/wwwroot/chat/cube2005.co.kr_fullchain.pem sudo -u www-data -i pm2 restart chat_server_wss_cube2005 pm2-www list ls -l /etc/letsencrypt/live/cube2005.co.kr/ ls -l /storage/wwwroot/chat/ root@ubuntu:~# ls -l /etc/letsencrypt/live/cube2005.co.kr/ total 4 lrwxrwxrwx 1 root root 38 Apr 12 09:45 cert.pem -> ../../archive/cube2005.co.kr/cert2.pem lrwxrwxrwx 1 root root 39 Apr 12 09:45 chain.pem -> ../../archive/cube2005.co.kr/chain2.pem lrwxrwxrwx 1 root root 43 Apr 12 09:45 fullchain.pem -> ../../archive/cube2005.co.kr/fullchain2.pem lrwxrwxrwx 1 root root 41 Apr 12 09:45 privkey.pem -> ../../archive/cube2005.co.kr/privkey2.pem -rw-r--r-- 1 root root 692 Feb 10 14:40 README root@ubuntu:~# ls -l /storage/wwwroot/chat/ total 32 -rwxr--r-- 1 root root 8531 Apr 11 21:24 chat_server_wss_cube2005.js -rw-r--r-- 1 www-data www-data 3610 May 11 15:39 cube2005.co.kr_fullchain.pem -rw------- 1 www-data www-data 1704 May 11 15:39 cube2005.co.kr_privkey.pem drwxr-xr-x 3 root root 4096 Feb 10 14:51 node_modules -rw-r--r-- 1 root root 48 Feb 10 14:51 package.json -rw-r--r-- 1 root root 753 Feb 10 14:57 package-lock.json root@ubuntu:~# -------------------------------------------------------------------------- --STEP3-6 : 채팅서버 - MX1_Apache_MySQL(192.168.56.200) # /storage/wwwroot/master/chat_server_wss_keycopy.sh 도메인을 입력하세요 (기본: cube2005.co.kr): (엔터) 대상 경로를 입력하세요 (기본: /storage/wwwroot/chat): (엔터) --www-data 사용자로 전환 # sudo -u www-data -i --설치 경로 확인 www-data@ubuntu:~$ which pm2 /var/www/.npm-global/bin/pm2 www-data@ubuntu:~$ cd /storage/wwwroot/chat/ pm2 start chat_server_wss_cube2005.js --name chat_server_wss_cube2005 pm2 save --force pm2 startup exit # pm2-www list # pm2-www restart chat_server_wss_cube2005 --서비스삭제(강제갱신) # pm2-www delete all # pm2-www save --force --PM 명령어 # pm2 start npm --name "" -- start # pm2 start # pm2 list # pm2 save # pm2 resurrect # pm2 startup # pm2 delete all # pm2 kill # pm2 start # pm2 stop # pm2 restart # pm2 restart 5 -n rename # pm2 delete --PM2 삭제 # pm2 stop all # pm2 delete all # pm2 save --force # npm uninstall -g pm2 # which pm2 # rm -rf /root/.pm2 --AX1_pm2_chatserver -------------------------------------------------------------------------- --STEP4 : MySQL설정 --STEP4-1 : MySQL 설치(STEP2-5 : MySQL 설치) # apt update && apt upgrade -y # apt install -y mysql-server mysql-client php-mysql # mysql -V mysql Ver 8.0.45-0ubuntu0.24.04.1 for Linux on x86_64 ((Ubuntu)) --MySQL 접속 권한 및 계정 설정(@서버암호) # mysql -uroot -p@서버암호 -- 유저 정보 확인 mysql> SELECT HOST, USER, PLUGIN FROM mysql.user; -- 모든 IP(%)에서 접속 가능한 root 계정 생성 및 권한 부여 mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'root'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; -- 로컬 접속 플러그인 및 비밀번호 업데이트 mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '@서버암호'; -- root 계정을 모든 호스트(%)에서 접속 가능 mysql> ALTER USER 'root'@'%' IDENTIFIED BY '@서버암호'; -- 설정 반영 및 종료 mysql> FLUSH PRIVILEGES; mysql> EXIT; ####################################################### --STEP4-2 : 데이터 저장경로 (/var/lib/mysql -> /storage/mysql/data) --STEP4-3 : 로그파일 저장경로 (/var/log/mysql -> /storage/mysql/logs) -- 서비스 중지 # systemctl stop mysql # systemctl status mysql --디렉토리 생성 mkdir -p /storage/mysql/data/ mkdir -p /storage/mysql/logs/ chown -R mysql:mysql /storage/mysql/data chown -R mysql:mysql /storage/mysql/logs chmod 750 /storage/mysql/data chmod 750 /storage/mysql/logs rsync -av /var/lib/mysql/ /storage/mysql/data/ -- MySQL 설정 업데이트 ---DX1일경우--- # vi /etc/mysql/mysql.conf.d/mysqld.cnf [mysqld] (추가:15) datadir = /storage/mysql/data bind-address = 0.0.0.0 character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci init-connect = 'SET NAMES utf8mb4' innodb_file_per_table = 1 log_error = /storage/mysql/logs/mysql.log slow_query_log = 1 slow_query_log_file = /storage/mysql/logs/mysql-slow.log # InnoDB 메모리 (RAM 4GB 3/4, 1/2) innodb_buffer_pool_size = 12G innodb_buffer_pool_instances = 8 # InnoDB 로그 (버퍼 풀 사이즈 1/8) innodb_log_file_size = 2G innodb_log_buffer_size = 128M # InnoDB I/O (CPU 8Core 기준) innodb_read_io_threads = 8 innodb_write_io_threads = 8 innodb_flush_log_at_trx_commit = 1 innodb_flush_method = O_DIRECT # 임시 테이블 tmp_table_size = 512M max_heap_table_size = 512M # 정렬 / 조인 버퍼 join_buffer_size = 4M sort_buffer_size = 4M # 연결 thread_cache_size = 32 max_connections = 300 (주석:62) #bind-address = 127.0.0.1 #mysqlx-bind-address = 127.0.0.1 (주석:93) #log_error = /var/log/mysql/error.log ---DX2일경우--- # vi /etc/mysql/mysql.conf.d/mysqld.cnf [mysqld] (추가:15) datadir = /storage/mysql/data bind-address = 0.0.0.0 character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci init-connect = 'SET NAMES utf8mb4' innodb_file_per_table = 1 log_error = /storage/mysql/logs/mysql.log slow_query_log = 1 slow_query_log_file = /storage/mysql/logs/mysql-slow.log # InnoDB 메모리 (RAM 4GB 기준 약 50% 할당) innodb_buffer_pool_size = 2G innodb_buffer_pool_instances = 2 # InnoDB 로그 (버퍼 풀 사이즈에 비례하여 축소) innodb_log_file_size = 512M innodb_log_buffer_size = 32M # InnoDB I/O (CPU 4Core 기준) innodb_read_io_threads = 4 innodb_write_io_threads = 4 innodb_flush_log_at_trx_commit = 1 innodb_flush_method = O_DIRECT # 임시 테이블 (메모리 부족 방지를 위해 축소) tmp_table_size = 128M max_heap_table_size = 128M # 정렬 / 조인 버퍼 join_buffer_size = 2M sort_buffer_size = 2M # 연결 (싱크 서버 목적에 맞춰 축소) thread_cache_size = 16 max_connections = 150 (주석:62) #bind-address = 127.0.0.1 #mysqlx-bind-address = 127.0.0.1 (주석:93) #log_error = /var/log/mysql/error.log :wq --로그 파일 생성 touch /storage/mysql/logs/mysql.log touch /storage/mysql/logs/mysql-slow.log chown mysql:mysql /storage/mysql/logs/mysql.log chown mysql:mysql /storage/mysql/logs/mysql-slow.log chmod 640 /storage/mysql/logs/mysql.log chmod 640 /storage/mysql/logs/mysql-slow.log --Mysql logrotate 로그설정 # cp /etc/logrotate.d/mysql-server /etc/logrotate.d/mysql-server.old # vi /etc/logrotate.d/mysql-server (전체삭제) /storage/mysql/logs/mysql.log /storage/mysql/logs/mysql-slow.log { daily rotate 7 size 50M missingok notifempty create 640 mysql adm compress sharedscripts postrotate test -x /usr/bin/mysqladmin || exit 0 mysqladmin --defaults-file=/etc/mysql/debian.cnf flush-logs endscript } :wq --로그용량관리 # df -h /storage /dev/sdb1 118G 107G 5.5G 96% /storage/mysql # du -sh /storage/mysql 107G /storage/mysql -- MySQL에 root 계정으로 접속 후 실행합니다. # mysql -uroot -p@서버암호 -- 특정 날짜(예: 2026년 7월 1일) 이전의 모든 바이너리 로그를 안전하게 삭제합니다. mysql> PURGE BINARY LOGS BEFORE '2026-07-01 00:00:00'; mysql> PURGE BINARY LOGS TO 'binlog.00xxxx'; mysql> FLUSH PRIVILEGES; mysql> EXIT; --MySQL 서비스 재시작 # systemctl restart mysql --STEP4-4 : AppArmor 보안 설정 (필수) # vi /etc/apparmor.d/usr.sbin.mysqld (수정:60) # Allow data dir access # /var/lib/mysql/ r, # /var/lib/mysql/** rwk, /storage/mysql/data/ r, /storage/mysql/data/** rwk, (수정:73) # Allow log file access # /var/log/mysql.err rw, # /var/log/mysql.log rw, # /var/log/mysql/ r, # /var/log/mysql/** rw, /storage/mysql/logs/mysql.log rw, /storage/mysql/logs/mysql-slow.log rw, /storage/mysql/logs/ r, /storage/mysql/logs/** rwk, :wq -- Alias 설정 (권장) # vi /etc/apparmor.d/tunables/alias (추가:17) alias /var/lib/mysql/ -> /storage/mysql/data//, :wq # systemctl reload apparmor # systemctl restart mysql --외부 접속허용 # ufw allow 3306/tcp (안함)특정 IP만 허용하는 경우 : # ufw allow from 183.111.185.242 to any port 3306 -- 데이터 경로 확인 # mysql -uroot -p@서버암호 -e"SELECT @@datadir" mysql: [Warning] Using a password on the command line interface can be insecure. +-----------------+ | @@datadir | +-----------------+ | /storage/mysql/data/| +-----------------+ -- 로그 경로 확인 # mysql -u root -p@서버암호 -e "SHOW VARIABLES LIKE '%log_error%';" mysql: [Warning] Using a password on the command line interface can be insecure. +----------------------------+----------------------------------------+ | Variable_name | Value | +----------------------------+----------------------------------------+ | binlog_error_action | ABORT_SERVER | | log_error | /storage/mysql/logs/mysql.log | | log_error_services | log_filter_internal; log_sink_internal | | log_error_suppression_list | | | log_error_verbosity | 2 | +----------------------------+----------------------------------------+ -------------------------------------------------------------------------- --데이터베이스최적화 --DB전체최적화 # mysqlcheck -uroot -p@서버암호 -o --all-databases ---DB지정최적화 # mysqlcheck -uroot -p@서버암호 -o {DATABASE_NAME} ---TABLE최적화 mysql> OPTIMIZE TABLE {DATABASE_NAME}.{TABLE_NAME}; --데이터베이스복원 # mysql -uroot -p@서버암호 mysql> CREATE DATABASE {DATABASE_NAME} DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; # mysql -uroot -p@서버암호 {DATABASE_NAME} < /storage/mysql_backup/20260205/{DATABASE_NAME}.sql # mysql -uroot -p@서버암호 mysql> CREATE DATABASE YELLOW DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; # mysql -uroot -p@서버암호 YELLOW < /storage/mysql_backup/20260205/YELLOW.sql --데이터베이스백업 # mysqldump -uroot -p@서버암호 {DATABASE_NAME} > /storage/mysql_backup/20260205/{DATABASE_NAME}.sql # mysqldump -uroot -p@서버암호 YELLOW > /storage/mysql_backup/20260205/YELLOW.sql --데이터베이스자동백업:파일생성 # vi /storage/mysql_backup/mysql_backup.sh #!/bin/bash DATE=$(date +%Y%m%d) BACKUP_DIR=/storage/mysql_backup/$DATE/ mysqldump -uroot -p@서버암호 --databases {DATABASE_NAME} > $BACKUP_DIR"{DATABASE_NAME}".sql :wq #3일지난 백업은 삭제한다 #-ctime n 옵션은 파일의 퍼미션을 마지막으로 변경시킨 날짜를 기준으로 파일을 찾아낸다. #+n : n일 또는 n일 이전에 퍼미션이 변경된 파일 #-n : 오늘 부터 n일 전 사이에 퍼미션이 변경된 파일 #n : 정확히 n일 전에 퍼미션이 변경된 파일 find $BACKUP_DIR"*.sql -ctime +3 -exec rm -f {} \; # chmod 755 mysql_backup.sh # ./mysql_backup.sh # bash mysql_backup.sh --데이터베이스자동백업:스케줄등록 # crontab -e Select an editor. To change later, run 'select-editor'. 1. /bin/ed 2. /bin/nano 3. /usr/bin/vim.basic <---- vi 4. /usr/bin/vim.tiny Choose 1-4 [2]: 4 --vi (추가)0 1 * * * /storage/wwwroot/master/data_tools_master.sh # date # systemctl restart cron # crontab -r //삭제 # 분(0-59) 시(0-23) 일(1-31) 월(1-12) 요일(0-6:0일요일-6토요일) 수행명령어 --0,10,20,30,40,50분 실행 0,10,20,30,40,50 * * * * bash /storage/wwwroot/master/data_tools_master.sh --1-10일 실행 0 0 1-10 * * bash /storage/wwwroot/master/data_tools_master.sh --MySQL 재설치 --MySQL 삭제 # apt remove --purge mysql* # systemctl status mysql # systemctl restart mysql # 디렉토리 내부 새 파일 자동 권한 설정 sudo apt install acl setfacl -d -m u::rwx /storage/wwwroot/master/ # 파일업데이트후 처리하기 chmod +x /storage/wwwroot/master/*.sh -------------------------------------------------------------------------- --20210109:데이터베이스 경로변경 절대안됨(/storage/mysql/data) --20240327:윈도우공유폴더일경우(오류발생:chown권한) root@ubuntu:~# systemctl restart mysql Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details. root@ubuntu:~# systemctl restart mysql root@ubuntu:/# mysql -uroot -p@서버암호 -e"SELECT @@datadir" mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) root@ubuntu:~# systemctl restart mysql --20260111:부팅 초기에 아직 mount 안 된 상태 Apache 프로세스가 I/O 대기 상태(D 상태) 에 빠짐 INFO: task apache2:1599 blocked for more than 120 seconds Apache DocumentRoot, ErrorLog, CustomLog가 그 경로를 사용 부팅 초기에 아직 mount 안 된 상태 --보안 유지 (히스토리 삭제) cat /dev/null > ~/.bash_history && history -c (백업)ZX1_apache2_php_nodejs_pm2_mysql_nfs_samba --백업 : 가상머신 데이터센터 - 노드(node1) - 100(ZX1) - 백업 스토리지 : local-storage 압축 : ZSTD(빠르고좋음) 모드 : 스냅샷 통지 : 글로벌 설정 사용 ####################################################### --STEP5 : 시스템 복제 --STEP5-1 : 가상머신복제하기(60분) 머신 - 복제 이름: AX1_Apache, DX1_MySQL, DX2_MySQL, DX3_MySQL, MX1_Apache_MySQL 경로: D:\VMs\VBOX (체크)하드웨어 UUID 유지 --완료 AX1_Apache(192.168.56.101) RAM : 6GB, CPU 4개, Storage1(240GB) --네트워크-어댑터1 : NAT-포트포워딩 apache2 TCP (호스트포트)80 (게스트포트)80 #certbot 인증서포트 열려있어야 한다 apache2_ssl TCP (호스트포트)443 (게스트포트)443 DX1_MySQL(192.168.56.201) RAM : 12GB, CPU 6개, Storage1(120GB) DX2_MySQL(192.168.56.202) RAM : 4GB, CPU 4개, Storage1(120GB) DX3_MySQL(192.168.56.203) RAM : 4GB, CPU 1개, Storage1(25GB) MX1_Apache_MySQL(192.168.56.200) RAM : 4GB, CPU 2개, Storage1(120GB) --네트워크-어댑터1 : NAT-포트포워딩 webchat TCP (호스트포트)9100 (게스트포트)9100 -------------------------------------------------------------------------- --STEP5-2 : APACHE2 개발서버 환경설정일경우:20260207 --STEP5-2-1.웹서버설정 # vi /etc/php/8.3/apache2/php.ini (수정:508)display_errors = On #PHP 실행 중 발생하는 에러, 경고, 알림 등을 브라우저 화면출력 :wq # vi /etc/apache2/apache2.conf (수정:175) # vi /etc/apache2/sites-available/000-default.conf (수정:13)DocumentRoot /storage/wwwroot # vi /etc/apache2/sites-available/default-ssl.conf (수정:7)DocumentRoot /storage/wwwroot (수정:26) ErrorLog /storage/logs/apache2/cube2005.co.kr-error.log CustomLog /storage/logs/apache2/cube2005.co.kr-access.log combined (수정:47) SSLCertificateFile /etc/letsencrypt/live/cube2005.co.kr/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/cube2005.co.kr/privkey.pem -- 인증서만 재발급 (Apache DocumentRoot 경로확인) # certbot certonly --webroot -w /storage/wwwroot -d cube2005.co.kr -d www.cube2005.co.kr --채팅서버_인증서복사 - AX1_Apache(192.168.56.101) # /storage/wwwroot/master/chat_server_wss_keycopy.sh 도메인을 입력하세요 (기본: cube2005.co.kr): cube2005.co.kr 대상 경로를 입력하세요 (기본: /storage/wwwroot/chat): /storage/wwwroot/chat --STEP5-2-2.채팅서버설정 --채팅서버_실행 - MX1_Apache_MySQL(192.168.56.200) --www-data 사용자로 전환 # sudo -u www-data -i www-data@ubuntu:~$ which pm2 /var/www/.npm-global/bin/pm2 www-data@ubuntu:~$ cd /storage/wwwroot/chat/ pm2 start chat_server_wss_cube2005.js --name chat_server_wss_cube2005 pm2 save --force pm2 startup exit --부팅 시 자동 실행 스크립트 생성 # sudo env PATH=$PATH:/usr/bin /var/www/.npm-global/lib/node_modules/pm2/bin/pm2 startup systemd -u www-data --hp /var/www # pm2-www list # pm2-www restart chat_server_wss_cube2005 --소유권 변경 : 해당 디렉토리에 대한 쓰기 권한을 가지고 있어야 합니다. # mkdir -p /storage/wwwroot/files # sudo chown -R www-data:www-data /storage/wwwroot # sudo chmod -R 755 /storage/wwwroot # crontab -e Select an editor. To change later, run 'select-editor'. 1. /bin/ed 2. /bin/nano 3. /usr/bin/vim.basic <---- vi 4. /usr/bin/vim.tiny Choose 1-4 [2]: 4 --vi (추가)00 01 * * * sudo -u www-data -i pm2 restart chat_server_wss_cube2005 00 10 * * * sudo -u www-data -i pm2 restart chat_server_wss_cube2005 # systemctl restart cron ####################################################### --STEP6 : NFS 설치 # apt update && apt upgrade -y # apt install -y nfs-kernel-server nfs-common samba --STEP6-1 : NFS 서버 설치 ---NX1 (vmbr1 : 10.10.0.210) # ls /sys/class/net ens18 lo # vi /etc/netplan/01-netcfg.yaml network: version: 2 ethernets: ens18: dhcp4: no addresses: [10.10.0.210/24] :wq # netplan apply --공유할 폴더 생성 # mkdir -p /storage # chmod 777 /storage --exports 설정(핵심) --10.10.0.x 대역 허용, 읽기/쓰기 가능 # vi /etc/exports /storage 10.10.0.0/24(rw,sync,no_subtree_check,no_root_squash) :wq # exportfs -rav # systemctl restart nfs-kernel-server --방화벽 # ufw allow from 10.10.0.0/24 to any port nfs --STEP6-2 : NFS 클라이언트 설치 ---AX1 (vmbr0 : 192.168.0.103, vmbr1 : 10.10.0.101) # ls /sys/class/net ens18 ens19 lo # vi /etc/netplan/01-netcfg.yaml network: version: 2 ethernets: ens18: dhcp4: no addresses: [192.168.0.103/24] routes: - to: default via: 192.168.0.1 nameservers: addresses: [8.8.8.8, 168.126.63.1] ens19: dhcp4: no addresses: [10.10.0.101/24] :wq # netplan apply --NFS 클라이언트 마운트 # apt install -y nfs-common # mkdir /mnt/storage # mount -t nfs 10.10.0.210:/storage/ /mnt/storage --자동 마운트 # vi /etc/fstab 10.10.0.210:/storage /mnt/storage nfs defaults,_netdev,nofail 0 0 :wq --현재 디렉토리 용량 # du -sh . --현재 디렉토리 용량 # du -sh /mnt/storage --하위 디렉토리 용량 # du -sh /mnt/storage/* # du -sh /mnt/storage/* | sort -h --전체 디스크 사용량 # df -h --STEP5-3 : SAMBA 설정 # apt update && apt upgrade -y # apt install -y samba # vi /etc/samba/smb.conf (추가:1) [storage] comment = storage path = /mnt/storage read only = no writable = yes browsable = yes valid users = root create mask = 0777 directory mask = 0777 :wq --설명 [storage] comment = storage #공유폴더설명 path = /mnt/storage #공유할폴더경로 read only = no #읽기전용아님 writable = yes #쓰기가능 browsable = yes #폴더내용탐색가능 valid users = root #접속가능사용자계정 create mask = 0777 #파일권한 directory mask = 0777 #디렉토리권한 # smbpasswd -a root New SMB password: @서버암호 Retype new SMB password: @서버암호 Added user root. # systemctl restart smbd # ufw allow 139,445/tcp --윈도우설정 1. 서버관리자-역할및기능추가-기능선택-SMB1.0/CIFS File Sharing Support 2. gpedit.msc(로컬그룹정책편집기) 컴퓨터구성-관리템플릿-네트워크-Lanman워크스테이션-보안되지않은게스트로그온사용:사용 3. 네트워크 폴더 자격 증명 삭제(오류일경우 액세스가 거부되었습니다) > net use \\10.10.0.101\storage /delete --윈도우탐색기 계정 : root 암호 : @서버암호 (체크)내자격증명기억 --우분투에서 윈도우 폴더 공유하기 # apt install -y cifs-utils # vi /etc/fstab //10.10.0.10x/storage /mnt/storage cifs username=administrator,password=@서버암호 0 0 # mount -a -------------------------------------------------------------------------- --STEP7 : 시스템 --STEP7-1 : 가상시스템 내보내기 파일-가상시스템 내보내기... Virtual machines(가상머신선택) (다음) Format settings(가상머신형식) 형식 : Open Virtualzation Format 1.0 파일 : D:\VMs\VBOX\ZX1_Apache_20250205.ova Mac주소정책 : 모든네트워크어댑터 MAC주소포함 추가옵션 : (체크)Manifest파일쓰기 가상시스템설정 (Finish) --STEP7-2 : 가상시스템 가져오기 파일-가상시스템 가져오기... 가져올 가상 시스템 원본 : 로컬파일시스템 파일 : D:\VMs\VBOX\ZX1_Apache_20260205.ova (다음) 가상시스템설정 이름 : ZX1_Apache_20260205 가상디스트이미지 : ZX1_Apache_20260205-disk001.vmdk 머신기본폴더 : D:\VMs\VBOX MAC주소정책 : NAT네트워크어댑태MAC주소만포함 추가옵션 : (체크)VDI로 하드디스크 가져오기 --STEP7-3 : 윈도우부팅할경우 VBox 자동실행 --작업스케줄러 VMBox HeadlessStart : 시스템시작시 VMBox Savestate : 이벤트상태-기본-로그:시스템,원본:User32,이벤트1074 --VirtaulBOX 명령어 --C:\VMs\HeadlessStart_OracleVMVirtualBox.bat "VBoxManage.exe" startvm "vmname" [--type gui|sdl|headless|separate] "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "AX1_Apache(192.168.56.101)" --type headless "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "DX1_MySQL(192.168.56.201)" --type headless "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "DX2_MySQL(192.168.56.202)" --type headless "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "DX3_MySQL(192.168.56.203)" --type headless "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm "MX1_Apache_MySQL(192.168.56.200)" --type headless --C:\VMs\Savestate_OracleVMVirtualBox.bat "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "AX1_Apache(192.168.56.101)" savestate "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "DX1_MySQL(192.168.56.201)" savestate "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "DX2_MySQL(192.168.56.202)" savestate "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "DX3_MySQL(192.168.56.203)" savestate "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" controlvm "MX1_Apache_MySQL(192.168.56.200)" savestate --작업스케줄러 이름: VMBox HeadlessStart 트리거: 시작할때 자세히: 시스템 시작시 동작: 프로그램시작 프로그램: D:\VMs\Setup\HeadlessStart_OracleVMVirtualBox.bat 시작위치: D:\VMs\Setup\ 이름: VMBox Savestate 트리거: 이벤트상태 설정: 기본 로그: 시스템 원본: User32 이벤트: 1074 (체크)사용 동작: 프로그램시작 프로그램: D:\VMs\Setup\Savestate_OracleVMVirtualBox.bat 시작위치: D:\VMs\Setup\ --윈도우방화벽설정 고급보안이포함된WindowsDefender방화벽 (80,443,9100)CUBE 프로토콜및포트:로컬포트:80,443,9100 -------------------------------------------------------------------------- --STEP7-4 : 고정 디스크와 동적 디스크를 변환하는 방법 VirtualBox에서 .ova 파일을 가져올 때 디스크를 고정 크기(Fixed Size)로 설정하려면, 가져오기 시 동적 할당으로 설정된 가상 디스크 파일을 생성한 후 VBoxManage 명령어를 사용하여 고정 크기로 변환해야 한다 > cd C:\Program Files\Oracle\VirtualBox > VBoxManage.exe list hdds --동적에서 고정으로 변환하는 명령 > VBoxManage.exe clonemedium disk "C:\VMs\VBOX\AX1_Apache\AX1_Apache_std.vdi" "C:\VMs\VBOX\AX1_Apache\AX1_Apache_fix.vdi" -variant Fixed --고정에서 동적으로 변환하는 명령 > VBoxManage.exe clonemedium disk "C:\VMs\VBOX\AX1_Apache\AX1_Apache_fix.vdi" "C:\VMs\VBOX\AX1_Apache\AX1_Apache_std.vdi" -variant Standard --STEP7-5 : 하드디스크 용량늘리기 파일-도구-미디어-하드디스크-(가상미디어선택)-속성-크기변경: 확장 # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 25G 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 2G 0 part /boot └─sda3 8:3 0 23G 0 part └─ubuntu--vg-ubuntu--lv 253:0 0 11.5G 0 lvm / sdb 8:16 0 120G 0 disk └─sdb1 8:17 0 60G 0 part /storage # sudo parted /dev/sdb GNU Parted 3.4 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. # (parted) print Model: ATA VBOX HARDDISK (scsi) Disk /dev/sdb: 85.9GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 64.4GB 64.4GB primary ext4 # (parted) resizepart 1 100% Warning: Partition /dev/sdb1 is being used. Are you sure you want to continue? Yes/No? yes # (parted) quit Information: You may need to update /etc/fstab. # sudo resize2fs /dev/sdb1 resize2fs 1.46.5 (30-Dec-2021) Filesystem at /dev/sdb1 is mounted on /storage; on-line resizing required old_desc_blocks = 8, new_desc_blocks = 10 The filesystem on /dev/sdb1 is now 20971264 (4k) blocks long. # df -h /dev/sdb1 79G 298M 75G 1% /storage # lsblk sdb 8:16 0 80G 0 disk └─sdb1 8:17 0 80G 0 part /storage -------------------------------------------------------------------------- --STEP7-6 : 하드디스크추가(하드추가:/storage2) 파일-도구-미디어-하드디스크-만들기 위치: D:\VMs\VBOX\AX1_Apache(192.168.56.101)\AX1_Apache_Storage2.vdi 크기: 840.00 GB (체크)미리전체크기할당 --완료 --파티션 확인 # fdisk -l Disk /dev/sdc: 840 GiB, 901943132160 bytes, 1761607680 sectors --디스크인식 확인 # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 63.8M 1 loop /snap/core20/2686 loop1 7:1 0 63.8M 1 loop /snap/core20/2717 loop2 7:2 0 87M 1 loop /snap/lxd/29351 loop3 7:3 0 91.4M 1 loop /snap/lxd/36918 loop4 7:4 0 38.8M 1 loop /snap/snapd/21759 loop5 7:5 0 48.1M 1 loop /snap/snapd/25935 sda 8:0 0 25G 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 2G 0 part /boot └─sda3 8:3 0 23G 0 part └─ubuntu--vg-ubuntu--lv 253:0 0 11.5G 0 lvm / sdb 8:16 0 120G 0 disk └─sdb1 8:17 0 120G 0 part /storage sdc 8:32 0 840G 0 disk sr0 11:0 1 50.7M 0 rom --파티션 생성 # fdisk /dev/sdc Command (m for help): n #새 파티션 Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-167772159, default 2048): (엔터) Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-167772159, default 167772159): (엔터) Command (m for help): w --- # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sdc 8:32 0 120G 0 disk └─sdc1 8:33 0 120G 0 part --포맷 # mkfs.ext4 /dev/sdc1 mke2fs 1.46.5 (30-Dec-2021) Creating filesystem with 20971264 4k blocks and 5242880 inodes Filesystem UUID: e590ede8-b85c-4ea5-b197-3f7e9dcfac25 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000 Allocating group tables: done Writing inode tables: done Creating journal (131072 blocks): done Writing superblocks and filesystem accounting information: done --하드추가할경우마운트할 디렉토리를 만든다 --디스크 마운트 # mkdir -p /storage2 # mount /dev/sdc1 /storage2 --용량확인 # df -h /dev/sdc1 79G 24K 75G 1% /storage2 --UUID확인 # blkid /dev/sdc1 /dev/sdc1: UUID="11b966cd-e0b4-448f-9577-67def38e94b5" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="6c2d338c-01" --자동마운트 # vi /etc/fstab (추가:13) UUID=11b966cd-e0b4-448f-9577-67def38e94b5 /storage2 ext4 defaults 0 2 --마운트확인 # mount -a --물리적하드디스크 용량확인 # df -h -T | grep dev/sd /dev/sda2 ext4 2.0G 132M 1.7G 8% /boot /dev/sdb1 ext4 118G 804M 111G 1% /storage /dev/sdc1 ext4 826G 28K 784G 1% /storage2 --bind mount(리눅스 마운트 방식) --데이터이동 # sudo mkdir -p /storage/wwwroot/files # sudo mv /mnt/storage/wwwroot/files/* /storage/wwwroot/files/ --바인드 마운트 # sudo mount --bind /storage/wwwroot/files /mnt/storage/wwwroot/files # sudo chown -R www-data:www-data /storage/wwwroot/files --자동마운트 # vi /etc/fstab (추가:14) /storage2/wwwroot/files /mnt/storage/wwwroot/files none bind 0 0 --마운트확인 # sudo mount -a --(선택)마운트해제 # sudo umount /mnt/storage/wwwroot/files -------------------------------------------------------------------------- 20260210:(해결)[FAILED] A start job is running for /dev/disk/by-uuid/.... Ubuntu가 fstab에 등록된 디스크(UUID)를 마운트하려고 기다리는데, 해당 디스크가 존재하지 않거나 UUID가 변경되어 찾지 못하는 상태입니다. Give root password for maintenance (or press Control-D to continue) : @서버암호 해결방법1 : 하드디스크추가(/storage1) # fdisk -l # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 25G 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 2G 0 part /boot └─sda3 8:3 0 23G 0 part └─ubuntu--vg-ubuntu--lv 253:0 0 11.5G 0 lvm / sdb 8:16 0 60G 0 disk # fdisk /dev/sdb Command (m for help): n Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-167772159, default 2048): (엔터) Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-167772159, default 167772159): (엔터) Command (m for help): w # mkfs.ext4 /dev/sdb1 # mkdir -p /storage1 # mount /dev/sdb1 /storage1 # df -h # blkid /dev/sdb1 /dev/sdb1: UUID="b3ff74ae-2953-488b-a653-6f5e3e95fe31" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="b61c9657-01" # vi /etc/fstab UUID=b3ff74ae-2953-488b-a653-6f5e3e95fe31 /storage1 ext4 defaults 0 2 :wq # shutdown -r now 해결방법2 : 주석처리 부팅후 수정하기 # vi /etc/fstab (주석처리) #UUID=92e3bf92-50aa-4574-8568-c1fb2ac75cb3 /storage1 ext4 defaults 0 2 :wq # shutdown -r now -------------------------------------------------------------------------- --STEP7-7 : APACHE2 멀티도메인+서브도메인 https://velog.io/@yjj4899/ubuntu-20.04-apache2-설치부터-설정까지 # vi /etc/apache2/sites-available/cube2005.co.kr.conf ServerAdmin dkjang@naver.com ServerName cube2005.co.kr ServerAlias cube2005.co.kr www.cube2005.co.kr DocumentRoot /storage/wwwroot/www.cube2005.co.kr ErrorLog /storage/logs/apache2/cube2005.co.kr-error.log CustomLog /storage/logs/apache2/cube2005.co.kr-access.log combined ServerName app.cube2005.co.kr DocumentRoot /storage/wwwroot/app.cube2005.co.kr :wq # vi /etc/apache2/sites-available/cubeapp.co.kr.conf ServerAdmin webmaster@localhost ServerName cubeapp.co.kr ServerAlias cubeapp.co.kr www.cubeapp.co.kr DocumentRoot /storage/wwwroot/www.cubeapp.co.kr ErrorLog /storage/logs/apache2/cubeapp.co.kr-error.log ErrorLog /storage/logs/apache2/cubeapp.co.kr-access.log ServerName app.cubeapp.co.kr DocumentRoot /storage/wwwroot/app.cubeapp.co.kr :wq # cd /etc/apache2/sites-available/ --000-default.conf 비활성 # a2dissite 000-default.conf --default-ssl.conf 비활성 # a2dissite default-ssl.conf --cube2005.co.kr.conf 활성화 # a2ensite cube2005.co.kr.conf --cube2005.co.kr.conf 활성화 # a2ensite cube2005.co.kr.conf # systemctl restart apache2 https://my.hosting.kr/domains 네임서버추가 A @ 183.111.185.242 A app 183.111.185.242 A www 183.111.185.242 --STEP7-8 : APACHE2 다중포트설정 # vi /etc/apache2/ports.conf #Listen 80 (추가)Listen 8083 :wq # vi /etc/apache2/sites-available/000-default.conf (수정) ProxyPreserveHost On ProxyPass / http://localhost:8083/ ProxyPassReverse / http://localhost:8083/ ErrorLog /storage/logs/apache2/localhost-8083-error.log CustomLog /storage/logs/apache2/localhost-8083-access.log combined :wq # systemctl restart apache2 -------------------------------------------------------------------------- --기본명령어 shutdown -P now :전원종료 shutdown -r now :재부팅(reboot) --디렉토리 삭제 rm -rf {디렉토리명} rm -rf * --Alias 설정하기 vi ~/.bashrc alias shutn='shutdown -h now' -------------------------------------------------------------------------- --20210802 : editplus(에디트플러스)FTP설정 파일-FTP-FTP설정 설명 : 183.111.185.242 FTP서버 : 183.111.185.242 Username : root Pasword : @서버암호 디렉토리 : /storage/wwwroot 고급옵션(선택) : 암호화 : sftp --SSH Secure File Transfer Client File-Connect... Profile : 183_111_185_242 -connection Hostname : 183.111.185.242 Username : root Portnumber : 22 -Favorite folder Home folder : /storage/wwwroot Profile : 192_168_56_101 -connection Hostname : 192.168.56.101 Username : root Portnumber : 22 -Favorite folder Home folder : /storage/wwwroot ####################################################### --STEP3 : 미디어 가상하드만들기(하드추가:/storage1) --STEP3-1 : 미디어 가상하드 만들기(5분) --Proxmox-VM-하드웨어-추가-하드디스크-추가:하드디스크 스토리지: local-lvm 디스크크기(GB) : 60 --파티션 확인 # fdisk -l --디스크인식 확인 # lsblk sdb 8:16 0 60G 0 disk --파티션 생성 # fdisk /dev/sdb Command (m for help): n Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-125829119, default 2048): (엔터) Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-125829119, default 125829119): (엔터) Command (m for help): w --- # Command (m for help): n #새 파티션 Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-125829119, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-125829119, default 125829119): Created a new partition 1 of type 'Linux' and of size 60 GiB. Command (m for help): p Disk /dev/sdb: 60 GiB, 64424509440 bytes, 125829120 sectors Disk model: QEMU HARDDISK Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x534d7e28 Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 125829119 125827072 60G 83 Linux Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. --- # lsblk sdb 8:16 0 60G 0 disk └─sdb1 8:17 0 60G 0 part --포맷 # mkfs.ext4 /dev/sdb1 mke2fs 1.47.0 (5-Feb-2023) Discarding device blocks: done Creating filesystem with 15728384 4k blocks and 3932160 inodes Filesystem UUID: d5b06077-daa9-41dd-8b44-cde4de329409 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424 Allocating group tables: done Writing inode tables: done Creating journal (65536 blocks): done Writing superblocks and filesystem accounting information: done --하드추가할경우마운트할 디렉토리를 만든다 --디스크 마운트 # mkdir -p /storage1 # mount /dev/sdb1 /storage1 --용량확인 # df -h /dev/sdb1 59G 24K 56G 1% /storage1 --UUID확인 # blkid /dev/sdb1 /dev/sdb1: UUID="d5b06077-daa9-41dd-8b44-cde4de329409" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="534d7e28-01" --자동마운트 # vi /etc/fstab (추가:12) UUID=d5b06077-daa9-41dd-8b44-cde4de329409 /storage1 ext4 defaults 0 2 --마운트확인 # mount -a --물리적하드디스크 용량확인 # df -h -T | grep dev/sd /dev/sda2 ext4 2.0G 132M 1.7G 8% /boot /dev/sdb1 ext4 118G 24K 112G 1% /storage1 (3TB일경우에만사용)?3TB는 fdisk 파티셔닝할수없음.parted사용. # parted /dev/sdb (parted) mklabel gpt Yes/No? yes (parted) unit TB (parted) mkpart primary 0.00TB 3.00TB (parted) print (parted) quit