====== Printer Setup Using Cups ======
Following is an explanation of how to set up a Printer. In this example a Brother HL-6050D printer was used.
==== Things You Need ====
You need Tinycore installed on the computer.
You need a printer.
You need an internet browser installed in Tinycore.
You need an internet connection to install cups and download the printer driver (some printers may have Linux drivers on a CD).
If you want to make a new extension for your printer setup, which is recommended, the squashfs-tools-4.0 extension needs to be installed.
==== Install Cups and Set it Up to Start Automatically ====
Install cups using the App Browser. It needs to be in OnBoot, which is the default when installing applications. If you have already installed cups, and it is not in OnBoot, put it in OnBoot using Apps Audit.
Some printers require additional extensions loaded to operate with cups. A list of these printers and the extensions required is [[wiki:printers_requiring_additional_extensions_with_cups|here]]
So that Cups starts automatically each time Tinycore is started, add
sudo /usr/local/etc/init.d/cups start
to /opt/bootlocal.sh.
If you don't have persistent /opt, to save settings, you must Backup when shutting down Tinycore.
After restarting the computer, you can check if cups is running by opening the terminal and typing
/usr/local/etc/init.d/cups status
==== Download the Printer Driver ====
Download the driver for the make and model of the printer from http://openprinting.org/printers
If you can't find the driver for your printer at http://openprinting.org/printers see if it is at the printer manufacturers website. If you can't find it there, do an internet search to find it.
There may be two different files containing the printer driver, a ".deb" file and an ".rpm" file. You may use either.
==== Extract the Printer Driver ====
If you are using the .deb file, open the terminal and type
cd /directory/containing/printer/driver
ar vx printerdriver.deb
tar -xzvf data.tar.gz
Replace printerdriver.deb with the actual name of the printer driver.
Another option is to use
cd /directory/containing/printer/driver
ar p printerdriver.deb data.tar.gz | tar xz
If you are using the .rpm file, open the terminal and type
cd /directory/containing/printer/driver
rpm2cpio printerdriver.rpm | cpio -vid
Replace printerdriver.rpm with the actual name of the printer driver.
==== Connect the Printer and Restart the Computer ====
Before setting up the printer, you need to restart the computer, so cups is running.
If not already connected, connect the printer to the computer, and turn it on, before restarting the computer.
==== Root Password ====
If you don't already have a root password, set one up. To do this, open the terminal and type
sudo passwd
Enter the root password when prompted. You need to enter it twice.
The password will not be saved when the computer is turned off. You don't need to save it.
If you want to save the password when the computer is turned off, see [[passwd|Tinycore Passwords]].
==== Copy the Printer Driver to the File System ====
Using a File Manager, go to where you extracted the printer driver. You should see a directory /opt. Go to /opt. Copy and paste everything in /opt, to the /opt directory in the filesystem.
==== Set Up the Printer ====
Start the Internet Browser.
Where you see the web site address in the web browser, normally in the middle near the top, starting with "http://," type:
http://localhost:631
Press "Enter."
You will see a new window. Click "Adding Printers and Classes."
You will see a new window. Click "Add Printer."
You will need to enter the user name and password. The user name is root. The password is the one you set up earlier.
You will see a new window. Select your printer. Click "Continue."
Note: If the printer is connected to a USB port, Cups will automatically detect it. Older printers may not be automatically detected.
You will see a new window. Click "Choose..." or "Browse..." (depending on which web browser you are using). You will see a new window. Go to the location of the printer driver and click on the driver for your make and model of printer. The Brother driver is in /opt/OpenPrinting-Brother/ppds/Brother/, with drivers for other brother printers. Click "Add Printer." With the Brother HL-6050D printer, I was asked for the number of trays, and whether CF(RAMDISK) is installed. You may be asked other things for other printers. Click "Set Default Options."
The printer should work now. You may print a test page.
==== Save Settings ====
At this stage, when the computer is turned off, the settings will be lost. Following are two different methods to save settings.
==== Method 1: Save Settings in Backup ====
To save settings in backup, add the following lines to /opt/.filetool.lst.
usr/local/etc/cups/printers.conf
usr/local/etc/cups/ppd/yourprinter.ppd
Change yourprinter.ppd to the actual name of the printer ppd file.
In some situations there may also be other files which need to be saved. Have a look in /usr/local/etc/cups for any other files which were added or modified at the date and time you set up the printer. If there are others, also include them.
To save settings, you must Backup when shutting down Tinycore.
==== Method 2: Make an Extension for the Printer ====
As more files are added to backup, it takes longer. If you make extensions for things which don't need to be in backup, it will be a little quicker.
Begin by creating directories. Open the Root Terminal and type:
mkdir -p /home/tc/myext/printer/usr/local/etc/cups/ppd
Copy and paste files.
cp -p /usr/local/etc/cups/printers.conf /home/tc/myext/printer/usr/local/etc/cups/
cp -p /usr/local/etc/cups/ppd/* /home/tc/myext/printer/usr/local/etc/cups/ppd/
In some situations there may also be other files which need to be saved. Have a look in /usr/local/etc/cups for any other files which were added or modified at the date and time you set up the printer. If there are others, also include them.
==== Make an Extension ====
To make a extension called "myprinter.tcz," open the Terminal, and type:
sudo su
cd /home/tc/myext
mksquashfs printer/ myprinter.tcz
==== Copy to TCE Folder ====
Copy and paste the new extension to the /tce/optional directory.
Put the new extension in OnBoot using Apps Audit.
Keep a copy of your new extension somewhere else. If you update extensions, it may be deleted.