Install Cups(Common Unix Printing System) to configure network printer with commands.

Install cups(Common Unix Printing System)

[root@lynx /]#  yum -y install cups  

OR

rpm -ivh  cups-1.4.2-74.el6.x86_64.rpm

Configure Cups

[root@lynx /]# vim /etc/cups/cupsd.conf
MaxLogSize 2000000000

LogLevel info

SystemGroup sys root

# line 19: change

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

Browsing On
BrowseOrder allow,deny
BrowseAllow @LOCAL

DefaultAuthType Basic

# line 31: add access permition

<Location />
Order allow,deny

Allow 172.40.1.0/24
</Location>

# line 37: add access permition

<Location /admin>
Encryption Required
Order allow,deny

Allow 172.40.1.0/24
</Location>

# line 43: add access permition

<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny

Allow 172.40.1.0/24
</Location>

<Policy default>
# Job-related operations must be done by the owner or an administrator…
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>

# All administration operations require an administrator to authenticate…
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>

# All printer operations require a printer operator to authenticate…
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>

# Only the owner or an administrator can cancel or authenticate a job…
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>

<Limit All>
Order deny,allow
</Limit>
</Policy>
MaxJobs 9999

[root@lynx /]# /etc/rc.d/init.d/cups start
Starting cups:
[root@lynx /]# /etc/rc.d/init.d/cups status
cupsd (pid 22808) is running…
[root@lynx /]# chkconfig cups on
[root@lynx /]# chkconfig –list cups
cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@lynx /]#

installation and configuration finished.

Basic printer term

lpadmin:a command line tool used to configure printer and class queues provided by CUPS.

class: server default printer

lpinfo -v:list all the available ports or interfaces available to configure the printer

Adding a New Printer

Syntax:
lpadmin -p printer_info -v lpd://printer_name/printer_name
lpstat -v printer_info

Example:
Printer Name : prnbalcik
Location : Balcik Depo
Device : LPD
DeviceUrl : lpd://prnbalcik/prnbalcik

[root@lynx /]#vim /etc/cups/printers.conf

<Printer prnbalcik>
Info Yarimca sase barkod
Location Balcik Depo
DeviceURI lpd://prnbalcik/prnbalcik
State Idle
StateTime 1468408345
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</Printer> 

[root@lynx /]# lpstat -v prnbalcik
device for prnbalcik: lpd://prnbalcik/prnbalcik
[root@lynx /]#

OR

[root@lynx /]# lpadmin -p printer_info -v  lpd://prnbalcik/prnbalcik

[root@lynx /]# lpstat -v prnbalcik
device for prnbalcik: lpd://prnbalcik/prnbalcik

Remove printer

[root@lynx /]# lpadmin -x printer_info

OR  delete printer from configuration file.

[root@lynx /]#vim /etc/cups/printers.conf

Add Printer to a Class

[root@lynx /]#lpadmin -h printer_name -p printer_info -c myclass