I have a Epson L120 printer that I would like to share over the home network. By setting up CUPS we can make this printer available to all the laptops, iPad, and iPhone in the house.

sudo apt-get install cups

1) Setup Cups

#Listen localhost:631
Browsing On
# Restrict access to the server...
<Location />
  Order allow,deny
  Allow @LOCAL
</Location>
# Restrict access to configuration files...
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow @LOCAL
</Location>

Modify the 3 highlighted lines above which allow access to the CUPS web gui from locations other than the host machine.

sudo usermod -a -G lpadmin <username>
sudo cupsctl --remote-any
sudo /etc/init.d/cups restart

We give permission to our user to do printer administration, make cups accessible anywhere in our network, and then we restart the service.

2) Modify Samba configuration

sudo nano /etc/samba/samba.conf
[printers]               
   comment = All Printers
   browseable = yes      
   path = /var/spool/samba
   printable = yes       
   guest ok = yes        
   read only = no       
   create mask = 0700

Modify the browseable and guest okay to ‘yes’, set read only to no and save the file.

Restart Samba

sudo /etc/init.d/samba restart

If you are using UFW (Uncomplicated Firewall) You need to allow port 631 through:

sudo ufw allow 631

Now try accessing the CUPs web GUI using your servers IP address with the port :631 appended at the end. Navigate to the Administration tab and click Add Printer

Now one note. You may have to install printer drivers. my Brother HL-L2320D printer needed drivers installed first. The drivers on the Brother website works fine on my PC (i386) but did not work on the Raspberry Pi (arm) so in that case I found another driver that did work:

Brother HL-L2320D driver here (for i386)

sudo apt install printer-driver-brlaser

3) Share CUPS Printer with iOS Clients via AirPrint

sudo nano /etc/avahi/services/AirPrint-DeskJet-2130-series.service
&lt;?xml version='1.0' encoding='UTF-8'?>
&lt;!DOCTYPE service-group SYSTEM "avahi-service.dtd">
&lt;service-group>
  &lt;name replace-wildcards="yes">AirPrint HL-L2320D-series @ %h&lt;/name>
  &lt;service>
    &lt;type>_ipp._tcp&lt;/type>
    &lt;subtype>_universal._sub._ipp._tcp&lt;/subtype>
    &lt;port>631&lt;/port>
    &lt;txt-record>txtvers=1&lt;/txt-record>
    &lt;txt-record>qtotal=1&lt;/txt-record>
    &lt;txt-record>Transparent=T&lt;/txt-record>
    &lt;txt-record>URF=none&lt;/txt-record>
    &lt;txt-record>rp=printers/HL-L2320D-series&lt;/txt-record>
    &lt;txt-record>note=Brother HL-L2320D series&lt;/txt-record>
    &lt;txt-record>product=(GPL Ghostscript)&lt;/txt-record>
    &lt;txt-record>printer-state=3&lt;/txt-record>
    &lt;txt-record>printer-type=0x2900c&lt;/txt-record>
  &lt;/service>ord>pdl=application/octet-stream,application/pdf,application/postscript,application/>&lt;/service-group>

Save and close the file and restart Avahi-daemon:

sudo systemctl restart avahi-daemon

You should now be able to print from your ios devices.

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *