- Raspberry Pi 3/4
- USB Printer
- 8GB+ microSD card
- 2+ Amp Micro-USB power supply (Pi 3) or 3+ Amp USB-C power supply (Pi 4)
If you're smart, you'll use the 64-bit Lite image, but I didn't find that at first and went with the 64-bit Desktop image. This meant more work cleaning up unnecessary packages.
Download Raspberry Pi Imager. Run it. Click "Choose OS". Scroll to the bottom and select "Use Custom." Select the image you downloaded. Click "Choose Storage," and select your microSD card. Click "Write," and wait for it to complete. Put the microSD card in the Pi.
Log in as the default pi
user with password raspberry
.
sudo su
systemctl enable ssh
systemctl stop bluetooth
systemctl disable bluetooth
apt-get install vim
raspi-config
- Set WLAN/locale/timezone settings as desired
- System Options > Boot / Auto login > Console
- Finish and reboot
From this point on, use SSH to log in to the device. If you need your local IP, run
ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(.\d+){3}'
NOTE: If you used the Raspberry Pi OS Lite image, you can skip this section.
sudo su
apt purge xserver* lightdm* raspberrypi-ui-mods vlc* lxde* chromium* desktop* gnome* gstreamer* gtk* hicolor-icon-theme* lx* mesa* libx11* thonny ffmpeg dillo
apt-get autoremove
apt-get update && apt-get upgrade
NOTE: Substitute printer-driver-brlaser
with the appropriate printer-driver
package for your printer. See the list of available packages for more info.
sudo su
apt-get install cups printer-driver-brlaser
usermod -a -G lpadmin pi
cupsctl --remote-any
systemctl enable cups
systemctl restart cups
- Navigate to
https://<pi-ip>:631/admin
(bypass invalid certificate warnings) - Log in using
pi
account credentials - Click "Add Printer"
- Select printer and driver, ensure sharing is enabled
- Print a test page to ensure local printing works
sudo su
apt-get install samba smbclient
smbpasswd -a root
Set a secure password for root user (this applies to Samba only, not the system)
vim /etc/samba/smb.conf
Edit the file as follows:
[printers]
comment = All Printers
browseable = yes
path = /var/spool/samba
printable = yes
guest ok = yes
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = yes
write list = root, @lpadmin
Finally, run
systemctl enable smbd
systemctl restart smbd
sudo mkdir -p /usr/share/cups/drivers
Download the CUPS 64-bit DLLs.
Verify the ZIP signature:
Algorithm | Value |
---|---|
CRC32 | 4A9760C3 |
CRC64 | 5B28F7FC1A9DEA8E |
SHA1 | B7F52EED568A716A88F506C29CD7B46601E2D90C |
SHA256 | FC6162DFA366F5052263BFBF341C79D11112204164D6B69794E202B9D5A41D7A |
Then extract the contents of cups-drivers-x64.zip
to /usr/share/cups/drivers
.
Find the following files in the Windows driver for your printer (check C:\Windows\System32\spool\drivers\x64\3
if you have the driver installed locally):
- ps5ui.dll
- pscript.hlp
- pscript.ntf
- pscript5.dll
If the Windows driver files contain any uppercase characters, rename them so that they are all-lowercase. Copy these files to /usr/share/cups/drivers
.
sudo chown -R root /usr/share/cups/drivers
sudo cupsaddsmb -U root -a -v
Use the root
user password you set when running smbpasswd
above.
You should now be able to set up the printer from any Windows machine on the network.