Previous Page | Next Page

  1. Introduction
  2. About Linux
  3. Installation and getting started
  4. Logging in and out
  5. Basic Linux Commands
  6. Linux Files and File Permissions
  7. Linux Directory Structure
  8. Finding Files
  9. Linux Help
  10. Setting Time
  11. Devices
  12. Tips
  13. Accessing Other Filesystems
  14. Accessing Removable Media
  15. Making and Managing Filesystems
  16. Emergency Filesystems and Procedures
  17. LILO and Runlevels
  18. Init
  19. Environment, Shell Selection, and Startu
  20. Linux Kernel
  21. Package Installation and Printing
  22. Configuration, Logging and CRON
  23. Keys and Terminal Configuration
  24. Sound Configuration
  25. Managing Users
  26. Passwords
  27. Process Control
  28. Configuration and Diagnostic Tools
  29. Overall Configuration
  30. Using PAM
  31. Basic Network Setup
  32. Tools and Terms
  33. Novell and Printing
  34. Inetd Services
  35. Xinetd Services
  36. Other Network Services
  37. FTP and Telnet
  38. Samba
  39. Identd (auth)
  40. X Configuration
  41. X Use
  42. Using X Remotely
  43. X Documentation
  44. DNS
  45. DHCP and BOOTP
  46. Apache
  47. NFS
  48. PPP
  49. Mail
  50. Routing
  51. IP Masquerading
  52. Proxy Servers and ipchains
  53. UUCP
  54. News
  55. NIS
  56. Network Security
  57. Secure Shell
  58. Text Processing
  59. Shell Programming
  60. Emacs
  61. VI
  62. Recommended Reading
  63. Credits

Linux Package Installation and Printing

Generally, a large part of Linux consists of the packages you load on your system. These packages may be for various specific purposes such as adding shadow passwords, adding a secure telnet client, adding some type of network service, or perhaps upgrading the Apache web server. Whatever the reason, you will need to find the appropriate package on the web, download it, compile it, and install it. The package will come with instructions on how to do this. Some are easy to install, others may be complicated. This section gives general instructions commonly found and required when installing many packages. Please be aware, however, that there may be differences between these instructions and those that come with your package. You should read the instructions that come with your package.

Package installations

tar.gz source package general instructions

  1. Read the install documentation associated with the installation
  2. Put the packed file in the directory you want it to be installed under.
  3. Examine the package with the command "tar tvzpf <packagename>.tar.gz" to see where it will install.
  4. Unpack the tar.gz file in one step with "tar xvzpf <packagename>.tar.gz or in two steps with "gunzip <packagename>.tar.gz" and "tar xpf <packagename>.tar" It will create a directory like "packagename-2.3.4" and place the extracted information here.
  5. Typically the following outlines the rest of the steps but they will vary from package to package. Go into the created subdirectory and type "./configure".
  6. Type "make all" or "./make"
  7. Type "make install" or "./make install"

Installing Redhat Packages

rpm -helpTo get help
rpm -q mypack-1.0.1.rpm Queries the database of installed packages to see if this package is installed or what version of it is installed.
rpm -ivh mypack-1.0-1.rpmInstalls mypack.
rpm -uvh mypack-2.0-1.rpmUpgrades mypack.
rpm -qip mypack-1.2.2.rpmTo query with details about the package.
rpm -qlp mypack-1.2.2.rpmGives a list of files this package installs.
rpm -e mypack-1.2.2Removes the package mypack-1.2.2.

Typically RPM packages come with binary files ready for installation so all you need to do is the install as in the line above. The compilation which is the last three steps in the tar example in the first section above don't need to be done. If you get a source file rather than a binary file, you will need to do a compile of code and an installation. If you just do the binary installation, be sure you get the package from a reliable source so you don't get lovely extras like trap doors, trojans, or viruses.

Setting Linux Print Spooling

Printing is supported by "lpd" the line printer spooler daemon, which you should activate to support print services. Once print services are setup, type "lpr ?s -Pprinter filename" where "printer" is the name of your printer (the default is lp). The '-s' option tells lpr to use symbolic links to print the file rather than copying it to its own spool file. If the '-P' option is left out, the default printer name will be assumed.

Print spooling can be set up easily in Redhat using the "printtool" configuration tool following the following steps:

  1. Type "startx" to enter an x windows session.
  2. Open a terminal under x windows
  3. Type "printtool" in the terminal and CR.
  4. Edit or add a printer. Note that lp is the default printer for the lpd daemon.
  5. You can make the name of the printer anything you want. Note: lp is default.
  6. The spool directory should be "var/spool/printername"
  7. The printer server name should be the name of the server computer that the printer is attached to. Example PRT_SRV1
  8. The print queue name is the name of the printer as the printer server computer perceives it. Example: HP_LASER1.
  9. Depending on the network and how the printer resource is shared you may or may not need a user name and password.

How it works:

  1. Note the file "/etc/printcap" defines what filter script file will be used to output the printfile. Type "man lpd" and "man printcap" for more information.
  2. The filter script gets its input from standard input sometimes using such commands as "cat -", see the cat man page. It also uses "file -" to get a description of the input.
  3. On netware print servers, you must be logged on before it will work. I use the scripts from the section on "Network printing setup and use" to logon and type "neton username".

Other useful commands for printing:

lpr - Prints a file to default lp printer
lpq - shows files to print in the print que
lpc - Line printer control program. Type "lpc status" to see status on all printers. This command can enable or disable printing or queuing.
lprm - Remove a job from the print queue using number reported by lpq. Ex: lprm 14
tunelp - A utility to optimize the printer. "tunelp /dev/lp -q" will display the IRQ for the device

The directory /var/spool/lpd contains a directory for every printer. This is where the print files are spooled.

To set up a printer on a parallel or serial port:
A printer on the first parallel port is probably /dev/lp0 or /dev/lp1.
To test the printer type "lptest > /dev/lp1" to send test output directly to the printer. If the printer is a postscript printer you need to send it a postscript file by typing "cat test.ps > /dev/lp1". The lptest program is a utility made to test a printer.
If the printer is serial, output is directed to /dev/ttyS0 or /dev/ttyS1.

The /etc/printcap file:
The printcap file begins a comment line with #
Example:

ljet4|lp|ps|Postscript|600dpi 20MB memory|end of hall|local|LPT1:\
:lp=dev/lp0:rw:\
:sd=/var/spool/lpd/ljet4:mx#0:mc#0:pl#72:pw#85:\
:lf=/var/log/lpd-errs:if=/usr/local/cap/ljet4:

On the first line (virtual), the names of the printer are shown with each name separated by '|'.
Commands include:

  • The lp line is the device name for output (local printer).
  • rw is specified if the printer can send data back to the host through the device file. A network printer uses /dev/null.
  • mx - Sets the maximum size of a print job.
  • pl - page length.
  • pw - page width.
  • The sd line is the subdirectory the files are spooled in
  • The if line tells the input filter to use
  • br-baud rate for a serial port
  • sh-suppress header
  • rp-remote printer
  • rm-remote host that controls remote printer
  • rs- restrict access to local printers to users with an account
  • rg-restricted group that can use the printer