Content
Step by step tutorial to share your printer and print wirelessly (in WiFi) on your old USB printer using a Raspberry Pi (which is networked).
Usual update
We start with the usual update
sudo apt-get update sudo apt-get upgrade
Installing CUPS to share your printer
We can now install CUPS developed by Apple for MacOS and Linux (which we use here on Linux).
sudo apt-get install cups
Then configure it
sudo nano /etc/cups/cupsd.conf
Replace “listen localhost:631” (which forces CUPS to listen only to local port 631) with “listen 631” (which allows network machines to access CUPS.)
# Only listen for connections from the local machine. # To replace: Listen localhost:631 Listen 631 Listen /var/run/cups/cups.sock
Add “BrowseAddress @LOCAL” in the “# Show shared printers on the local network” section. The BrowseAddress value indicates which hosts the printer information will be broadcast to. “@LOCAL” means “all” hosts on the connected local network.
# Show shared printers on the local network. Browsing On BrowseLocalProtocols dnssd BrowseAddress @LOCAL # Add here
Insert “Allow @Local” in the following paragraphs
Restrict access
Restrict access to the server…
# Restrict access to the server... Order allow,deny Allow @Local # Add here
Restrict access to the admin pages…
# Restrict access to the admin pages... Order allow,deny Allow @Local # Add here
Restrict access to configuration files…
# Restrict access to configuration files... AuthType Default Require user @SYSTEM Order allow,deny Allow @Local # Add here
Add user to user group “lpadmin”.
Then it is necessary to add a user to the user group “lpadmin”. It can be the default user “pi”. You can also create a new user if you want. But it is not mandatory. Ici, nous utilisons l’utilisateur pi.
sudo usermod -aG lpadmin pi
Installer les drivers d’imprimante
Pour HP
sudo apt-get install hplip sudo hp-setup -i
Pour Samsung
sudo apt-get install printer-driver-splix
Pour Epson
sudo apt-get install printer-driver-escpr
Redémarrez CUPS après avoir installé les paquets qui vous intéressent.
sudo service cups restart
Installer SAMBA sur le Raspi
Installer SAMBA
sudo apt-get install samba samba-common-bin
Configurer le partage
Modifier le fichier de configuration de samba
sudo nano /etc/samba/smb.conf
- Ajouter dans la rubrique [global]
# Printing with CUPS load printers = yes printing = cups printcap name = cups
- At the end of the file modify [printers] and [print$] as follows:
[printers] comment = All Printers browseable = no path = /var/spool/samba public = yes printable = yes guest ok = yes writable = no create mask = 0700 # Windows clients look for this share name as a $. # printer drivers [print$] comment = Printer Drivers path = /var/lib/samba/printers browseable = yes read only = yes guest ok = no write list = pi
Restart SAMBA to take these changes into account.
sudo service smbd restart
Set up the CUPS print server
Open a browser to the CUPS admin page, either on the Raspberry Pi or on a PC connected to the same network. Enter the address of the RasPi, followed by the port number separated by a colon. Ex: 192.168.1.59:631.
Be sure to enable printer sharing by checking the box when asked during the process.