- install-rdp-api.sh: curl 원라이너 설치 지원 - requirements.txt 의존성 제거 (패키지 버전 스크립트 내장) - rdp-toggle-api.py Gitea에서 자동 다운로드 - 상세한 설치 완료 메시지 추가 - RDP/README.md: 완전히 재구성 - curl 원라이너 설치 가이드 추가 - API 엔드포인트 상세 설명 및 응답 예시 - React 프론트엔드 연동 예시 개선 - 문제 해결 섹션 추가 - 네트워크 설정 및 방화벽 가이드 - README.md: RDP 자동화 섹션 추가 - Proxmox RDP 초기 설정 스크립트 소개 - RDP Toggle API 설치 가이드 - API 사용 예시 추가 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
91 lines
2.5 KiB
Bash
Executable File
91 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# RDP Toggle API 설치 스크립트
|
|
# curl -fsSL https://git.0bin.in/thug0bin/pve9-repo-fix/raw/branch/main/RDP/install-rdp-api.sh | bash
|
|
|
|
set -e
|
|
|
|
echo "RDP Toggle API 설치 시작..."
|
|
|
|
# 설치 디렉토리 설정
|
|
INSTALL_DIR="/opt/rdp-toggle-api"
|
|
VENV_DIR="$INSTALL_DIR/venv"
|
|
GITEA_BASE_URL="https://git.0bin.in/thug0bin/pve9-repo-fix/raw/branch/main/RDP"
|
|
|
|
# Python 및 venv 설치
|
|
echo "Python 및 필수 패키지 설치 중..."
|
|
apt update
|
|
apt install -y python3 python3-venv python3-pip curl
|
|
|
|
# 설치 디렉토리 생성
|
|
mkdir -p "$INSTALL_DIR"
|
|
|
|
# 가상환경 생성
|
|
echo "가상환경 생성 중..."
|
|
python3 -m venv "$VENV_DIR"
|
|
|
|
# 가상환경에서 패키지 설치
|
|
echo "Python 패키지 설치 중..."
|
|
"$VENV_DIR/bin/pip" install --upgrade pip
|
|
"$VENV_DIR/bin/pip" install fastapi==0.115.5 uvicorn==0.32.1 python-multipart==0.0.20 pydantic==2.10.3
|
|
|
|
# API 파일 다운로드
|
|
echo "API 서버 파일 다운로드 중..."
|
|
curl -fsSL "$GITEA_BASE_URL/rdp-toggle-api.py" -o "$INSTALL_DIR/rdp-toggle-api.py"
|
|
chmod +x "$INSTALL_DIR/rdp-toggle-api.py"
|
|
|
|
# systemd 서비스 생성
|
|
echo "systemd 서비스 생성 중..."
|
|
cat > /etc/systemd/system/rdp-toggle-api.service << EOF
|
|
[Unit]
|
|
Description=RDP Toggle API Service
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=root
|
|
WorkingDirectory=$INSTALL_DIR
|
|
ExecStart=$VENV_DIR/bin/python $INSTALL_DIR/rdp-toggle-api.py
|
|
Restart=always
|
|
RestartSec=5
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
|
|
# 서비스 활성화 및 시작
|
|
echo "서비스 활성화 및 시작 중..."
|
|
systemctl daemon-reload
|
|
systemctl enable rdp-toggle-api.service
|
|
systemctl start rdp-toggle-api.service
|
|
|
|
# 잠시 대기 후 상태 확인
|
|
sleep 2
|
|
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "RDP Toggle API 설치 완료!"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "📍 API 서버: http://$(hostname -I | awk '{print $1}'):8090"
|
|
echo "📁 설치 위치: $INSTALL_DIR"
|
|
echo ""
|
|
echo "✅ 사용 방법:"
|
|
echo " 상태 확인:"
|
|
echo " curl http://localhost:8090/status"
|
|
echo ""
|
|
echo " RDP 모드 활성화:"
|
|
echo " curl -X POST http://localhost:8090/toggle \\"
|
|
echo " -H 'Content-Type: application/json' \\"
|
|
echo " -d '{\"mode\":\"rdp\"}'"
|
|
echo ""
|
|
echo " Shell 모드 전환:"
|
|
echo " curl -X POST http://localhost:8090/toggle \\"
|
|
echo " -H 'Content-Type: application/json' \\"
|
|
echo " -d '{\"mode\":\"shell\"}'"
|
|
echo ""
|
|
echo "🔧 서비스 관리:"
|
|
echo " systemctl status rdp-toggle-api"
|
|
echo " systemctl restart rdp-toggle-api"
|
|
echo " systemctl stop rdp-toggle-api"
|
|
echo "" |