Ceci est une ancienne révision du document !
Table des matières
Configurer un serveur d'impression pour une utilisation à domicile sur un vieux serveur Slackware
Après une mise à niveau récemment de mon réseau wifi de la maison pour utiliser WPA2, mon vieux serveur d'impression Edimax wifi a cessé de fonctionner en raison de l'incompatibilité avec WPA2. Je ne voulais pas avoir à laisser un ordinateur allumé tout le temps ni devoir me connecter directement à ce PC lorsque je dois imprimer à partir de l'imprimante elle-même.
La solution la plus élégante serait d'installer un dispositif ARM à faible consommation (fonctionnant naturellement sous Slackware ARM) pour devenir un serveur d'impression mais n'importe quel vieux matériel qui peut fonctionner sous Slackware Linux pourrait convenir. Et si vous souhaitez utiliser des distributions alternatives, je pense que tout matériel qui peut fonctionner sous Linux conviendra.
Je sais que ce est pas quelque chose de difficile mais la dernière fois que j'ai fais quelque chose comme ça, beaucoup de choses ont changé. Je pense que d'autres personnes pourraient bénéficier d'un guide de démarrage rapide pour le faire vite … donc voilà: (les étapes suivantes supposent que la mise en réseau a déjà été mis en place correctement par tous les participants).
Configurer l'Imprimante sur le Serveur d'Impression
La première chose à savoir est qu'il n'est pas obligatoire d'avoir le filtre d'impression correct pour l'imprimante sur le serveur d'impression. C'est le client qui s'en occupe. Le serveur d'impression a seulement besoin que l'imprimante soit configurée comme une imprimante brute (raw printer).
Le serveur d'impression aura besoin de cups, cyrus-sasl et les paquets openSSL (openSSL est un pré-requis si vous désirez administrer cups à distance). Si votre imprimante dispose d'une interface USB, comme la plupart aujourd'hui, il sera nécessaire d'avoir aussi ces paquets pour le module usblp du noyau: libusb, libusb-compat et usbutils. Une fois ces paquets installés, le périphérique udev de l'imprimante devrait charger automatique le module usblp lorsque vous brancherez l'imprimante et la commande lsusb devrait lister, probablement parmi d'autres choses, votre imprimante. Vous devriez voir quelque chose comme ce qui suit après l'utilisation de la commande lsusb pour confirmer que l'imprimante est détectée:
root@printserver:~# lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB Bus 001 Device 003: ID 0bda:0119 Realtek Semiconductor Corp. Storage Device (SD card reader) Bus 001 Device 004: ID 0ace:1211 ZyDAS ZD1211 802.11g Bus 001 Device 005: ID 04e8:3260 Samsung Electronics Co., Ltd CLP-510 Color Laser Printer root@printserver:~#
Si vous voyez quelque chose comme ça, avec le nom de votre imprimante détectée, vous pouvez continuer. Sinon vous devrez chercher les causes de la non-détection de votre imprimante.
Une fois que vous aurez installé les paquets et l'imprimante, vous pourrez ensuite donner les autorisations d'exécution à /etc/rc.d/rc.cups puis le démarrer. Si vous avez l'intention d'administrer à distance, vous devriez exécuter cette commande:
cupsctl --remote-admin
Puis démarrer votre navigateur web et accédez à
http://<your print server ip>:631 ou http://localhost:631 de puis le serveur d'impression
Pour la plupart, vous pouvez utiliser les liens sur le serveur d'impression lui-même à l'aide d'un terminal. Les seules choses qui ne fonctionnent pas directement dans les liens sont les sélections de zone de liste déroulante (combo box), c'est pourquoi j'autorise l'administration à distance. Allez-y et configurer l'imprimante locale comme imprimante brut. Cochez bien la case pour une imprimante partagée (shared printer). Vous pouvez appeler l'imprimante comme vous voulez, mais pour plus de commodité dans ce guide nous allons l'appeler “test”. Votre fichier /etc/cups/printers.conf devrait ressembler à ceci:
<Printer test> UUID urn:uuid:8d60a6be-4d86-3abf-5b8d-d5a03f10a753 Info test printer Location test location DeviceURI usb://Samsung/CLP-510?serial=xxxxxxxxxxxxx. #cette configuration dépendra de la marque de l'imprimante et du type de connexion avec le serveur d'impression State Idle StateTime 16147 Type 4 Accepting Yes Shared Yes JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 OpPolicy default ErrorPolicy abort-job </Printer>
Si vous avez des pilotes pour votre imprimante, vous pouvez configurer le filtre d'impression correct mais ce n'est pas obligatoire. Si vous les avez, ça peut être une bonne idée de les configurer juste pour vérifier que le serveur d'impression utilise l'imprimante.
Dés que l'imprimante est configurée, vous pouvez indiqué à cups d'accepter les requêtes d'impression distantes:
cupsctl --share-printers --remote-any --remote-admin
Si vous n'êtes pas intéressé à partager l'imprimante à l'extérieur de votre réseau local, il suffit de retirer l'option “–remote-any” et cups ne répondra qu'au demande d'impression de votre LAN.
Certaines plates-formes matérielles ne vous laissent pas faire un arrêt propre sans interagir avec l'OS (comme un vieux PC AT ou le seagate DockStar). Vous pouvez contourner ce problème en faisant une règle udev qui exécute un arrêt lorsque l'imprimante est supprimée (débranchée ou éteinte) de sorte que lorsque vous avez terminé l'impression, cela éteindra l'imprimante et le serveur d'impression s'arrêtera sans erreur.
Setting up the printer on the print clients
Now go on the PC's where you want to access the printer and configure an ipp remote printer with the correct driver for the printer. The /etc/cups/printers.conf should have an entry similar to this:
<Printer test> UUID urn:uuid:6abca077-c999-3d8a-5ce0-41b7bd3c2ddf AuthInfoRequired none Info test Location study room MakeModel Samsung CLP-510, 2.0.0 #in this case I setup splix driver for the samsung printer but this entirely depends on my setup DeviceURI ipp://<print server ip address>:631/printers/test State Idle StateTime 1387373858 Type 8400972 Accepting Yes Shared No JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 OpPolicy default ErrorPolicy abort-job </Printer>
You may now try printing a test page on the client PC.
Making the printserver crash proof
Once you have your print server working right you will probably want avoid doing anything to it unless it's really necessary. Looking after it's shutting down right and resolving fsck issues on reboot should not be something to worry about but journaled filesystems are meant to deal with accidental power rages not really for you to crash the system every time you switch it off.
Having the root filesystem mounted read only, with only the parts that are necessary for writing linked into tmpfs, would free us form having to worry about powering down the print server.
This is how I modified rc.S and rc.M for the job:
rc.S.org 2013-12-28 14:25:08.569250342 +0100 rc.S 2013-12-28 14:15:50.594483496 +0100 @@ -18,12 +18,31 @@ fi fi fi +echo "timer" > /sys/class/leds/dockstar:green:health/trigger +echo "125" > /sys/class/leds/dockstar:green:health/delay_on +echo "250" > /sys/class/leds/dockstar:green:health/delay_off +# if [ -d /run ]; then if ! grep -wq "tmpfs /run tmpfs" /proc/mounts ; then /sbin/mount -v -n -t tmpfs tmpfs /run -o mode=0755 fi fi +( cd /run + /usr/bin/mkdir -p log/{cups,nfsd,samba} spool/{cups/tmp,mail} run/{cups/certs,dbus,dhcpcd/ntp.conf,dhcpcd/resolv.conf} tmp + /usr/bin/chmod a+rwxt tmp lock/subsys + for DIR in packages removed_packages removed_scripts scripts setup + do + /usr/bin/ln -s /var/static/$DIR log/$DIR + done + /usr/bin/ln -s /var/static/cron spool/cron + /usr/bin/touch /run/ld.so.cache +) # Load the loop device kernel module: if [ -x /etc/rc.d/rc.loop ]; then @@ -219,32 +238,32 @@ reboot -f fi # Remount the root filesystem in read-write mode - echo "Remounting root device with read-write enabled." - /sbin/mount -w -v -n -o remount / - if [ $? -gt 0 ] ; then - echo - echo "Attempt to remount root device as read-write failed! This is going to" - echo "cause serious problems." - echo - echo "If you're using the UMSDOS filesystem, you **MUST** mount the root partition" - echo "read-write! You can make sure the root filesystem is getting mounted " - echo "read-write with the 'rw' flag to Loadlin:" - echo - echo "loadlin vmlinuz root=/dev/hda1 rw (replace /dev/hda1 with your root device)" - echo - echo "Normal bootdisks can be made to mount a system read-write with the rdev command:" - echo - - echo "rdev -R /dev/fd0 0" - echo - echo "You can also get into your system by using a boot disk with a command like this" - echo "on the LILO prompt line: (change the root partition name as needed)" - echo - echo "LILO: mount root=/dev/hda1 rw" - echo - echo "Please press ENTER to continue, then reboot and use one of the above methods to" - echo -n "get into your machine and start looking for the problem. " - read junk; - fi +# echo "Remounting root device with read-write enabled." +# /sbin/mount -w -v -n -o remount / +# if [ $? -gt 0 ] ; then +# echo +# echo "Attempt to remount root device as read-write failed! This is going to" +# echo "cause serious problems." +# echo +# echo "If you're using the UMSDOS filesystem, you **MUST** mount the root partition" +# echo "read-write! You can make sure the root filesystem is getting mounted " +# echo "read-write with the 'rw' flag to Loadlin:" +# echo +# echo "loadlin vmlinuz root=/dev/hda1 rw (replace /dev/hda1 with your root device)" +# echo +# echo "Normal bootdisks can be made to mount a system read-write with the rdev command:" +# echo +# echo "rdev -R /dev/fd0 0" +# echo +# echo "You can also get into your system by using a boot disk with a command like this" +# echo "on the LILO prompt line: (change the root partition name as needed)" +# echo +# echo "LILO: mount root=/dev/hda1 rw" +# echo +# echo "Please press ENTER to continue, then reboot and use one of the above methods to" +# echo -n "get into your machine and start looking for the problem. " +# read junk; +# fi else echo "Testing root filesystem status: read-write filesystem" echo --- rc.M.org 2013-12-28 14:24:12.088970256 +0100 +++ rc.M 2013-12-28 14:15:56.890514695 +0100 @@ -17,7 +17,7 @@ # Update all the shared library links: if [ -x /sbin/ldconfig ]; then echo "Updating shared library links: /sbin/ldconfig &" - /sbin/ldconfig & + /sbin/ldconfig -C /run/ld.so.cache & fi # Screen blanks after 15 minutes idle time, and powers down in one hour
A bit of tinkering with links in var and a few other places and you're done.
root@printserver:~# ls -l /var/ total 0 lrwxrwxrwx 1 root root 3 Nov 4 2013 adm -> log/ drwxr-xr-x 5 root root 368 Jan 1 1970 cache/ drwxr-xr-x 2 root root 160 Oct 18 2013 empty/ drwxr-xr-x 7 root root 488 Jan 1 1970 lib/ lrwxrwxrwx 1 root root 9 Jan 1 01:29 lock -> /run/lock/ lrwxrwxrwx 1 root root 10 Jan 1 1970 log -> ../run/log/ lrwxrwxrwx 1 root root 10 Nov 4 2013 mail -> spool/mail/ drwxr-xr-x 12 root root 800 Nov 25 1993 man/ lrwxrwxrwx 1 root root 10 Jan 1 1970 run -> ../run/run/ lrwxrwxrwx 1 root root 15 Nov 4 2013 rwho -> /var/spool/rwho lrwxrwxrwx 1 root root 12 Jan 1 1970 spool -> ../run/spool/ drwxr-xr-x 3 root root 232 Jul 15 2013 state/ drwxr-xr-x 8 root root 576 Jan 1 1970 static/ lrwxrwxrwx 1 root root 10 Jan 1 1970 tmp -> ../run/tmp/ root@printserver:~# ls -l /etc/ld.so.cache lrwxrwxrwx 1 root root 16 Jan 1 01:06 /etc/ld.so.cache -> /run/ld.so.cache root@printserver:~# ls -l /run/log total 40 -rw-r--r-- 1 root root 0 Jan 1 01:00 cron drwxr-xr-x 2 root root 100 Jan 1 01:01 cups/ -rw-r--r-- 1 root root 1280 Jan 1 01:01 debug -rw-r--r-- 1 root root 11512 Jan 1 01:00 dmesg -rw-r--r-- 1 root root 0 Jan 1 01:00 maillog -rw-r--r-- 1 root root 19290 Jan 1 01:06 messages drwxr-xr-x 2 root root 40 Jan 1 01:00 nfsd/ lrwxrwxrwx 1 root root 20 Jan 1 01:00 packages -> /var/static/packages/ lrwxrwxrwx 1 root root 28 Jan 1 01:00 removed_packages -> /var/static/removed_packages/ lrwxrwxrwx 1 root root 27 Jan 1 01:00 removed_scripts -> /var/static/removed_scripts/ drwxr-xr-x 2 root root 40 Jan 1 01:00 samba/ lrwxrwxrwx 1 root root 19 Jan 1 01:00 scripts -> /var/static/scripts/ -rw-r--r-- 1 root root 0 Jan 1 01:00 secure lrwxrwxrwx 1 root root 17 Jan 1 01:00 setup -> /var/static/setup/ -rw-r--r-- 1 root root 0 Jan 1 01:00 spooler -rw-r--r-- 1 root root 2083 Jan 1 01:01 syslog root@printserver:~# ls -l /run/spool/ total 0 lrwxrwxrwx 1 root root 16 Jan 1 01:00 cron -> /var/static/cron/ drwx--x--- 3 root lp 60 Jan 1 01:00 cups/ drwxr-xr-x 2 root root 40 Jan 1 01:00 mail/ root@printserver:~# ls -l /tmp lrwxrwxrwx 1 root root 7 Jan 1 01:03 /tmp -> run/tmp/ root@printserver:~# mount proc on /proc type proc (rw,relatime) sysfs on /sys type sysfs (rw,relatime) tmpfs on /run type tmpfs (rw,relatime,mode=755) devtmpfs on /dev type devtmpfs (rw,relatime,size=60180k,nr_inodes=15045,mode=755) /dev/ubi0_0 on / type ubifs (ro,relatime) devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000) cgroup on /sys/fs/cgroup type cgroup (rw,relatime,net_cls,freezer,devices,cpuacct) root@printserver:~#
With these links the Slackware distribution will operate pretty much normally and can resume to ordinary operation by just remounting root read/write “mount -o remount,rw /” to allow some maintenance (like package management) and when that's done just remount it ro with a simple “mount -o remount,ro /”.
Here's my wifi print server
Here's one of my Dockstars in a homebrew casing running the above described printserver from internal flash. (the usb stick on top is a wifi stick)