Debian系统配置打印机完整步骤
CUPS(Common Unix Printing System)是Debian下管理打印的核心服务,需先安装并启动。打开终端执行以下命令:
sudo apt-get update
sudo apt-get install cups cups-client cups-bsd foomatic-filters
安装完成后,启动CUPS服务并设置为开机自启:
sudo systemctl start cups
sudo systemctl enable cups
若需通过网络(如局域网内的Windows/Linux设备)访问打印机,需修改CUPS配置文件:
sudo nano /etc/cups/cupsd.conf
找到并修改以下内容:
Listen localhost:631改为Listen 0.0.0.0:631(允许所有IP访问);<Location />部分的Order deny,allow改为Order allow,deny,并添加Allow From all(允许所有来源访问)。sudo systemctl restart cups
http://localhost:631(若远程访问,替换为Debian主机的IP地址,如http://192.168.1.100:631);ls /dev/usb/lp*查看设备节点(如/dev/usb/lp0);lpadmin命令添加:sudo lpadmin -p MyUSBPrinter -E -v usb://Samsung/ML-1640 -m splix-Samsung-ML-1640.ppd -L "Office Desk"
其中:-p指定打印机名称,-E启用打印机,-v指定设备URI,-m指定PPD驱动文件(可通过apt search splix安装对应驱动,如splix包),-L设置打印机位置。
http://localhost:631),进入Administration > Add Printer;192.168.1.101),点击Search;注:若打印机支持IPP协议,可直接通过ipp://<打印机IP>/ipp/print格式输入URI,无需搜索。
部分品牌(如HP、Epson)可能需要额外安装驱动:
hplip(包含驱动和图形化管理工具):sudo apt-get install hplip hplip-gui
安装完成后,运行hp-setup命令,通过向导完成打印机添加。
epson-inkjet-printer-escpr驱动(支持多数Epson喷墨打印机):sudo apt-get install epson-inkjet-printer-escpr
添加完成后,在CUPS网页界面点击打印机名称,选择Print Test Page,确认打印机是否正常输出测试页。
也可通过命令行测试:
echo "This is a test print." | lp -d MyPrinterName
其中-d指定打印机名称。
若需让局域网内其他设备使用打印机,需在CUPS中启用共享:
sudo systemctl restart cups
其他设备添加打印机时,输入Debian主机的IP地址和打印机名称(如http://192.168.1.100:631/printers/MyPrinterName)即可连接。
常见问题排查:
sudo ufw allow 631/tcp;hplip、Canon的cnijfilter)。