Jump to content

GSTN - Cups documentation: Difference between revisions

From TetraWiki
Praveen (talk | contribs)
No edit summary
Praveen (talk | contribs)
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 4: Line 4:




<div style="color:#00000a;"></div>


<div style="color:#00000a;"></div>


<div style="color:#00000a;"></div>


<div style="color:#00000a;"></div>


<div style="color:#00000a;"></div>


<div style="color:#00000a;"></div>


<div style="color:#00000a;"></div>


<div style="color:#00000a;"></div>


Samba AD
CUPS (Common Unix Printing System)
As is Build for Domain Controller installation
Date : 08.08.2016
Document Version : 1.0


Installation and configuration for CUPS


Table of Contents
Date : 25.08.2016
1.Setup a Samba Active Directory Domain Controller 4
1.1.Configure yum repository for Packages installation. 4
1.2.Assign the Ipv4 address and restart the network services. 5
1.3.Assign the Ipv6 address and restart the network services. And set hostname. 6
1.4.Edit /etc/hosts file and make below entries. 7
1.5.Restart network service. 8
1.6.Reboot server. 9
1.7.Install Dependencies for samba installation. 9
1.8.Dependencies Installation is completed. 10
2.Samba Installation 11
2.1.Download samba file from https://www.samba.org/ and extract it. 11
2.2.Enter in samba-4.4.4 directory and run configure command. 11
2.3.Run make command. 13
2.4.Run make install command. 14
2.5.Provision a new domain: 14
2.6.Provisioning completed successfully. 15
3.Initialisation 16
3.1.Samba doesn't yet have init scripts included 16
3.2.Set the permissions on samba4 file. 19
3.3.Restart samba 19
3.4.Run "smbclient" 20
3.5.Open /etc/named.conf file. 21
3.6.DNS keytab 22
3.7.Also make below entry in named.conf 22
3.8.Change the owner ship as below and restart named services. 23
3.9.Copy Kerberos 23


Document Version : 1.0
1. Setup a Samba Active Directory Domain Controller
1.1. Configure yum repository for Packages installation.
Edit /etc/yum.repos.d/local.repo
# vi /etc/yum.repos.d/local.repo




Make below entries. Save file and exit.
[local]


name=local


baseurl=file:///mnt


gpgcheck=0


enabled=1
Table of Contents:[[#RefHeading3061179521510|Configure CUPS Printing3]]


:[[#RefHeading3091179521510|CUPS Web interface (Adding printers).6]]


:[[#RefHeading96093905196|Testing printer (Print test page).9]]


:[[#RefHeading96293905196|CUPS Integration with Samba.11]]


1.2. Assign the Ipv4 address and restart the network services.
== Configure CUPS Printing ==
# nmcli connection modify eth0 ipv4.addresses 172.18.101.14/24 ipv4.method manual ipv4.gateway 172.18.101.1 connection.autoconnect yes ipv4.dns 172.18.101.14
# systemctl restart network.service


1. Login to server, using root user and install CUPS.


''<nowiki># yum install cups*</nowiki>''


1.3. Assign the Ipv6 address and restart the network services. And set hostname.
# nmcli connection modify eth0 ipv6.addresses 2404:a800:1000:d:7800::e/69 ipv6.method manual ipv6.gateway 2404:a800:1000:d:7800::1 connection.autoconnect yes ipv6.dns 2404:a800:1000:d:7800::e


# hostnamectl set-hostname gd9103.gstn.local
[[Image:GSTNCUPS1.png]]




1.4. Edit /etc/hosts file and make below entries.
2. Edit cupsd.conf file.
# vi /etc/hosts
172.18.101.14 gd9103.gstn.local gd9103


''<nowiki># vi /etc/cups/cupsd.conf</nowiki>''


2404:a800:1000:d:7800::e gd9103.gstn.local gd9103






[[Image:GSTNCUPS2.png]]


1.5. Restart network service.
# systemctl restart network.service






1.6. Reboot server.
# init 6




1.7. Install Dependencies for samba installation.
3. Make below entries and save file.


# yum install perl gcc attr libacl-devel libblkid-devel gnutls-devel readline-devel python-devel gdb pkgconfig krb5-workstation zlib-devel setroubleshoot-server libaio-devel setroubleshoot-plugins policycoreutils-python libsemanage-python perl-ExtUtils-MakeMaker perl-Parse-Yapp perl-Test-Base popt-devel libxml2-devel libattr-devel keyutils-libs-devel cups-devel bind-utils libxslt docbook-style-xsl openldap-devel autoconf python-crypto pam-devel


''MaxLogSize 1m''


1.8. Dependencies Installation is completed.
''LogLevel debug''


''<nowiki># Allow remote access</nowiki>''


''Listen localhost:631''


''Listen 172.18.101.14:631''


2. Samba Installation
''Listen 2404:a800:1000:d:7800::e:631''
2.1. Download samba file from https://www.samba.org/ and extract it.
# tar xvzf samba-4.4.4.tar.gz


''Listen /var/run/cups/cups.sock''


2.2. Enter in samba-4.4.4 directory and run configure command.
''Browsing On''


# cd samba-4.4.4/
''BrowseLocalProtocols dnssd''
# ./configure


''DefaultAuthType Basic''


''WebInterface Yes''


Now configure done successfully.
''<Location />''


<div style="color:#00000a;">''<nowiki># Allow remote administration...</nowiki>''</div>


<div style="color:#00000a;">''Order allow,deny''</div>


<div style="color:#00000a;">''Allow localhost''</div>


2.3. Run make command.
<div style="color:#00000a;">''Allow 172.18.5.0/24''</div>
# make


''</Location>''


Make command finished successfully.
''<Location /admin>''


<div style="color:#00000a;">''<nowiki># Allow remote administration...</nowiki>''</div>


<div style="color:#00000a;">''Order allow,deny''</div>


2.4. Run make install command.
<div style="color:#00000a;">''Allow localhost''</div>
# make install


<div style="color:#00000a;">''Allow 172.18.5.0/24''</div>


2.5. Provision a new domain:
''</Location>''


# /usr/local/samba/bin/samba-tool domain provision --use-rfc2307 --interactive
''<Location /admin/conf>''


<div style="color:#00000a;">''AuthType Default''</div>


2.6. Provisioning completed successfully.
<div style="color:#00000a;">''Require user @SYSTEM''</div>


<div style="color:#00000a;">''<nowiki># Allow remote access to the configuration files...</nowiki>''</div>


<div style="color:#00000a;">''Order allow,deny''</div>


3. Initialisation
<div style="color:#00000a;">''Allow localhost''</div>
3.1. Samba doesn't yet have init scripts included
1. we can copy script from below link. https://wiki.samba.org/index.php/Samba4/InitScript
2. create a file /etc/rc.d/init.d/samba4


# vi /etc/rc.d/init.d/samba4
<div style="color:#00000a;">''Allow 172.18.5.0/24''</div>


and paste the below content in this file.
________________________________
#! /bin/bash
#
# samba4 Bring up/down samba4 service
#
# chkconfig: - 90 10
# description: Activates/Deactivates all samba4 interfaces configured to \
# start at boot time.
#
### BEGIN INIT INFO
# Provides:
# Should-Start:
# Short-Description: Bring up/down samba4
# Description: Bring up/down samba4
### END INIT INFO
# Source function library.
. /etc/init.d/functions
if [ -f /etc/sysconfig/samba4 ]; then
. /etc/sysconfig/samba4
fi
CWD=$(pwd)
prog="samba4"
start() {
# Attach irda device
echo -n $"Starting $prog: "
/usr/local/samba/sbin/samba
sleep 2
if ps ax | grep -v "grep" | grep -q /samba/sbin/samba ; then success $"samba4 startup"; else failure $"samba4 startup"; fi
echo
}
stop() {
# Stop service.
echo -n $"Shutting down $prog: "
killall samba
sleep 2
if ps ax | grep -v "grep" | grep -q /samba/sbin/samba ; then failure $"samba4 shutdown"; else success $"samba4 shutdown"; fi
echo
}
status() {
/usr/local/samba/sbin/samba --show-build
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status irattach
;;
restart|reload)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
______________________________________________________________________________




Line 238: Line 150:




3.2. Set the permissions on samba4 file.
# chmod 755 /etc/rc.d/init.d/samba4
# chmod +x /etc/rc.d/init.d/samba4
# ln -s /etc/rc.d/init.d/samba4 /etc/rc3.d/S80samba4
# chkconfig --add samba4
# chkconfig samba4 on




3.3. Restart samba
# service samba4 restart
  or  systemctl start samba4.service






3.4. Run "smbclient"
This is done to check if Samba provides the AD DC default shares "netlogon" and "sysvol", that were created in  "smb.conf" during provisioning.


# /usr/local/samba/bin/smbclient -L localhost -U%




3.5. Open /etc/named.conf file.


# vi /etc/named.conf
[[Image:GSTNCUPS3.png]]


4. Restart cups service.


3.6. DNS keytab
''<nowiki># systemctl restart cups.service </nowiki>''
This file was automatically created during provisioning/updating. Add the following' tkey-gssapi-keytab' option to the 'options' section of your named.conf, and set other values as shown in screen shot.


tkey-gssapi-keytab "/usr/local/samba/private/dns.keytab";


<div style="color:#00000a;">[[Image:GSTNCUPS4.png]]</div>




3.7. Also make below entry in named.conf
<div style="color:#00000a;"></div>


include "/usr/local/samba/private/named.conf";
<div style="color:#00000a;"></div>


<div style="color:#00000a;"></div>


3.8. Change the owner ship as below and restart named services.
<div style="color:#00000a;"></div>
# chown named.named /var/named/
# chgrp named /usr/local/samba/private/dns.keytab
# chmod g+r /usr/local/samba/private/dns.keytab
# systemctl enable named.service
# systemctl restart named.service
3.9. Copy Kerberos
file /usr/local/samba/private/krb5.conf to /etc/krb5.conf
# cp /etc/krb5.conf /etc/krb5.conf.ori


# cp /usr/local/samba/private/krb5.conf /etc/krb5.conf
<div style="color:#00000a;"></div>
 
== CUPS Web interface (Adding printers). ==
 
<div style="color:#00000a;">1. Now open the web browser and open link <span style="color:#3333ff;">''https://172.18.101.14:631</span>.''</div>
 
From here we can add and manage printers. to add a new printer click '''''“Administration”'''''.
 
[[Image:GSTNCUPS5.png]]
 
<div style="color:#00000a;">2. Click and “'''''Add Printer”''''' and type root username and password of the cups server:</div>
 
 
[[Image:GSTNCUPS6.png]]
 
 
<div style="color:#00000a;"></div>
 
<div style="color:#00000a;">3. Select '''“''AppSocket/HP JetDirect''”''' (here i have Hp Laserjet Pro m202dw printers) and click '''''Continue''. '''</div>
 
 
[[Image:GSTNCUPS7.png]]
 
<div style="color:#00000a;">4. In connection tab type the '''''ipp://172.18.5.67:631/ipp''''' (172.18.5.67 is printer IP) and click ''Continue''.</div>
 
 
[[Image:GSTNCUPS8.png]]
 
 
 
 
<div style="color:#00000a;">5. Fill the required information and click on “'''''Share This Printer''''' “ and click on “'''''Continue'''''”.</div>
 
[[Image:GSTNCUPS9.png]]
 
<div style="color:#00000a;">6. Select the '''“''Generic''”''' print driver and click on '''''“continue”'''''.</div>
 
[[Image:GSTNCUPS10.png]]
 
 
 
 
 
 
 
 
<div style="color:#00000a;">7. Select the model '''“''Generic PCL Laser Printer(en)''” '''and click on '''''“Add Printer”.'''''</div>
 
Now printer configuration has been done.
 
[[Image:GSTNCUPS11.png]]
 
== Testing printer (Print test page). ==
 
<div style="color:#00000a;">1. Click on ''“'''Printers'''” ''tab''. ''Here we can see the installed printers click on printer which we want to test.</div>
 
[[Image:GSTNCUPS12.png]]
 
 
<div style="color:#00000a;">2. Click on''''' “Maintenance” '''''and select “'''''Print Test Page'''''”.</div>
 
[[Image:GSTNCUPS13.png]]
 
 
<div style="color:#00000a;">3. Page will say that “''Test page sent:''”</div>
 
 
[[Image:GSTNCUPS14.png]]
 
 
 
 
 
 
 
 
 
 
== CUPS Integration with Samba. ==
 
<div style="color:#00000a;">To integrate cups with samba we can follow below steps.</div>
 
<div style="color:#00000a;">1. Open “'''''/usr/local/samba/etc/smb.conf'''''” file.</div>
 
''<nowiki># vi /usr/local/samba/etc/smb.conf</nowiki>''
 
[[Image:GSTNCUPS15.png]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<div style="color:#00000a;">2. Make below entry in '''''smb.conf''''' file in Global section.</div>
 
<div style="color:#00000a;">''rpc_server:spoolss = external''</div>
 
<div style="color:#00000a;">''rpc_daemon:spoolssd = fork''</div>
 
<div style="color:#00000a;">''spoolss: architecture = Windows x64''</div>
 
 
[[Image:GSTNCUPS16.png]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<div style="color:#00000a;"></div>
 
<div style="color:#00000a;">3. Create the Samba spool directory and set permission. </div>
 
''<nowiki># mkdir -p /var/spool/samba4/ ; chmod 1777 /var/spool/samba4/</nowiki>''
 
 
[[Image:GSTNCUPS17.png]]
 
 
<div style="color:#00000a;">4. Open again '''''/usr/local/samba/etc/smb.conf '''''file and make below entries.</div>
 
 
''[ProLaserJet]''
 
<div style="color:#00000a;">''comment = ProLaserJet''</div>
 
<div style="color:#00000a;">''path = /var/spool/samba4/''</div>
 
<div style="color:#00000a;">''browseable = yes''</div>
 
<div style="color:#00000a;">''printable = yes''</div>
 
<div style="color:#00000a;">''printer name = ProLaserJet''</div>
 
 
''[ProLaserJet2]''
 
<div style="color:#00000a;">''comment = ProLaserJet2''</div>
 
<div style="color:#00000a;">''path = /var/spool/samba4/''</div>
 
<div style="color:#00000a;">''browseable = yes''</div>
 
<div style="color:#00000a;">''printable = yes''</div>
 
<div style="color:#00000a;">''printer name = ProLaserJet2''</div>
 
 
[[Image:GSTNCUPS18.png]]
 
 
<div style="color:#00000a;"></div>
 
<div style="color:#00000a;"></div>
 
<div style="color:#00000a;"></div>
 
<div style="color:#00000a;"></div>
 
<div style="color:#00000a;"></div>
 
<div style="color:#00000a;"></div>
 
<div style="color:#00000a;">5. Restart samba service.</div>
 
<div style="color:#00000a;">''<nowiki># systemctl stop samba4.service</nowiki>'' </div>
 
[[Image:GSTNCUPS19.png]]
 
 
 
 
<div style="color:#00000a;">''<nowiki># systemctl start samba4.service</nowiki>'' </div>
 
 
[[Image:GSTNCUPS20.png]]

Latest revision as of 05:33, 1 February 2019



CUPS (Common Unix Printing System)

Installation and configuration for CUPS

Date : 25.08.2016

Document Version : 1.0




Table of Contents:Configure CUPS Printing3

:CUPS Web interface (Adding printers).6

:Testing printer (Print test page).9

:CUPS Integration with Samba.11

== Configure CUPS Printing ==

1. Login to server, using root user and install CUPS.

# yum install cups*



2. Edit cupsd.conf file.

# vi /etc/cups/cupsd.conf






3. Make below entries and save file.


MaxLogSize 1m

LogLevel debug

# Allow remote access

Listen localhost:631

Listen 172.18.101.14:631

Listen 2404:a800:1000:d:7800::e:631

Listen /var/run/cups/cups.sock

Browsing On

BrowseLocalProtocols dnssd

DefaultAuthType Basic

WebInterface Yes

<Location />

# Allow remote administration...
Order allow,deny
Allow localhost
Allow 172.18.5.0/24

</Location>

<Location /admin>

# Allow remote administration...
Order allow,deny
Allow localhost
Allow 172.18.5.0/24

</Location>

<Location /admin/conf>

AuthType Default
Require user @SYSTEM
# Allow remote access to the configuration files...
Order allow,deny
Allow localhost
Allow 172.18.5.0/24

















4. Restart cups service.

# systemctl restart cups.service



== CUPS Web interface (Adding printers). ==

1. Now open the web browser and open link https://172.18.101.14:631.

From here we can add and manage printers. to add a new printer click “Administration”.

2. Click and “Add Printer” and type root username and password of the cups server:



3. Select AppSocket/HP JetDirect (here i have Hp Laserjet Pro m202dw printers) and click Continue.


4. In connection tab type the ipp://172.18.5.67:631/ipp (172.18.5.67 is printer IP) and click Continue.




5. Fill the required information and click on “Share This Printer “ and click on “Continue”.

6. Select the Generic print driver and click on “continue”.





7. Select the model Generic PCL Laser Printer(en)and click on “Add Printer”.

Now printer configuration has been done.

== Testing printer (Print test page). ==

1. Click on Printerstab. Here we can see the installed printers click on printer which we want to test.


2. Click on “Maintenance” and select “Print Test Page”.


3. Page will say that “Test page sent:







== CUPS Integration with Samba. ==

To integrate cups with samba we can follow below steps.
1. Open “/usr/local/samba/etc/smb.conf” file.

# vi /usr/local/samba/etc/smb.conf









2. Make below entry in smb.conf file in Global section.
rpc_server:spoolss = external
rpc_daemon:spoolssd = fork
spoolss: architecture = Windows x64









3. Create the Samba spool directory and set permission.

# mkdir -p /var/spool/samba4/ ; chmod 1777 /var/spool/samba4/



4. Open again /usr/local/samba/etc/smb.conf file and make below entries.


[ProLaserJet]

comment = ProLaserJet
path = /var/spool/samba4/
browseable = yes
printable = yes
printer name = ProLaserJet


[ProLaserJet2]

comment = ProLaserJet2
path = /var/spool/samba4/
browseable = yes
printable = yes
printer name = ProLaserJet2



5. Restart samba service.
# systemctl stop samba4.service



# systemctl start samba4.service