Exercise: Create a Persistent Virtual IPP Printer
Using a systemd User Service
1 Purpose
To properly simulate a modern network printer, we need a virtual device that is always running in the background. In this exercise, you will create a persistent, driverless IPP printer by setting it up as a systemd user service. This is a real-world administration task that ensures your virtual printer starts automatically when you log in, without needing a dedicated terminal window. This robust setup will serve as the foundation for all subsequent exercises.
2 What You’ll Accomplish
By the end of this exercise, you will be able to:
- Install the
cups-printerapppackage containing theippeveprintertool. - Create a dedicated output directory for printed files.
- Write and configure a
systemd --userservice file. - Enable and start a persistent user service that runs on login.
- Verify that the virtual printer service is running correctly.
This exercise maps to the following program and course learning outcomes:
- Course Learning Outcomes (CLOs):
- 1. Identify hardware and basic network components: This exercise simulates a modern network peripheral (IPP Printer) and uses system software to ensure its persistence.
- 3. Troubleshoot hardware and basic network components: Managing and checking the status of system services is a fundamental troubleshooting skill for any network-attached device.
This exercise develops the following skills, which align with the O*NET SOC Code 15-1232.00 for Computer User Support Specialists.
| Learning Objective | O*NET KSAs | Technologies Used |
|---|---|---|
| Create and manage a systemd user service. | Knowledge: Computers & Electronics, Operating Systems Skills: Installation, Systems Analysis |
systemd, ippeveprinter, dnf |
3 Prerequisites
This exercise requires a running Fedora 43 virtual machine with sudo privileges and an internet connection.
4 Step-by-Step Guide
4.1 Step 1: Install the Prerequisite Package
The ippeveprinter utility is part of the cups-printerapp package, which is not installed by default.
Open a terminal window.
Run the following command to install the package:
sudo dnf install -y cups-printerapp
4.2 Step 2: Create the Output Directory
This is the folder where your virtual printer will save its “printed” PDF files. Creating it in your home directory makes it easy to access.
In your terminal, run the following command:
mkdir -p ~/PrinterOutput4.3 Step 3: Create the systemd User Service File
You will now define the service. systemd user services are stored in ~/.config/systemd/user/.
First, ensure the directory exists:
mkdir -p ~/.config/systemd/userNext, create a new service file named
ipp-virtual-printer.serviceusing a text editor likenano.nano ~/.config/systemd/user/ipp-virtual-printer.serviceCopy and paste the entire block of text below into the
nanoeditor.[Unit] Description=IPP Everywhere Virtual Printer (Test-IPP-Printer) After=network.target [Service] ExecStart=/usr/bin/ippeveprinter --port 8631 --directory %h/PrinterOutput --format application/pdf --keep-files "Test-IPP-Printer" Restart=always [Install] WantedBy=default.targetSave the file and exit the editor (in
nano, pressCtrl+X, thenY, thenEnter).
4.4 Step 4: Understanding the Service File
Let’s break down the key commands in the service file you just created.
[Unit]Section:Description: A human-readable name for the service.After=network.target: Ensures the service only starts after the network is up.
[Service]Section:ExecStart: The exact command the service will run.--port 8631: Sets a fixed, predictable port for the printer.--directory %h/PrinterOutput: Sets the output directory.%his asystemdvariable that automatically points to your home directory.--format application/pdf: Restricts the printer to accepting and producing PDF files.--keep-files: Crucially, this tells the printer not to delete the output file after printing."Test-IPP-Printer": The broadcast name of your new virtual printer.
Restart=always: A robustness feature that automatically restarts the service if it ever fails.
[Install]Section:WantedBy=default.target: This hooks the service into the standard user login process, ensuring it starts automatically.
4.5 Step 5: Enable and Start the Service
Now, tell systemd to recognize and run your new service. Because this is a --user service, sudo is not needed.
Reload the
systemduser daemon to make it aware of the new file:systemctl --user daemon-reloadEnable the service to start on every login and start it right now:
systemctl --user enable --now ipp-virtual-printer.service
4.6 Step 6: Verify the Service is Running
Check the status to ensure it started correctly.
systemctl --user status ipp-virtual-printer.serviceYou should see active (running) in green in the output. If you see an error, double-check your service file for typos. Your persistent virtual printer is now running and will be automatically discovered by CUPS.
5 Reflect and Review
Now that you have completed this exercise, reflect on your experience in your personal notes:
- 3 arguments you used in the
ExecStartline forippeveprinter. - 2
systemctlcommands you used with the--userflag. - 1 reason why using a fixed port (
8631) is beneficial for this setup.
Answer these questions in your notes to solidify your understanding:
- What is the purpose of creating a
systemd --userservice instead of just running the command in a terminal? - In the service file, what does the
%hvariable represent? Why is it useful? - What command must you run after creating or editing a service file to make
systemdaware of the changes? - How can you check if your new user service is running correctly?
- Which
ippeveprinterflag ensures that your printed PDF files are not deleted?