element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi Projects
  • Products
  • Raspberry Pi
  • Raspberry Pi Projects
  • More
  • Cancel
Raspberry Pi Projects
Blog Use a Raspberry PI Zero W as a Wireless Print Server - Jetdirect now - Port 9100 - Raw queue
  • Blog
  • Documents
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: feiticeir0
  • Date Created: 16 Jan 2023 10:04 AM Date Created
  • Views 3180 views
  • Likes 10 likes
  • Comments 5 comments
  • turn a raspberry pi into a shared printer
  • share a printer with a raspberry pi w with wifi
  • raspberry pi shared printer
  • turn a raspberry pi into a jet direct printer
  • rpi raw 9100 printer
  • raspberry pi zero 2 w
  • rpi w
  • share a printer through wifi with a raspberry pi
  • turn a printer into a shared printer with wifi
  • raspberry pi raw 9100 printer
  • rpi 2 w
  • raspberry pi printer
  • raspberry pi jetdirect printer
  • raspberry pi xinetd
  • Raspberry pi jet direct printer
  • rpi jetdirect printer
Related
Recommended

Use a Raspberry PI Zero W as a Wireless Print Server - Jetdirect now - Port 9100 - Raw queue

feiticeir0
feiticeir0
16 Jan 2023

Hi all.

This is an updated version of my previous blog post - Use a Raspberry PI Zero W as a Wireless Print Server

One problem of old printers is that they don't have network connectivity and or can't be shares with more users - unless the computer where they are connected shares them.

This way, we can add the printer to any Operating System using the 9100 port - just like jet direct.

It uses the xinetd super-server daemon to open the 9100 port

Hardware

There's only a few requirements needed with a Raspberry PI Zero W (or Zero 2 W or any other model)

  • USB OTG cable - to connect the printer
  • Printer with USB interface (so, not to old printers)
  • Power the RPI W with a power adapter, not a computer USB port
    • If the printer has a USB port, you can power it from that

STEPS

There are the steps we're going to take - simple and few

  1. We're going to install Raspbian OS Lite
  2. Configure CUPS and install a printer

Each step is easy and the configurations are very straightforward and fast.

Raspberry PI

First, let's install the Raspberry PI Zero W .

A 8GB SD CARD is enough. I use the Raspberry PI Imager. It's fast and there's no need to download the img file. Also, it downloads the latest version available.

image

For this, the Raspberry PI OS Lite is enough. We don't need a graphical environment.

Let's choose it. Choose "Raspberry Pi OS (other)" and then "Raspberry PI OS Lite".

imageimage

Choose the SD CARD

image

Before Write, press the little cogwheel . We'll customize the installation. If we don't do this now, latter we need to connect the Raspberry PI to a monitor and keyboard to personalize the installation. The OS won't fully boot until some information is filled in . Better to do this now.

image

Set the hostname and importantly enable SSH or you'll still need to connect a monitor and keyboard (or just create an empty file named ssh on the boot partition).

image

Set the username and password, along with the WiFi details - if you're going to use WiFi

image

Finally, set the WiFi country (if you configured WiFi) and locale.

image

Save and press Write.

Software

After the PI boots and you know it's IP address, lets access it using ssh and update the software

Update

Let's update the software

sudo apt update
sudo apt upgrade -y

Reboot

 

After the reboot, let's install cups and xinetd

Install and Configure CUPS

Let's install cups

sudo apt install cups

First, let's configure CUPS to allow us to access the Web Interface and use the DNS name instead of just the IP address.

Note: Make a backup of the file first, just in case

sudo vi /etc/cups/cupsd.conf

We just need to comment two lines and add 3 new ones

Comment the following lines (just add a # at the beginning of the line):

#Listen localhost:631
#Listen /run/cups/cups.sock

and add

Listen 631

This will allow us to access CUPS web Interface from another computer.

Next, just before the first <Location /> tag, , add the following line:

 

ServerAlias *

This will allow us to also use DNS instead of just the IP address

 

Now, inside the <Location /> and <Location /admin> blocks, add the following line, just after Order allow, deny

Allow <your_computer_ip_address>

Or, if you want to loosen up a bit, you can use a network range or just all:

Allow 172.100.0.0/24

or

Allow All

 

This will stay like:

<Location />
    Order allow,deny
    Allow 10.11.23.1
</Location>


<Location /admin>
    Order allow,deny
    Allow 10.11.23.1
</Location>

where 10.11.23.1 is my IP address

 

lpadmin group

Let's add the PI user to the lpadmin group

sudo gpasswd -a pi lpadmin

Although gpasswd will require to login again for the changes to take effect, we don't need it because it will be the cups service that will get restarted and thus, we don't need the group in the current session . But feel free .

This will allow the pi user to add, remove and configure printers

 

Now, let's enable cups and start it (or restart it)

sudo systemctl enable cups
Synchronizing state of cups.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable cups

sudo systemctl start cups

Add a printer to cups

This is the normal procedure - add a printer to cups on any Linux, using the CUPS Web Interface.

 

Open your browser of choice and head to:

https://<your_pi_address/name>:631 and you will land at CUPS web

image

On CUPS Administration, press the "Add Printer" button

image

On the Printers list, we want the Local Printers - connected to USB. Choose the one you're connecting. In my case, a HP LajserJet 1022 - old, I know.

image

Fill in all the details. The name is specially important, since it's by it we will reach the printer. My advice is DO NOT USE SPACES.

Don't forget to tick the "Share This Printer" box.

image

Xinetd super-daemon

Let's now configure the xinetd to create a 9100 port and print anything that gets to it.

First edit the services file in /etc to add the 9100 port.

sudo vi /etc/services

This file contains "all" the network services and ports used.

add the following line to the end of the file

jetdirect <tab> <tab until aligned> 9100/tcp

save and quit

xinetd will look for any configuration files that are present at /etc/xinetd.d/ directory and load them .

Create a file in that directory. I'm going to call it jetdirect - the same name of the service above

sudo vi /etc/xinetd.d/jetdirect

Add the following lines:

# Jetdirect emulation
service jetdirect
{
        socket_type = stream
        protocol = tcp
        wait = no
        user = root
        # server = /usr/bin/lpr
        server = /usr/bin/lp
        server_args = -d HPLaserJet1022 -o raw
        groups = yes
        disable = no
}

Now, two lines you need to edit server and server_args

server can be lpr or lp . I have lp, so the argument to specify the printer name (in server_args) is -d . If you choose lpr, the argument is -P . Just change it according your preferences. Don't forget to change HPLaserJet1022 to your printer name.

server_args are the arguments you would normally pass to the lp command.

I also have -o raw . Just play with that option. If you're trying to print and see nothing or code, remove the -o raw argument and try again. Just play with it.

Let's enable the xinetd service and start it.

systemctl enable xinetd

It may give a warning saying it's not a native service.

image

After that, just restart it (it may already be started).

systemctl restart xinetd

That's it. Now we have a 9100 print queue on the Raspberry PI and can be added to a computer like a networked printer using RAW 9100.

Raspberry PI Zero 2 W RPI Zero 2 W

A nmap command:

image

References

https://tzlee.com/blog/2017/11/raspberry-pi-print-server-with-no-server-side-driver/

  • Sign in to reply
  • Former Member
    Former Member over 2 years ago in reply to feiticeir0

    Thanks for the concern, but I'm done with it.

    It was fun to mess around, but I really don't live in this world, just a visitor.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • feiticeir0
    feiticeir0 over 2 years ago in reply to Former Member

    Where's not listed ? In cups ?

    Have you tried to use a generic printer and see if it works ?

    Have you searched for a cups samsung driver ? What's your printer model ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 2 years ago

    I don't have a listed printer, therefore I can not make any of this work.

    I have a Samsung printer that is not listed.

    It was fun wasting 2+ hours f ing around with this.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • feiticeir0
    feiticeir0 over 2 years ago in reply to matthiku

    You are right. I forgot. Thank you.

    But xinetd is deprecated in favor of systemd services. I will update the post to use systemd instead of xinetd.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • matthiku
    matthiku over 2 years ago

    You forgot the command to install the xinetd package (it's not installed by default) -

    sudo apt install xinetd

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube