diff --git a/README.md b/README.md new file mode 100644 index 0000000..b5e33f2 --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +# Raspberry Pi CUPS 브라더 프린터 설정 + +라즈베리파이에서 Brother HL-L2335D 프린터를 AirPrint로 사용하기 위한 자동 설정 스크립트입니다. + +## 🚀 빠른 설치 + +```bash +curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/YOUR_REPO/main/📄%20rpi-brother-airprint.sh | bash +``` + +또는 + +```bash +wget -qO- https://raw.githubusercontent.com/YOUR_USERNAME/YOUR_REPO/main/📄%20rpi-brother-airprint.sh | bash +``` + +수동 다운로드 후 실행: + +```bash +wget https://raw.githubusercontent.com/YOUR_USERNAME/YOUR_REPO/main/📄%20rpi-brother-airprint.sh -O rpi-brother-airprint.sh +chmod +x rpi-brother-airprint.sh +./rpi-brother-airprint.sh +``` + +## ✅ 이 스크립트가 해주는 일 + +1. **CUPS + Avahi-daemon 설치** (AirPrint 지원) +2. **printer-driver-brlaser 설치** (HL-L2335D 지원) +3. **ipp-usb 중지** (충돌 방지) +4. **HL-L2335D 프린터를 brlaser PPD로 자동 등록** +5. **AirPrint 공유 활성화** +6. **테스트 페이지 자동 출력** + +## 📱 사용 방법 + +### iPhone/iPad +- 설정 → AirPrint 프린터 목록에서 `HLL2335D` 검색 + +### Windows +- 네트워크 프린터 추가 → `ipp://raspberrypi.local/printers/HLL2335D` + +### 관리 페이지 +- http://라즈베리파이IP:631 + +## 📝 참고사항 + +- Brother HL-L2335D를 USB로 연결한 상태에서 실행하세요 +- 스크립트는 자동으로 시스템 업데이트 후 필요한 패키지를 설치합니다 +- 완료 후 자동으로 테스트 페이지가 출력됩니다 diff --git a/📄 rpi-brother-airprint.sh b/📄 rpi-brother-airprint.sh new file mode 100644 index 0000000..11c16ed --- /dev/null +++ b/📄 rpi-brother-airprint.sh @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +echo "=== Raspberry Pi AirPrint + Brother HL-L2335D Setup ===" + +### 0. 기본 업데이트 +sudo apt-get update -y +sudo apt-get upgrade -y + +### 1. CUPS + AirPrint 관련 패키지 설치 +sudo apt-get install -y \ + cups cups-client cups-filters \ + avahi-daemon avahi-discover avahi-utils \ + printer-driver-brlaser printer-driver-gutenprint \ + system-config-printer + +# ipp-usb 충돌 방지 (USB 프린터 직접 잡도록) +sudo systemctl stop ipp-usb || true +sudo systemctl disable ipp-usb || true + +### 2. CUPS 권한 및 방화벽 +sudo usermod -aG lpadmin $USER +sudo cupsctl --remote-admin --remote-any --share-printers + +### 3. Brother HL-L2335D 큐 등록 +PRINTER_NAME="HLL2335D" +PRINTER_URI="usb://Brother/HL-L2335D%20series?serial=$(lsusb -d 04f9: | awk '{print $6}' || echo AUTO)" + +# 기존 큐 제거 +sudo lpadmin -x $PRINTER_NAME 2>/dev/null || true + +# brlaser 드라이버를 이용한 큐 생성 +sudo lpadmin -p $PRINTER_NAME -E \ + -v "$PRINTER_URI" \ + -m drv:///brlaser.drv/brl2335d.ppd \ + -D "Brother HL-L2335D (brlaser)" + +# 큐 공유/활성화 +sudo lpadmin -p $PRINTER_NAME -o printer-is-shared=true +sudo cupsaccept $PRINTER_NAME +sudo cupsenable $PRINTER_NAME +sudo lpadmin -d $PRINTER_NAME + +### 4. Avahi AirPrint 서비스 확인 +if ! systemctl is-active --quiet avahi-daemon; then + sudo systemctl enable avahi-daemon --now +fi + +### 5. 테스트 페이지 출력 +echo "Hello from Raspberry Pi + Brother HL-L2335D (brlaser)" | lp -d $PRINTER_NAME + +echo "=== 완료! ===" +echo "➡ iPhone/iPad: AirPrint 프린터 목록에서 '${PRINTER_NAME}' 확인" +echo "➡ Windows: 네트워크 프린터 추가 → ipp://raspberrypi.local/printers/${PRINTER_NAME}" +echo "➡ 관리 페이지: http://$(hostname -I | awk '{print $1}'):631"