홈서버 및 Oracle 서버 세팅

홈서버와 Oracle cloud 서버를 초기화 하고 다시 세팅할 때 내 환경에 맞춰 쉽게 세팅할 수 있도록 기록한다. 한 줄 씩 실행하면 된다. 홈서버 (Debian 13) 첫 설치 시 lvm + luks2 설정하기 root 로그인 금지 # 사용자 관리자 권한 주기 sudo -i usermod -aG sudo <username> exit # 노트북 덮개 닫아도 절전되지 않게 sudo sed -i 's/^#\?HandleLidSwitch=.*/HandleLidSwitch=ignore/' /etc/systemd/logind.conf && sudo systemctl restart systemd-logind 초기 패키지 설치 # 업데이트 sudo apt update -y sudo apt upgrade -y # 패키지 설치 sudo apt install nala -y sudo nala install zsh git curl wget htop btop neofetch net-tools -y # Python 설치 sudo nala install python3 python3-pip python3-venv build-essential -y python3 --version # Node.js 설치 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" source ~/.bashrc nvm install node node -v; npm -v # 터미널 설정 sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.powerlevel10k echo 'source ~/.powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc source ~/.zshrc # p10k 초기 설정 sed -i 's/POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE=.*/POWERLEVEL9K_CONTEXT_{REMOTE,REMOTE_SUDO}_TEMPLATE="%n"/' ~/.p10k.zsh && sed -i 's/POWERLEVEL9K_TIME_FORMAT=.*/POWERLEVEL9K_TIME_FORMAT="%D{%H:%M}"/' ~/.p10k.zsh && source ~/.p10k.zsh git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions 2>/dev/null || true; grep -q "zsh-autosuggestions" ~/.zshrc || echo -e "\n# zsh-autosuggestions\nsource ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc; source ~/.zshrc git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting 2>/dev/null || true; grep -q "zsh-syntax-highlighting" ~/.zshrc || echo -e "\n# zsh-syntax-highlighting\nsource ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc; source ~/.zshrc sudo nala install eza autojump -y grep -q "plugins=.*autojump" ~/.zshrc || sed -i -E 's/^plugins=\(([^)]*)\)/plugins=(\1 autojump)/' ~/.zshrc && source ~/.zshrc grep -q "alias ls='eza --icons --group-directories-first'" ~/.zshrc || echo -e "\n# eza aliases\nalias ls='eza --icons --group-directories-first'\nalias ll='eza -lah --icons --group-directories-first --no-user'\nalias lt='eza -T --icons'" >> ~/.zshrc; source ~/.zshrc # Docker 설치 sudo nala remove $(dpkg --get-selections docker.io docker-compose docker-doc podman-docker containerd runc | cut -f1) sudo nala update sudo nala install ca-certificates sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc printf "Types: deb\nURIs: https://download.docker.com/linux/debian\nSuites: $(. /etc/os-release && echo "$VERSION_CODENAME")\nComponents: stable\nSigned-By: /etc/apt/keyrings/docker.asc\n" | sudo tee /etc/apt/sources.list.d/docker.sources > /dev/null sudo nala update sudo nala install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y sudo usermod -aG docker $USER && newgrp docker 보안 설정 # ssh port 변경 sudo vi /etc/ssh/sshd_config # NEW_PORT에 원하는 포트 입력 NEW_PORT=2222; sudo sed -i "s/^#\?Port [0-9]*/Port $NEW_PORT/" /etc/ssh/sshd_config && sudo systemctl restart sshd # ssh key 설정 ssh-keygen -b 4096 # 로컬에서 실행 ssh-copy-id -p <port> -i <key> <username>@<host> # 로컬에서 실행 sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config && sudo sed -i 's/^#\?ChallengeResponseAuthentication.*/ChallengeResponseAuthentication no/' /etc/ssh/sshd_config && sudo sed -i 's/^#\?UsePAM.*/UsePAM no/' /etc/ssh/sshd_config && sudo systemctl restart sshd # 방화벽 설정 sudo nala install ufw -y sudo ufw allow <ssh port>/tcp sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw enable sudo grep -q "BEGIN UFW AND DOCKER" /etc/ufw/after.rules || echo -e "\n# BEGIN UFW AND DOCKER\n*filter\n:DOCKER-USER - [0:0]\n-A DOCKER-USER -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT\n-A DOCKER-USER -j RETURN\nCOMMIT\n# END UFW AND DOCKER" | sudo tee -a /etc/ufw/after.rules > /dev/null sudo sed -i 's/^DEFAULT_FORWARD_POLICY=.*/DEFAULT_FORWARD_POLICY="ACCEPT"/' /etc/default/ufw sudo ufw disable && sudo ufw enable sudo iptables -L DOCKER-USER -n # DOCKER-USER 체인이 보이면 정상 적용됨 # ssh 방화벽 설정 sudo nala install fail2ban -y sudo systemctl enable fail2ban --now sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local # PORT에 ssh 포트 입력 PORT=2222; sudo awk -v p="$PORT" 'BEGIN{in=0} /^\[sshd\]/{print "[sshd]\nenabled = true\nport = " p "\nfilter = sshd\nlogpath = /var/log/auth.log\nbackend = systemd\nmaxretry = 3\nfindtime = 10m\nbantime = 1h"; in=1; next} /^\[.*\]/{in=0} !in{print}' /etc/fail2ban/jail.local 2>/dev/null | sudo tee /etc/fail2ban/jail.local >/dev/null sudo systemctl restart fail2ban sudo fail2ban-client status sshd

February 20, 2026 · 3 min · 571 words · Me

Rocky Linux 9에서 Python 3.14 설치

sudo dnf update -y sudo dnf upgrade -y sudo dnf groupinstall "Development Tools" -y sudo dnf install tar curl gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make findutils ncurses-devel xz-devel sqlite-devel readline-devel openssl-devel libuuid-devel -y cd ~ wget https://www.python.org/ftp/python/3.14.3/Python-3.14.3.tar.xz tar -xf Python-3.14.3.tar.xz cd ~/Python-3.14.3 ./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" make -j $(nproc) sudo make altinstall python3.14 --version

December 25, 2025 · 1 min · 56 words · Me

Nginx Proxy Manager로 딥 웹(Tor)에 정적 사이트 서빙하기 🧅

Tor 설치 및 Nginx Proxy Manager 세팅 sudo dnf install tor services: app: image: 'docker.io/jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: - '80:80' - '81:81' - '443:443' volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt 위와 같이 docker-compose.yml를 작성하고 컨테이너를 실행한다. http://<host>:81 에 접속해서 기본 세팅을 마무리한다. 정적 파일 서빙 할 컨테이너 세팅 services: hugo-static: image: nginx:alpine container_name: hugo-static volumes: - <정적 파일 디렉토리>:/usr/share/nginx/html:ro restart: unless-stopped networks: - npm_net ports: - "<외부 포트>:80" networks: npm_net: external: true docker compose up -d 리버스 프록시 생성 sudo -i cat /var/lib/tor/hidden_service/hostname .onion 도메인을 확인한 후, Nginx Proxy Manager 웹 UI에서 Proxy Hosts 메뉴로 이동 후 Add Proxy Host 버튼을 클릭한다. ...

December 8, 2025 · 1 min · 113 words · Me

스마트폰에 Debian 설치하기

23.11.28에 작성된 글입니다. 준비물 Android 스마트폰 PC 케이블 주의사항 가이드를 정확하게 따라오지 않으면 스마트폰이 부팅되지 않는 벽돌현상이 발생할 수 있다. 반드시 스마트폰의 모든 데이터를 백업한 후 진행해야 한다. 필자는 손실된 데이터에 대해 책임지지 않는다. 삼성 스마트폰 사용자라면 삼성 KNOX 워런티가 깨진다. 순정으로 복구해도 삼성 헬스, 삼성 페이 등 KNOX 관련 앱들을 **영구적으로 사용할 수 없게 된다. 스마트폰을 가볍게 이 작업은 선택사항이지만 더 가벼운 환경에서 서버를 사용하고 싶으면 진행할 것을 권장한다. 삼성의 OneUI, 샤오미의 MIUI (현 HyperOS), Oppo의 ColorOS 등의 사용자 인터페이스는 각 제조사 별 자체 기능과 개성을 더하기 위해 순정 Android를 개조하여 만든 것인데, 이 때문에 배터리가 빨리 닳거나 느려지는 현상이 발생할 수 있다. ...

June 16, 2025 · 3 min · 518 words · Me

Ubuntu 22.04 서버 세팅하기 🛠️

서문 Windows 7을 약 2주 간 서버로 사용한 후 다시 Ubuntu 22.04로 돌아왔다. OBS 송출 테스트를 위해 Ubuntu Server 대신 Ubuntu를 설치했고, 완전한 순정 상태다. 이번 글에서는 Ubuntu 22.04를 서버로 사용하기 편리하게 세팅하는 방법을 소개하겠다. 이 글과 겹치는 내용이 있으나 추가적으로 업데이트 된 내용도 있다. 반드시 순정 상태에서, 홈 디렉토리에서 해야 문제가 생기지 않는다. ✅ 패키지 업데이트 sudo apt-get update -y sudo apt-get upgrade -y 🪡 각종 인프라 유틸리티 sudo apt-get install htop net-tools neofetch cpufetch 👸 터미널을 예쁘게 만들기 sudo apt-get install zsh git curl -y sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc source ~/.zshrc ⚒️ zsh 플러그인 설치 git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/g' ~/.zshrc git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting echo "source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${HOME}/.zshrc source ~/.zshrc 🔋 노트북 덮개 덮어도 전원 유지 sudo sed -i 's/#HandleLidSwitch=suspend/HandleLidSwitch=ignore/g' /etc/systemd/logind.conf sudo systemctl restart systemd-logind 🔐 git credential 세팅 git clone <개인 repo> cd <개인 repo> git config --global credential.helper store 💻 nodejs 설치 및 개발 환경 세팅 sudo apt install nodejs -y sudo apt install npm -y sudo npm cache clean -f sudo npm install -g n sudo n stable sudo npm install -g yarn nodemon pm2 typescript ts-node 💻 pip 설치 curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python3 get-pip.py PATH=$HOME/.local/bin:$PATH echo "alias p='python3'" >> ~/.zshrc source ~/.zshrc 📲 ftp 서버 구축 sudo apt install vsftpd -y sudo sh -c "echo -e 'listen=YES\nlisten_ipv6=NO\nanonymous_enable=NO\nport_enable=NO\npasv_enable=YES\nlocal_enable=YES\nwrite_enable=YES\nuse_localtime=YES\nxferlog_enable=YES\nsecure_chroot_dir=/var/run/vsftpd/empty\npam_service_name=vsftpd\nssl_enable=YES\nrsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem\nrsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key\nlisten_port=21\npasv_min_port=60020\npasv_max_port=60030' > /etc/vsftpd.conf" sudo systemctl enable vsftpd sudo systemctl restart vsftpd 🎮 rdp 구축 sudo apt install xrdp -y sudo adduser xrdp ssl-cert sudo sh -c "sed -i '1 i\export XDG_CURRENT_DESKTOP=ubuntu:GNOME' /etc/xrdp/startwm.sh" sudo sh -c "sed -i '1 i\export GNOME_SHELL_SESSION_MODE=ubuntu' /etc/xrdp/startwm.sh" sudo sh -c "echo 'unset DBUS_SESSION_BUS_ADDRESS' >> /etc/xrdp/startwm.sh" sudo sh -c "echo 'unset XDG_RUNTIME_DIR' >> /etc/xrdp/startwm.sh" sudo service xrdp restart 💬 irc 구축 sudo apt-get install perl g++ make wget -y wget https://github.com/inspircd/inspircd/archive/refs/tags/v3.14.0.tar.gz tar xvf ./v3.14.0.tar.gz cd inspircd-3.14.0 perl ./configure make make -j5 install nano run/conf/inspircd.conf 다음과 같이 입력한다. ...

September 5, 2022 · 3 min · 450 words · Me