Santiago Aggio habilitó la máquina virtual vm03.criba.edu.ar con un Debian Etch. Las pruebas que hizo con Debian Lenny no anduvieron del todo bien (problema de compatibilidad con Xen?), y aunque piensa seguir intentando, por ahora me dio a probar este Etch.
Debajo de todo esto hay un CentOS 5.2, usando paravirtualización con Xen. (Ver también Xen.) El hardware es amd64 (?)
Algunos tutoriales para el setup de un VPS con Debian Etch pueden encontrarse en Slicehost:
Inicialmente no pude acceder por SSH; Santiago aparentemente ajustó el firewall de 12 de octubre para permitir el acceso. Dice Santiago: “Desde la uns estan abiertos para vm03 los puertos 22 (ssh), 80 y 443 (https). Si necesitas alguno mas me avisas”. (no entendí bien lo que quiso decir)
$ ssh root@vm03.criba.edu.ar root@vm03.criba.edu.ar's password: Last login: Tue May 19 06:26:02 2009 Linux vm03 2.6.18-6-xen-amd64 #1 SMP Thu Dec 25 22:21:42 UTC 2008 x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. vm03:~# date Tue May 19 06:27:27 UTC 2009
Password cambiado.
Lista de paquetes instalados al momento de recibir la MV:
vm03:~# dpkg -l Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name Version Description +++-====================-====================-======================================================== ii adduser 3.102 Add and remove users and groups ii apt 0.6.46.4-0.1 Advanced front-end for dpkg ii apt-utils 0.6.46.4-0.1 APT utility programs ii aptitude 0.4.4-4 terminal-based apt frontend ii base-files 4 Debian base system miscellaneous files ii base-passwd 3.5.11 Debian base system master password and group files ii bash 3.1dfsg-8 The GNU Bourne Again SHell ii bsdmainutils 6.1.6 collection of more utilities from FreeBSD ii bsdutils 2.12r-19etch1 Basic utilities from 4.4BSD-Lite ii busybox 1.1.3-4 Tiny utilities for small and embedded systems ii coreutils 5.97-5.3 The GNU core utilities ii cpio 2.6-18.1+etch1 GNU cpio -- a program to manage archives of files ii cron 3.0pl1-100 management of regular background processing ii debconf 1.5.11etch2 Debian configuration management system ii debconf-i18n 1.5.11etch2 full internationalization support for debconf ii debian-archive-keyri 2009.01.31 GnuPG archive keys of the Debian archive ii debianutils 2.17 Miscellaneous utilities specific to Debian ii dhcp3-client 3.0.4-13 DHCP Client ii dhcp3-common 3.0.4-13 Common files used by all the dhcp3* packages ii diff 2.8.1-11 File comparison utilities ii dmidecode 2.8-4 Dump Desktop Management Interface data ii dpkg 1.13.26 package maintenance system for Debian ii dselect 1.13.26 user tool to manage Debian packages ii e2fslibs 1.39+1.40-WIP-2006.1 ext2 filesystem libraries ii e2fsprogs 1.39+1.40-WIP-2006.1 ext2 file system utilities and libraries ii ed 0.2-20 The classic unix line editor ii findutils 4.2.28-1etch1 utilities for finding files--find, xargs, and locate ii gcc-4.1-base 4.1.1-21 The GNU Compiler Collection (base package) ii gnupg 1.4.6-2 GNU privacy guard - a free PGP replacement ii gpgv 1.4.6-2 GNU privacy guard - signature verification tool ii grep 2.5.1.ds2-6 GNU grep, egrep and fgrep ii groff-base 1.18.1.1-12 GNU troff text-formatting system (base system components ii gzip 1.3.5-15 The GNU compression utility ii hostname 2.93 utility to set/show the host name or domain name ii ifupdown 0.6.8 high level tools to configure network interfaces ii info 4.8.dfsg.1-4 Standalone GNU Info documentation browser ii initramfs-tools 0.85i tools for generating an initramfs ii initscripts 2.86.ds1-38+etchnhal Scripts for initializing and shutting down the system ii iptables 1.3.6.0debian1-5 administration tools for packet filtering and NAT ii iputils-ping 20020927-6 Tools to test the reachability of network hosts ii klibc-utils 1.4.34-2 small statically-linked utilities built with klibc ii klogd 1.4.1-18 Kernel Logging Daemon ii laptop-detect 0.12.1 attempt to detect a laptop ii libacl1 2.2.41-1 Access control list shared library ii libattr1 2.4.32-1 Extended attribute shared library ii libblkid1 1.39+1.40-WIP-2006.1 block device id library ii libbz2-1.0 1.0.3-6 high-quality block-sorting file compressor library - run ii libc6 2.3.6.ds1-13etch9 GNU C Library: Shared libraries ii libcap1 1.10-14 support for getting/setting POSIX.1e capabilities ii libcomerr2 1.39+1.40-WIP-2006.1 common error description library ii libconsole 0.2.3dbs-65 Shared libraries for Linux console and font manipulation ii libdb4.2 4.2.52+dfsg-2 Berkeley v4.2 Database Libraries [runtime] ii libdb4.3 4.3.29-8 Berkeley v4.3 Database Libraries [runtime] ii libdb4.4 4.4.20-8 Berkeley v4.4 Database Libraries [runtime] ii libdevmapper1.02 1.02.08-1 The Linux Kernel Device Mapper userspace library ii libedit2 2.9.cvs.20050518-2.2 BSD editline and history libraries ii libgcc1 4.1.1-21 GCC support library ii libgcrypt11 1.2.3-2 LGPL Crypto library - runtime library ii libgdbm3 1.8.3-3 GNU dbm database routines (runtime version) ii libgnutls13 1.4.4-3+etch4 the GNU TLS library - runtime library ii libgpg-error0 1.4-1 library for common error values and messages in GnuPG co ii libklibc 1.4.34-2 minimal libc subset for use with initramfs ii libkrb53 1.4.4-7etch6 MIT Kerberos runtime libraries ii libldap2 2.1.30-13.3 OpenLDAP libraries ii liblocale-gettext-pe 1.05-1 Using libc functions for internationalization in Perl ii liblzo1 1.08-3 data compression library (old version) ii libncurses5 5.5-5 Shared libraries for terminal handling ii libncursesw5 5.5-5 Shared libraries for terminal handling (wide character s ii libnewt0.52 0.52.2-10 Not Erik's Windowing Toolkit - text mode windowing with ii libopencdk8 0.5.9-2 Open Crypto Development Kit (OpenCDK) (runtime) ii libpam-modules 0.79-5+etch1 Pluggable Authentication Modules for PAM ii libpam-runtime 0.79-5+etch1 Runtime support for the PAM library ii libpam0g 0.79-5+etch1 Pluggable Authentication Modules library ii libpopt0 1.10-3 lib for parsing cmdline parameters ii libreadline5 5.2-2 GNU readline and history libraries, run-time libraries ii libsasl2 2.1.22.dfsg1-8 Authentication abstraction library ii libsasl2-2 2.1.22.dfsg1-8 Authentication abstraction library ii libselinux1 1.32-3 SELinux shared libraries ii libsepol1 1.14-2 Security Enhanced Linux policy library for changing poli ii libsigc++-2.0-0c2a 2.0.17-2 type-safe Signal Framework for C++ - runtime ii libslang2 2.0.6-4 The S-Lang programming library - runtime version ii libss2 1.39+1.40-WIP-2006.1 command-line interface parsing library ii libssl0.9.8 0.9.8c-4etch4 SSL shared libraries ii libstdc++6 4.1.1-21 The GNU Standard C++ Library v3 ii libtasn1-3 0.3.6-2 Manage ASN.1 structures (runtime) ii libtext-charwidth-pe 0.04-4 get display widths of characters on the terminal ii libtext-iconv-perl 1.4-3 converts between character sets in Perl ii libtext-wrapi18n-per 0.06-5 internationalized substitute of Text::Wrap ii libusb-0.1-4 0.1.12-5 userspace USB programming library ii libuuid1 1.39+1.40-WIP-2006.1 universally unique id library ii libvolume-id0 0.105-4 libvolume_id shared library ii libwrap0 7.6.dbs-13 Wietse Venema's TCP wrappers library ii linux-image-2.6.18-6 2.6.18.dfsg.1-24 Linux 2.6.18 image on AMD64 ii linux-modules-2.6.18 2.6.18.dfsg.1-24 Linux 2.6.18 modules on AMD64 ii locales 2.3.6.ds1-13etch9 GNU C Library: National Language (locale) data [support] ii login 4.0.18.1-7+etch1 system login tools ii logrotate 3.7.1-3 Log rotation utility ii lsb-base 3.1-23.2etch1 Linux Standard Base 3.1 init script functionality ii makedev 2.3.1-83 creates device files in /dev ii man-db 2.4.3-6 The on-line manual pager ii manpages 2.39-1 Manual pages about using a GNU/Linux system ii mawk 1.3.3-11 a pattern scanning and text processing language ii mktemp 1.5-2 Makes unique filenames for temporary files ii module-init-tools 3.3-pre4-2 tools for managing Linux kernel modules ii mount 2.12r-19etch1 Tools for mounting and manipulating filesystems ii nano 2.0.2-1etch1 free Pico clone with some new features ii ncurses-base 5.5-5 Descriptions of common terminal types ii ncurses-bin 5.5-5 Terminal-related programs and man pages ii net-tools 1.60-17 The NET-3 networking toolkit ii netbase 4.29 Basic TCP/IP networking system ii netcat 1.10-32 TCP/IP swiss army knife ii openbsd-inetd 0.20050402-6 The OpenBSD Internet Superserver ii openssh-blacklist 0.1.1 list of blacklisted OpenSSH RSA and DSA keys ii openssh-client 4.3p2-9etch3 Secure shell client, an rlogin/rsh/rcp replacement ii openssh-server 4.3p2-9etch3 Secure shell server, an rshd replacement ii passwd 4.0.18.1-7+etch1 change and administer password and group data ii perl-base 5.8.8-7etch6 The Pathologically Eclectic Rubbish Lister ii procps 3.2.7-3 /proc file system utilities ii readline-common 5.2-2 GNU readline and history libraries, common files ii sed 4.1.5-1 The GNU sed stream editor ii ssh 4.3p2-9etch3 Secure shell client and server (transitional package) ii sudo 1.6.8p12-4 Provide limited super user privileges to specific users ii sysklogd 1.4.1-18 System Logging Daemon ii sysv-rc 2.86.ds1-38+etchnhal System-V-like runlevel change mechanism ii sysvinit 2.86.ds1-38+etchnhal System-V-like init utilities ii sysvinit-utils 2.86.ds1-38+etchnhal System-V-like utilities ii tar 1.16-2etch1 GNU tar ii tasksel 2.66 Tool for selecting tasks for installation on Debian syst ii tasksel-data 2.66 Official tasks used for installation of Debian systems ii tcpd 7.6.dbs-13 Wietse Venema's TCP wrapper utilities ii traceroute 1.4a12-21 traces the route taken by packets over a TCP/IP network ii tzdata 2008e-1etch3 Time Zone and Daylight Saving Time Data ii udev 0.105-4 /dev/ and hotplug management daemon ii update-inetd 4.27-0.5 inetd.conf updater ii util-linux 2.12r-19etch1 Miscellaneous system utilities ii util-linux-locales 2.12r-19etch1 Locales files for util-linux ii vim-common 7.0-122+1etch5 Vi IMproved - Common files ii vim-tiny 7.0-122+1etch5 Vi IMproved - enhanced vi editor - compact version ii wget 1.10.2-2 retrieves files from the web ii whiptail 0.52.2-10 Displays user-friendly dialog boxes from shell scripts ii zlib1g 1.2.3-13 compression library - runtime
Intento instalar apache:
vm03:~# apt-get install apache2 Reading package lists... Done Building dependency tree... Done The following extra packages will be installed: apache2-mpm-worker apache2-utils apache2.2-common libapr1 libaprutil1 libexpat1 libmagic1 libpcre3 libpq4 libsqlite3-0 mime-support Suggested packages: file The following NEW packages will be installed: apache2 apache2-mpm-worker apache2-utils apache2.2-common libapr1 libaprutil1 libexpat1 libmagic1 libpcre3 libpq4 libsqlite3-0 mime-support 0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded. Need to get 3066kB of archives. After unpacking 9216kB of additional disk space will be used. Do you want to continue [Y/n]? Y Err http://ftp.us.debian.org etch/main libmagic1 4.17-5etch3 Temporary failure resolving 'ftp.us.debian.org' Err http://ftp.us.debian.org etch/main libpcre3 6.7+7.4-4 Temporary failure resolving 'ftp.us.debian.org' Err http://ftp.us.debian.org etch/main mime-support 3.39-1 Temporary failure resolving 'ftp.us.debian.org' 0% [Connecting to ftp.us.debian.org]
Veamos dónde busca paquetes:
vm03:~# cat /etc/apt/sources.list # # /etc/apt/sources.list # # # etch # deb http://ftp.us.debian.org/debian/ etch main contrib non-free deb-src http://ftp.us.debian.org/debian/ etch main contrib non-free # # Security updates - Uncomment to enable. # # deb http://security.debian.org/ etch/updates main contrib non-free # deb-src http://security.debian.org/ etch/updates main contrib non-free
vm03:~# ifconfig eth0 Link encap:Ethernet HWaddr 00:16:3E:77:C7:75 inet addr:168.96.204.201 Bcast:168.96.204.223 Mask:255.255.255.224 inet6 addr: fe80::216:3eff:fe77:c775/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3938 errors:0 dropped:0 overruns:0 frame:0 TX packets:1450 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:360955 (352.4 KiB) TX bytes:317914 (310.4 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
vm03:~# ping www.criba.edu.ar ping: unknown host www.criba.edu.ar
Mientras espero ayuda de Santiago…
vm03:~# more ~/.bashrc # ~/.bashrc: executed by bash(1) for non-login shells. export PS1='\h:\w\$ ' umask 022 # You may uncomment the following lines if you want `ls' to be colorized: # export LS_OPTIONS='--color=auto' # eval "`dircolors`" # alias ls='ls $LS_OPTIONS' # alias ll='ls $LS_OPTIONS -l' # alias l='ls $LS_OPTIONS -lA' # # Some more alias to avoid making mistakes: # alias rm='rm -i' # alias cp='cp -i' # alias mv='mv -i'
Descomenté los alias y añadí algunos más.
Pero entonces me puse a leer el primer tutorial de Slicehost (ver link arriba), y decidí empezar a hacer las cosas como allí se indica.
vm03:~# adduser efege perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). Adding user `efege' ... Adding new group `efege' (1000) ... Adding new user `efege' (1000) with group `efege' ... Creating home directory `/home/efege' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for efege Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [y/N] y
Luego ejecuté visudo
y añadí al final la línea
efege ALL=(ALL) ALL
A partir de ahora me logueo como efege. La primera vez que uso sudo me advierte:
efege@vm03:~$ sudo ls -a We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. Password: . .. .bash_logout .bash_profile .bashrc
<note> ¿Tal vez el usuario debería llamarse inmabb, admin, o de alguna otra manera menos personal? </note>
Ahora a continuar con las instrucciones del tutorial.
2009-05-20
Como ya varias veces me apareció un mensaje de advertencia sobre configuración de “locales” (p.ej. arriba con adduser), seguí la instrucción que aparece en http://articles.slicehost.com/2007/9/5/debian-etch-setup-page-2
~$ sudo dpkg-reconfigure locales
Seleccioné estos 3 locales:
en_US.UTF-8 es_AR.ISO-8859-1 es_AR.UTF-8
En algún momento será bueno familiarizarse con http://www.debian.org/doc/manuals/reference/
Siendo las 09:58 del miércoles 20 de mayo:
$ date Tue May 19 21:58:14 UTC 2009
Cuál es el método recomendado? ntpdate?
Instalo ntpdate y lo ejecuto:
$ sudo apt-get install ntpdate sudo ntpdate pool.ntp.org 20 May 04:23:54 ntpdate[2906]: step time server 200.80.32.172 offset 53963.089914 sec
Pero no corrige la hora!
En base a Debian GNU/Linux System Administrator's Manual, Chapter 16 - Time, ejecuto
$ sudo tzconfig
y selecciono America/Argentina/Buenos_Aires. Me informa:
Your default time zone is set to 'America/Argentina/Buenos_Aires'. Local time is now: Wed May 20 02:32:16 ART 2009. Universal Time is now: Wed May 20 05:32:16 UTC 2009.
Pero aún falta ajustar la hora (las 17:32).
Tal vez esto tenga que ver con el uso de VM. Ver Time handling in Linux VMs, y consultar a Santiago.
Probemos:
$ sudo echo 1 > /proc/sys/xen/independent_wallclock -bash: /proc/sys/xen/independent_wallclock: Permission denied
Mmmm… dice “From a root prompt”… entonces probemos así:
$ sudo -i Password: vm03:~# echo 1 > /proc/sys/xen/independent_wallclock vm03:~#
Cambiado. (El archivo en cuestión contenía originalmente el número “0”).
$ sudo ntpdate pool.ntp.org 21 May 13:39:19 ntpdate[5764]: step time server 200.80.32.172 offset 117.245725 sec efege@vm03:~$ date Thu May 21 13:39:33 ART 2009
(Pero como Santiago también estaba haciendo algún cambio al mismo momento, no sé cuál fue la real causa de la solución.)
Según http://docs.xensource.com/XenServer/4.0.1/guest/ch04s06.html, también hay que editar /etc/sysctl.conf
, para que el seteo del independent_wallclock “can be persisted across reboots”:
$ sudo nano /etc/sysctl.conf
Le agrego al final:
# Set independent wall clock time xen.independent_wallclock=1
Y efectivamente, el valor “1” subsiste luego de un reboot.
Tenemos la opción de usar ntpdate con cron, o bien usar ntp (daemon, puerto 123) para que el reloj se mantenga sincronizado.
Probemos con ntp.
$ sudo apt-get remove ntpdate $ sudo apt-get install ntp ... Starting NTP server: ntpd.
$ sudo netstat -lnptu Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp6 0 0 :::22 :::* LISTEN 1332/sshd udp 0 0 168.96.204.201:123 0.0.0.0:* 3039/ntpd udp 0 0 127.0.0.1:123 0.0.0.0:* 3039/ntpd udp 0 0 0.0.0.0:123 0.0.0.0:* 3039/ntpd udp6 0 0 ::1:123 :::* 3039/ntpd udp6 0 0 fe80::216:3eff:fe77:123 :::* 3039/ntpd udp6 0 0 :::123 :::* 3039/ntpd
No sé si esto es lo que conviene. Además, ¿a qué servidor NTP deberíamos consultar?
Habrá que leer también algo de acá: Managing Accurate Date and Time.
El problema que encontré se resolvió modificando el archivo /etc/resolv.conf
. Inicialmente tenía esto:
$ cat /etc/resolv.conf nameserver 192.168.122.1
Siguiendo las indicaciones de Santiago:
$ cat /etc/resolv.conf nameserver 168.96.204.2 nameserver 168.96.128.2
El efecto fue inmediato, sin reiniciar (explícitamente) nada.
Descomenté las 2 líneas de security updates. Luego corro:
$ sudo aptitude update
y luego:
$ sudo aptitude upgrade Reading package lists... Done Building dependency tree... Done Reading extended state information Initializing package states... Done Reading task descriptions... Done Building tag database... Done The following packages will be upgraded: apt apt-utils libkrb53 libssl0.9.8 libvolume-id0 linux-image-2.6.18-6-xen-amd64 linux-modules-2.6.18-6-xen-amd64 ntpdate udev 9 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 20.4MB of archives. After unpacking 28.7kB will be used. Do you want to continue? [Y/n/?] Y ...
$ sudo aptitude dist-upgrade Reading package lists... Done Building dependency tree... Done Reading extended state information Initializing package states... Done Reading task descriptions... Done Building tag database... Done No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0B of archives. After unpacking 0B will be used.
Luego de la actualización de paquetes, reboot:
$ sudo shutdown -r now
Vuelvo a loguearme.
Recomendado por Slicehost:
$ sudo aptitude install build-essential Reading package lists... Done Building dependency tree... Done Reading extended state information Initializing package states... Done Reading task descriptions... Done Building tag database... Done The following NEW packages will be automatically installed: binutils bzip2 cpp cpp-4.1 dpkg-dev g++ g++-4.1 gcc gcc-4.1 libc6-dev libmudflap0 libmudflap0-dev libssp0 libstdc++6-4.1-dev linux-kernel-headers make patch perl perl-doc perl-modules The following NEW packages will be installed: binutils build-essential bzip2 cpp cpp-4.1 dpkg-dev g++ g++-4.1 gcc gcc-4.1 libc6-dev libmudflap0 libmudflap0-dev libssp0 libstdc++6-4.1-dev linux-kernel-headers make patch perl perl-doc perl-modules 0 packages upgraded, 21 newly installed, 0 to remove and 0 not upgraded. Need to get 29.3MB of archives. After unpacking 101MB will be used. Do you want to continue? [Y/n/?]
$ sudo aptitude install apache2 apache2-mpm-prefork apache2-utils libexpat1 ssl-cert Password: Reading package lists... Done Building dependency tree... Done Reading extended state information Initializing package states... Done Writing extended state information... Done Reading task descriptions... Done Building tag database... Done The following NEW packages will be automatically installed: apache2.2-common file libapr1 libaprutil1 libmagic1 libpcre3 libpq4 libsqlite3-0 mime-support openssl The following NEW packages will be installed: apache2 apache2-mpm-prefork apache2-utils apache2.2-common file libapr1 libaprutil1 libexpat1 libmagic1 libpcre3 libpq4 libsqlite3-0 mime-support openssl ssl-cert 0 packages upgraded, 15 newly installed, 0 to remove and 0 not upgraded. Need to get 4123kB of archives. After unpacking 11.7MB will be used. Do you want to continue? [Y/n/?] Y ...
$ sudo /etc/init.d/apache2 force-reload Forcing reload of web server (apache2)... waiting .
Visito la dirección http://vm03.criba.edu.ar y me redirecciona a http://vm03.criba.edu.ar/apache2-default/. Apache dice: “It works!”
En lugar de instalar el montón de paquetes que sugiere el artículo de Slicehost:
$ sudo aptitude install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-imagick php5-mcrypt php5-memcache php5-mhash php5-mysql php5-pspell php5-snmp php5-sqlite php5-xmlrpc php5-xsl
voy a empezar por lo más básico:
$ sudo aptitude install libapache2-mod-php5 php5
Luego agregamos más paquetes si los necesitamos.
$ sudo aptitude install libapache2-mod-python Password: Reading package lists... Done Building dependency tree... Done Reading extended state information Initializing package states... Done Reading task descriptions... Done Building tag database... Done The following NEW packages will be automatically installed: python python-central python-minimal python2.4 python2.4-minimal The following NEW packages will be installed: libapache2-mod-python python python-central python-minimal python2.4 python2.4-minimal 0 packages upgraded, 6 newly installed, 0 to remove and 0 not upgraded. Need to get 4227kB of archives. After unpacking 14.8MB will be used. Do you want to continue? [Y/n/?]
En Etch tenemos Python 2.4. Si bien también está disponible Python 2.5, no está mod_python para 2.5. . (Según Will Stevens, "Installing mod_python for Apache2 in Debian Etch is a total PITA.".
Apache se está identificando de esta manera:
Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/5.2.0-8+etch15 Server at vm03.criba.edu.ar Port 80
Para modificar esto, edité /etc/apache2/apache2.conf:
#ServerTokens Full ServerTokens Major
y luego un reload de Apache.
La versión más reciente de Django (1.0.2) está disponible como paquete para Etch a través de backports.org: http://packages.debian.org/search?keywords=python-django&searchon=names§ion=all&suite=etch-backports
Leer info sobre backports.
Añadí a /etc/apt/sources.list la línea
deb http://www.backports.org/debian etch-backports main contrib non-free
y luego:
$ sudo apt-get update W: GPG error: http://www.backports.org etch-backports Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EA8E8B2116BA136C W: You may want to run apt-get update to correct these problems
Según indicaciones en http://www.backports.org/dokuwiki/doku.php?id=instructions, el problema se resuelve con:
$ sudo apt-get install debian-backports-keyring
Reitero el sudo apt-get update
y ya no da error.
$ sudo apt-get -t etch-backports install python-django Reading package lists... Done Building dependency tree... Done The following extra packages will be installed: python-support Suggested packages: python-psycopg2 python-psycopg python-mysqldb python-flup The following NEW packages will be installed: python-django python-support 0 upgraded, 2 newly installed, 0 to remove and 14 not upgraded. Need to get 4849kB of archives. After unpacking 18.5MB of additional disk space will be used. Do you want to continue [Y/n]?
Soporte para sqlite (necesario para Python 2.4):
$ sudo apt-get install python-pysqlite2
$ wget http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2009-02-14.tgz $ tar xzvf dokuwiki-2009-02-14.tgz
Farm: seguir los pasos ya probados en mi PC de la biblioteca. Ver DokuWiki para el INMABB.
ATENCION: El script add-animal
establece permisos muy generosos (777). Si bien por ahora no pensamos dar acceso a otros usuarios en este servidor, es mejor ser precavidos. Ver la sección sobre Permisos en esta misma página.
No podemos probar la granja hasta que tengamos resuelta la cuestión de los dominios en el DNS. A menos que hagamos pruebas con vhosts basados en ports, lo que requiere una modificación de Esto ya está solucionado (2009-05-22).
preload.php
.
La posibilidad de que se use gov o gob en el dominio afecta la verificación de existencia del animal en preload.php
. CORREGIDO.
También tuve que añadir ServerAlias para la variante gob/gov.
PROBLEMA: ¿cómo migrar los datos de DokuWiki? Lo que hasta ahora era un namespace (biblio) debe pasar a ser el namespace principal. Mandé una consulta a la lista, mientras intento hacer algo y ver cómo sale. Para regenerar el índice quizás nos sirva plugin:searchindex.
Permisos:
$ cd ~/www/dokuwiki-farm/animals/biblio.inmabb-conicet.gov.ar $ sudo chmod -R g+w data/
Configurar para que pueda enviar notificaciones por mail. Ver http://www.dokuwiki.org/tips:mailconfig
18-dec-2009. Por recomendación de Santiago Aggio, instalé el plugin swiftmail; no es necesario instalar sendmail en el servidor. La configuración necesaria es (en el conf/local.php
de cada animal):
$conf['mailfrom'] = 'xx@yy'; // por ahora, 'DokuWiki INMABB <fgomez@criba.edu.ar>' $conf['plugin']['swiftmail']['smtp_host'] = 'smtp.criba.edu.ar'; $conf['plugin']['swiftmail']['auth_user'] = 'xxxxx'; // por ahora, 'fgomez' $conf['plugin']['swiftmail']['auth_pass'] = 'zzzzz'; // OJO, queda a la vista en local.php!!
Luego hay que ver ćomo funciona el envío de mails desde Django.
Atención a errores como estos, que no deberían mostrarse al usuario:
Warning: file_get_contents(http://vm03.criba.edu.ar:8091/cgi-bin /wxis?script_url=%2Fdoku.php%2Fcatalogo&path_htdocs=http%3A%2F%2Fvm03.criba.edu.ar%3A8091%2F& output=embed&IsisScript=xis%2Fopac.xis&db=demo) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/efege/www/dokuwiki-farm/farmer/lib/plugins /opacmarc/syntax.php on line 202
¿Probamos con el plugin searchindex?
cd ~/downloads wget http://www.dokuwiki.org/_media/plugin:searchindex-plugin-2005-09-04.tgz cd ~/www/dokuwiki-farm/farmer/lib/plugins untgz ~/downloads/plugin\:searchindex-plugin-2005-09-04.tgz
Ahora bien, parece que antes de probar con esto (que es viejo!) deberíamos explorar el script bin/indexer.php
, ver cli.
$ sudo apt-get install php5-cli
¿Pero cómo lo usamos con un farm? Ver http://www.dokuwiki.org/tips%3Afarm2#discussion
Siguiendo esa recomendación, modifiqué el archivo indexer.php
, y lo ejecuté:
$ cd ~/www/dokuwiki-farm/farmer/bin $ php indexer.php --path /home/efege/www/dokuwiki-farm/animals/biblio.inmabb-conicet.gov.ar/ Warning: Cannot modify header information - headers already sent by (output started at /home/efege/www/dokuwiki-farm/farmer/bin/indexer.php:8) in /home/efege/www/dokuwiki-farm/farmer/inc/auth.php on line 295 Searching pages... 109 pages found. Waiting for lockfile (max. 5 min)................. guias:bases_de_datos... Fatal error: Failed to write page index in /home/efege/www/dokuwiki-farm/farmer/inc/indexer.php on line 305
Consultar la documentación oficial de Apache: Name-based Virtual Host Support.
Recordemos que la instalación default de Apache queda así:
$ ls -l /etc/apache2/sites-enabled/ total 0 lrwxrwxrwx 1 root root 36 2009-05-20 02:26 000-default -> /etc/apache2/sites-available/default
Este default host (site) define:
DocumentRoot /var/www/ ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ ErrorLog /var/log/apache2/error.log CustomLog /var/log/apache2/access.log combined
Además, tenemos estos módulos ya habilitados:
$ ls /etc/apache2/mods-enabled/ alias.load authz_default.load authz_user.load dir.conf mime.load php5.conf status.load auth_basic.load authz_groupfile.load autoindex.load dir.load mod_python.load php5.load authn_file.load authz_host.load cgi.load env.load negotiation.load setenvif.load
Suponiendo que usemos inmabb-conicet.gob.ar como dominio asociado a esta VM, vamos a querer tener también algunos subdominios, p.ej. biblio.inmabb-conicet.gob.ar, catalis.inmabb-conicet.gob.ar, opac.inmabb-conicet.gob.ar, dev.inmabb-conicet.gob.ar, etc. ¿Podemos probar tambien con inmabb.gov.ar?
Eso hay que arreglarlo con Santiago.
Por lo que he leído, se podría configurar un “wildcard DNS record” (*.inmabb.gov.ar), y luego Apache se ocupa de decidir qué hace con cada posible valor de “*”. Mi plan por ahora es tener algo como esto (en forma esquemática):
NameVirtualHost *:80 # ubico primero los server names específicos (opac, test, etc.) # <VirtualHost *:80> ServerName opac.inmabb.gov.ar DocumentRoot /var/www/opacmarc </VirtualHost> <VirtualHost *:80> ServerName test.inmabb.gov.ar DocumentRoot /var/www/test </VirtualHost> # y luego los server names genéricos (*) y el default # (estos nombres irían asociados a un dokuwiki farm) <VirtualHost *:80> ServerName inmabb.gov.ar ServerAlias *.inmabb.gov.ar DocumentRoot /var/www/dokuwiki-farm </VirtualHost>
La intención es que algunos subdominios de inmabb.gov.ar (e.g. test, catalis, opac) sean manejados por vhosts específicos, y que los restantes subdominios sean manejados por el vhost correspondiente a dokuwiki-farm.
En http://httpd.apache.org/docs/2.2/vhosts/details.html#hostmatching leemos:
“Only the ordering of name-based vhosts for a specific address set is significant. The one name-based vhosts that comes first in the configuration file has the highest priority for its corresponding address set.”
Testeado en localhost (en mi PC de la biblio), funciona.
Santiago habilitó wilcards DNS para los dominios inmabb-conicet.go(bv).ar.
Probado con algunos ejemplos: www.inmabb-conicet.gov.ar, test.inmabb-conicet.gov.ar. Aún no está “definido” inmabb-conicet.gov.ar.
2009-06-04: Santiago me informa que http://inmabb-conicet.gob.ar ahora sí está activo. Pruebo, y me lleva al OPAC (catalis.uns.edu.ar), por lo que deduzco que inmabb-conicet.gob.ar es un alias de inmabb.criba.edu.ar.
Es posible acceder a hosts en puertos diferentes del 80. Por ejemplo, el 8080:
Listen 8080 NameVirtualHost *:8080 <VirtualHost *:8080> DocumentRoot /home/efege/ </VirtualHost>
Acceso verificado desde IAR. También con el 8090.
Pero no puedo entrar a los puertos 81, 82.
Comandos para agilizar estas pruebas:
$ sudo cp /etc/apache2/sites-available/port8080 /etc/apache2/sites-available/port82 $ sudo nano /etc/apache2/sites-available/port82 [aquí modifico el nro. del puerto] $ sudo a2ensite port82 Site port82 installed; run /etc/init.d/apache2 reload to enable. $ sudo /etc/init.d/apache2 reload Reloading web server config...1359 . $ sudo netstat -lnptu Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp6 0 0 :::8080 :::* LISTEN 1359/apache2 tcp6 0 0 :::80 :::* LISTEN 1359/apache2 tcp6 0 0 :::81 :::* LISTEN 1359/apache2 tcp6 0 0 :::82 :::* LISTEN 1359/apache2 tcp6 0 0 :::22 :::* LISTEN 1332/sshd tcp6 0 0 :::8090 :::* LISTEN 1359/apache2
El script add-animal pone estos permisos:
chmod 777 ${ANIMAL}/{data,conf} find ${ANIMAL}/data -type d -exec chmod 777 {} \; chmod 666 ${ANIMAL}/conf/{local.php,acl.auth.php,users.auth.php}
Por otra parte, sabemos que es preferible usar permisos más restrictivos (aunque en este caso no haya otros usuarios en el servidor). Este artículo sugiere un método:
Apache Virtual Hosts - permissions (Slicehost)
Tratemos de aplicar eso:
$ groups efege $ sudo usermod -a -G www-data efege
Luego de volver a loguearme:
$ groups efege www-data
$ sudo chgrp -R www-data /home/efege/www/dokuwiki-farm/animals/biblio.inmabb-conicet.gov.ar/
conf:
$ chmod 640 biblio.inmabb-conicet.gov.ar/conf/* $ chmod 660 biblio.inmabb-conicet.gov.ar/conf/{acl.auth.php,users.auth.php,local.php}
data:
???
Falta hacer algo con estos comandos del artículo:
sudo chmod -R 2750 /home/demo/public_html sudo chmod -R 2770 /home/demo/public_html/domain1.com/public/uploads
Desde vm03 puedo entrar por ssh a catalis.uns.edu.ar.
Instalé mc y screen. No sé si usaré screen, pero mc seguro que sí.
Algunas ideas para implementar backups:
$ sudo cat /var/log/dpkg.log | grep install ... 2009-05-20 03:14:35 install python2.4-minimal <none> 2.4.4-3+etch2 2009-05-20 03:14:35 install python2.4 <none> 2.4.4-3+etch2 2009-05-20 03:14:36 install python-minimal <none> 2.4.4-2 2009-05-20 03:14:36 install python <none> 2.4.4-2 2009-05-20 03:14:36 install python-central <none> 0.5.12 2009-05-20 03:14:36 install libapache2-mod-python <none> 3.2.10-4 2009-05-20 03:40:03 install debian-backports-keyring <none> 2007.06.10 2009-05-20 03:50:57 install python-support <none> 0.5.6 2009-05-20 03:50:57 install python-django <none> 1.0.2-1~bpo40+1 2009-05-20 18:54:18 install libgpmg1 <none> 1.19.6-25 2009-05-20 18:54:18 install libglib2.0-0 <none> 2.12.4-2+etch1 2009-05-20 18:54:18 install libglib2.0-data <none> 2.12.4-2+etch1 2009-05-20 18:54:18 install mc <none> 1:4.6.1-6 2009-05-20 19:00:56 install screen <none> 4.0.3-0.3 2009-05-21 23:37:00 install ntp <none> 1:4.2.2.p4+dfsg-2etch3 ...
Para poder descargar código de repositorios svn (p.ej. Catalis, OpacMarc).
$ sudo apt-get install subversion $ sudo apt-get install subversion-tools
Pensé que subversion-tools incluía wcgrep, pero no es así. Lo agrego manualmente:
$ wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/wcgrep $ mkdir ~/bin $ mv wcgrep ~/bin/ $ sudo ln -s /home/efege/bin/wcgrep /usr/bin/
$ ./cgi-bin/wxis -bash: ./cgi-bin/wxis: No such file or directory
Supongo que por estar compilados para 32 bits, no funcionan en la MV con arquitectura de 64 bits.
Siguiendo la recomendación de The Debian GNU/Linux AMD64 HOW-TO, vamos a instalar el paquete ia32-libs:
$sudo apt-get install ia32-libs Reading package lists... Done Building dependency tree... Done The following extra packages will be installed: lib32asound2 lib32gcc1 lib32ncurses5 lib32stdc++6 lib32z1 libasound2 libc6-i386 lsb-release Suggested packages: ia32-libs-gtk libasound2-plugins Recommended packages: lsb The following NEW packages will be installed: ia32-libs lib32asound2 lib32gcc1 lib32ncurses5 lib32stdc++6 lib32z1 libasound2 libc6-i386 lsb-release 0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded. Need to get 14.9MB of archives. After unpacking 38.3MB of additional disk space will be used. Do you want to continue [Y/n]? Y
En efecto:
$ www/opacmarc/opacmarc-2009.04.29/cgi-bin/wxis hello Content-type: text/plain CISIS Interface v5.2b/GC/M/32767/10/30/I - XML IsisScript WWWISIS 7.1 CISIS Interface v5.2b/.iy0/Z/4GB/GIZ/DEC/ISI/UTL/INVX/B7/FAT/CIP/CGI/MX Copyright (c)BIREME/PAHO 2006. [http://www.bireme.br/products/cisis] WXIS release date: 20090523 WXIS|missing error|parameter|IsisScript|
Resumen de los pasos:
# Catalis cd ~/downloads/ wget http://catalis.uns.edu.ar/dl/catalis-2005.06.09-linux.tgz untgz catalis-2005.06.09-linux.tgz mkdir ~/www/catalis mv catalis-2005.06.09 ~/www/catalis/ # wxis wget http://bvsmodelo.bvsalud.org/download/wwwisis/1030/linux/wxisisis.tgz untgz wxisisis.tgz ./wxis what cp wxis ../www/catalis/catalis-2005.06.09/cgi-bin/catalis_pack/ # Apache sudo nano /etc/apache2/sites-available/catalis-2005.06.09 sudo a2ensite catalis-2005.06.09 sudo apache2ctl graceful cd ~/www/catalis/catalis-2005.06.09/ # config nano cgi-bin/catalis_pack/catalis/config/catalis.conf # var SCRIPT_URL = "/cgi-bin/catalis_pack/wxis"; nano htdocs/catalis_pack/catalis/inicio.htm # permisos chmod 777 bases/catalis_pack/catalis/access_logs chmod 666 bases/catalis_pack/catalis/demo/biblio.* chmod 666 bases/catalis_pack/catalis/demo/cn.txt chmod 666 bases/catalis_pack/catalis/celtic/biblio.* chmod 666 bases/catalis_pack/catalis/celtic/cn.txt
Acceso: http://vm03.criba.edu.ar:8090/catalis_pack/catalis/inicio.htm
Problema de codificación de caracteres en inicio.htm
:
Informaci�n general y acceso a la versi�n m�s reciente
Esto se debe a que Apache envía el header
Content-Type: text/html; charset=UTF-8
Para analizar posibles soluciones, ver Setting charset information in .htaccess (W3C I18N FAQ)
¿Qué otros datos enviados por el servidor presentan este problema?
Cómo se establece el charset en Apache (Debian/Ubuntu):
/etc/apache2/apache2.conf
# Include generic snippets of statements Include /etc/apache2/conf.d/
$ ls /etc/apache2/conf.d/ charset
$ cat /etc/apache2/conf.d/charset AddDefaultCharset UTF-8
Leer AddDefaultCharset Directive (Apache 2.2 docs).
Una solución posible consiste en añadir la directiva
AddDefaultCharset iso-8859-1
en la configuración del virtual host.
Instalamos siguiendo OPACMARC - Guía de instalación (versión 2006.11.13).
$ apt-cache search agrep ding - Graphical dictionary lookup program for Unix (Tk) libagrep-ocaml - Wu-Manber algorithm for string searching with errors libagrep-ocaml-dev - Wu-Manber algorithm for string searching with errors tre-agrep - approximate grep utility based on the tre library
Parece que agrep no está disponible en los repositorios configurados en /etc/apt/sources.list
:
deb http://ftp.us.debian.org/debian/ etch main contrib non-free deb-src http://ftp.us.debian.org/debian/ etch main contrib non-free deb http://security.debian.org/ etch/updates main contrib non-free deb-src http://security.debian.org/ etch/updates main contrib non-free deb http://www.backports.org/debian etch-backports main contrib non-free
Sin embargo, según http://packages.debian.org/etch/agrep, el paquete agrep está en non-free para Debian Etch. Sucede que no está disponible para la arquiteectura amd64, aunque sí está disponible para esa amd64 en lenny, squeeze y sid. ¿Qué se hace en este caso?
La duda me sirvió para ingresar por primera vez al canal de IRC #debian (irc.oftc.net o irc.debian.org?). La respuesta que obtuve es:
/msg dpkg source .. try to build it yourself
/msg dpkg source
produce esto en la ventana de chat:
To work with Debian source packages, cd to a location with free space. As root: 'aptitude install build-essential fakeroot devscripts' and 'apt-get build-dep {packagename}'. As any user: 'apt-get source {packagename}', cd into the directory it creates, edit 'debian/rules' to suit, run 'debuild -us -uc'. You need deb-src lines in /etc/apt /sources.list for apt-get source to work. Ask me about <deb-src>.
Si seguimos esas instrucciones, deberíamos tener agrep funcionando en vm03.
$ cd ~/tmp $ sudo aptitude install fakeroot devscripts
(build-essential ya estaba instalado)
$ sudo apt-get build-dep agrep Reading package lists... Done Building dependency tree... Done The following NEW packages will be installed: debhelper dpatch gettext gettext-base html2text intltool-debian po-debconf 0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded. Need to get 3221kB of archives. After unpacking 10.0MB of additional disk space will be used. Do you want to continue [Y/n]? Y
$ apt-get source agrep Reading package lists... Done Building dependency tree... Done Need to get 187kB of source archives. Get:1 http://ftp.us.debian.org etch/non-free agrep 4.17-3 (dsc) [557B] Get:2 http://ftp.us.debian.org etch/non-free agrep 4.17-3 (tar) [89.5kB] Get:3 http://ftp.us.debian.org etch/non-free agrep 4.17-3 (diff) [97.1kB] Fetched 187kB in 2s (67.6kB/s) gpg: can't open `/gnupg/options.skel': No such file or directory gpg: Signature made Wed 05 Jul 2006 08:35:01 AM ART using DSA key ID 4B2B2B9E gpg: Can't check signature: public key not found dpkg-source: extracting agrep in agrep-4.17 dpkg-source: unpacking agrep_4.17.orig.tar.gz dpkg-source: applying ./agrep_4.17-3.diff.gz
$ cd agrep-4.17
No toco nada en debian/rules
(pues no se me ocurre qué tocar!).
$ debuild -us -uc
Y bien… el resultado del build es un montón de cosas, entre ellas el archivo agrep_4.17-3_amd64.deb. Según APT HOWTO, Chapter 6 - Working with source packages ahora hay que ejecutar sudo dpkg -i agrep_4.17-3_amd64.deb
.
$ sudo dpkg -i agrep_4.17-3_amd64.deb Password: Selecting previously deselected package agrep. (Reading database ... 21427 files and directories currently installed.) Unpacking agrep (from agrep_4.17-3_amd64.deb) ... Setting up agrep (4.17-3) ... $ agrep usage: agrep [-@#abcdehiklnoprstvwxyBDGIMSV] [-f patternfile] [-H dir] pattern [files] summary of frequently used options: (For a more detailed listing see 'man agrep'.) ... $ which agrep /usr/bin/agrep
(Moví todo a ~/source-builds/agrep/
.)
# descarga cd ~/downloads wget http://inmabb.criba.edu.ar/varios/opacmarc/opacmarc-2006.11.13-linux.tgz # descompresión untgz opacmarc-2006.11.13-linux.tgz mkdir ~/www/opacmarc mv opacmarc-2006.11.13 ~/www/opacmarc/ cd ~/www/opacmarc/opacmarc-2006.11.13/ # wxis cp ~/downloads/wxis cgi-bin/opacmarc/ # configuraciones nano cgi-bin/opacmarc/opac/config/local.conf nano opacmarc-admin/conf.sh # permisos chmod 777 bases/opacmarc/opac/access_logs/ # apache sudo cp /etc/apache2/sites-available/catalis-2005.06.09 /etc/apache2/sites-available/opacmarc-2006.11.13 sudo nano /etc/apache2/sites-available/opacmarc-2006.11.13 sudo a2ensite opacmarc-2006.11.13
Pendiente:
nano opacmarc-admin/conf.sh
Oct 14, 2009. Creé una cuenta revumadir
para uso de los directores de la Revista de la UMA. Para que puedan transferir archivos por SCP, pero sin tener acceso al shell, ejecuté el comando
$ sudo chsh -s /sbin/nologin revumadir
Luego del cambio, se ve el efecto en /etc/passwd
:
$ sudo grep revuma /etc/passwd- revumadir:x:1001:1001:Directores Revista de la UMA,,,:/home/revumadir:/bin/bash $ grep revuma /etc/passwd revumadir:x:1001:1001:Directores Revista de la UMA,,,:/home/revumadir:/sbin/nologin
Resulta que no sólo no permite el login, sino que tampoco se puede acceder por WinSCP o por Nautilus para transferir archivos: el bloqueo es demasiado drástico. Tal vez lo que necesitamos es scponly.
Otra opción, que permite limitar los “movimientos” del usuario a su directorio home (sin tener acceso a nada fuera de él) es “chroot”, pero parece que tiene sus complicaciones. Ver: Howto Setup a chroot jail for ssh / scp / sftp with Linux
Por ahora lo dejo así:
$ sudo chsh -s /bin/rbash revumadir
Bash restringido para el usuario revumadir (pero no le impide leer archivos fuera de su $HOME).
Para proteger los archivos de revumadir de miradas indiscretas:
$ sudo chmod -R o-r /home/revumadir/
Aparentemente /bin/rbash permite scp pero no sftp; por otra parte permite un login por shell y ejecutar varios comandos.
La solución que me parece mejor por ahora es rssh (“a restricted shell for use with OpenSSH, allowing only scp and/or sftp”):
$ sudo apt-get install rssh $ sudo chsh -s /usr/bin/rssh revumadir
22 oct 2009. Intento compilar Malete para poder hacer pruebas públicas con el nuevo OPAC. Uso el código fuente de http://malete.org/tar/malete.1.0.3.tgz
efege@vm03:~/downloads/malete-1.0.3$ make -C mlt server make: Entering directory `/home/efege/downloads/malete-1.0.3/mlt' cc -c -I. -g -O2 -Wall -W -Wshadow -Winline -o ../bin/malete.o malete.c cc -c -I. -g -O2 -Wall -W -Wshadow -Winline -o ../bin/uti.o uti.c uti.c: In function ‘lOut’: uti.c:846: error: incompatible types in assignment make: *** [../bin/uti.o] Error 1 make: Leaving directory `/home/efege/downloads/malete-1.0.3/mlt'
Veamos la versión del compilador:
$ which cc /usr/bin/cc $ ll /usr/bin/cc lrwxrwxrwx 1 root root 20 2009-05-20 02:13 /usr/bin/cc -> /etc/alternatives/cc $ ll /etc/alternatives/cc lrwxrwxrwx 1 root root 12 2009-05-20 02:13 /etc/alternatives/cc -> /usr/bin/gcc $ ll /usr/bin/gcc lrwxrwxrwx 1 root root 7 2009-05-20 02:13 /usr/bin/gcc -> gcc-4.1
En cambio en mi PC de la biblioteca tengo:
$ which cc /usr/bin/cc $ ll /usr/bin/cc lrwxrwxrwx 1 root root 20 2007-10-23 03:00 /usr/bin/cc -> /etc/alternatives/cc $ ll /etc/alternatives/cc lrwxrwxrwx 1 root root 12 2008-06-12 18:30 /etc/alternatives/cc -> /usr/bin/gcc $ ll /usr/bin/gcc lrwxrwxrwx 1 root root 7 2008-06-12 18:30 /usr/bin/gcc -> gcc-4.2
Además, esto puede ser importante:
$ uname -a Linux vm03 2.6.18-6-xen-amd64 #1 SMP Thu Dec 25 22:21:42 UTC 2008 x86_64 GNU/Linux
Luego de consultas a Klaus y Braulio, y una sugerencia de Klaus que no alcanzó para permitir la compilación, decidí probar si el binario compilado en mi PC de la biblioteca anda en el servidor. Y sí, funciona. Pero no sé si eso es “lo correcto” (dice Klaus que sí).
DUDA: necesito bloquear de alguna manera el acceso al puerto 2042 que usa malete? Sí. Hecho. Ver abajo (Firewall).
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:2042 0.0.0.0:* LISTEN 12383/malete
Muevo malete
al directorio $HOME/bin
, que está en $PATH
.
Instrucciones: Making scripts run at boot time with Debian.
$ sudo nano /etc/init.d/malete.sh $ sudo chmod 755 /etc/init.d/malete.sh $ sudo update-rc.d malete.sh defaults $ sudo /etc/init.d/malete.sh start
Archivo /etc/init.d/malete.sh
#! /bin/sh # /etc/init.d/malete.sh # MALETE=/home/efege/bin/malete MALETE_DB_ROOT=/home/efege/www/opac2009/tangled/testdata # Some things that run always #touch /var/lock/blah # Carry out specific functions when asked to by the system case "$1" in start) echo "Starting malete" cd $MALETE_DB_ROOT $MALETE server -S & ;; stop) echo "Stopping malete" pkill malete ;; *) echo "Usage: /etc/init.d/malete {start|stop}" exit 1 ;; esac exit 0
Problema: especificar directorio para las bases. ¿Se puede pasar un parámetro al comando malete
, o hacemos cd
antes de ejecutarlo? Por ahora, uso la 2da opción.
¿Necesitamos para algo el comando 'start-stop-daemon
?
Probé en mi netbook y no funciona el stop/start: sólo detiene el demonio, pero no lo reinicia.
En vm03 a veces aparece este error al ejecutar el script opacdemo.sh
:
Starting malete could not bind to '*:2042': Address already in use
y Malete no se inicia.
09-nov:
Some days I find that malete has stopped working. Last time I found this in the logs:
/var/log/kern.log.0:Nov 8 06:25:02 vm03 kernel: malete[20868]: segfault at 00000000ff017728 rip 000000000804c1d2 rsp 00000000ff017720 error 6 /var/log/messages.0:Nov 8 06:25:02 vm03 kernel: malete[20868]: segfault at 00000000ff017728 rip 000000000804c1d2 rsp 00000000ff017720 error 6 /var/log/syslog.0:Nov 8 06:25:02 vm03 kernel: malete[20868]: segfault at 00000000ff017728 rip 000000000804c1d2 rsp 00000000ff017720 error 6
Sugerencia de Klaus para salir del paso:
I actually run it in a loop like while :; do /opt/bin/malete server -S/lh/root/tmp/malete docu -w0 >/dev/null 2>&1 echo "OOOPSI! restarting `date`" done >>/tmp/malete.log &
Implementada 16-nov-2009. El 23-nov-2009 el log tiene este aspecto:
$ more /tmp/malete.log OOOPSI! restarting Thu Nov 19 15:08:12 ART 2009 OOOPSI! restarting Thu Nov 19 15:08:52 ART 2009 OOOPSI! restarting Thu Nov 19 15:08:52 ART 2009 OOOPSI! restarting Fri Nov 20 00:27:06 ART 2009 OOOPSI! restarting Fri Nov 20 20:24:13 ART 2009 OOOPSI! restarting Fri Nov 20 20:24:13 ART 2009
El 8-dic-2009 sigue igual.
Lo que no sé es por qué tenemos tantos procesos malete (8-dic-2009):
$ ps -A | grep malete 21072 ? 00:00:00 malete.sh 21073 ? 00:00:00 malete 11244 ? 00:00:00 malete 11247 ? 00:00:00 malete 12373 ? 00:00:00 malete 13924 ? 00:00:00 malete 13925 ? 00:00:00 malete 14033 ? 00:00:00 malete 14034 ? 00:00:00 malete
Los mato (comenzando por malete.sh
, pues de lo contrario malete.sh
vuelve a crear un proceso malete
), vuelvo a ejecutar sudo /etc/init.d/malete.sh start
y sudo /etc/init.d/apache2 reload
; ahí quedan solamente malete.sh
y un malete
. Pero luego de hacer algunas consultas al OPAC vuelven a aparecer varios procesos malete
!
Si Malete funciona, entonces podemos pasar a preparar el escenario para hacer pruebas con el nuevo OPAC.
No voy a utilizar el servidor de desarrollo de Django, sino que voy a seguir las recomendaciones de How to use Django with Apache and mod_wsgi, pues según dice allí “Deploying Django with Apache and mod_wsgi is the recommended way to get Django into production.” Instrucciones más detalladas en el wiki del proyecto modwsgi, Integration With Django.
$ sudo apt-get install libapache2-mod-wsgi
(Apache se reinicia. Hasta ahí, sin problemas.)
Ahora creo un virtual host para el nuevo opac:
/etc/apache2/sites-available/opac2009
con el respectivo link en
/etc/apache2/sites-enabled/opac2009 -> /etc/apache2/sites-available/opac2009
Reinicio Apache (sudo /etc/init.d/apache2 restart).
Probé de acceder a http://opac2009.inmabb-conicet.gob.ar:88/
y recibía un error HTTP 503. (Pero Claudia desde el IAR recibía un error HTTP 500!). Pareciera ser entonces un problema entre proxy y/o puerto.
Desactivé el virtual host de dokuwiki (que usa el puerto 8080), y probé con
http://opac2009.inmabb-conicet.gob.ar:8080/
que ya no tiró ese error. Pero… le da lo mismo cualquier subdominio! P.ej.
http://test123.inmabb-conicet.gov.ar:8080/
también anda.
A partir de ahí aparecían errores HTTP 500; tuve que revisar /var/log/apache2/error.log
en busca de los errores que iba largando Python.
Son errores de configuración, que tendremos que mirar con cuidado para el instructivo de instalación del OPAC.
Hay que agregar pymarc, ya sea instalando el paquete, o copiando los archivos en libs. Copié los archivos de pymarc-2.40 (venía usando 2.33).
pymarc tira un error (en python 2.4) “No module named elementtree.ElementTree”, que ya había encontrado tiempo atrás. Aparece en marcxml.py
. Puedo instalar el paquete python-elementtree
, o bien prescindir de marcxml.py
por ahora (hago eso editando pymarc/__init__.py
)
Definir una clase como class Foo()
en lugar de class Foo
da error en Python 2.4 (también lo había visto alguna vez).
Y luego de varios retoques más, a los apurones, anduvo.
Ahora hay que pasar en limpio esos retoques:
apache
con la configuración wsgi (django.wsgi
)pymarc
dentro de libs
(no instalamos pymarc
)pymarc
usando easy_install
, para no tener que pelear con problemas de sys.path. Necesito python-setuptools
.pymalete.py
, corregir class Foo()
views.py
: revisar la línea con sys.path
libs
deben corregirsearchivo /etc/apache2/sites-available/opac2009:
Listen 8080 NameVirtualHost *:8080 <VirtualHost *:8080> ServerName opac2009.inmabb-conicet.gov.ar Alias /site_media/ /home/efege/www/opac2009/tangled/django_opac/newopac/static/ <Directory /home/efege/www/opac2009/tangled/django_opac/newopac/static> Order deny,allow Allow from all </Directory> WSGIScriptAlias / /home/efege/www/opac2009/apache/django.wsgi </VirtualHost>
archivo apache/django.wsgi:
import os import sys sys.path.append('/home/efege/www/opac2009/tangled') sys.path.append('/home/efege/www/opac2009/tangled/django_opac') sys.path.append('/home/efege/www/opac2009/libs') os.environ['DJANGO_SETTINGS_MODULE'] = 'django_opac.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
$ sudo apt-get install python-setuptools $ sudo easy_install pymarc Searching for pymarc Reading http://www.python.org/pypi/pymarc/ Reading http://launchpad.net/pymarc Reading http://www.python.org/pypi/pymarc/2.40 Best match: pymarc 2.40 Downloading http://pypi.python.org/packages/source/p/pymarc/pymarc-2.40.tar.gz#md5=86c42c61b05ca91efe605cbe34738225 Processing pymarc-2.40.tar.gz Running pymarc-2.40/setup.py -q bdist_egg --dist-dir /tmp/easy_install-YvNbbQ/pymarc-2.40/egg-dist-tmp-QzaJUG The required version of setuptools (>=0.6c5) is not available, and can't be installed while this script is running. Please install a more recent version first. (Currently using setuptools 0.6c3 (/usr/lib/python2.4/site-packages)) error: Setup script exited with 2
Is that newer version of setuptools really needed?
Mejor volvamos a dejar pymarc dentro de libs (más fácilmente portable), ajustando los paths en la config. wsgi.
Por una parte, un problema de compatibilidad: parece que no se puede leer en una máquina un shelve generado en otra (¿con diferente arquitectura?):
$ python Python 2.4.4 (#2, Oct 22 2008, 20:20:22) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import shelve >>> shelve.open('db_lengths') # does exist, created with python 2.5 in a 32 bit machine Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.4/shelve.py", line 234, in open return DbfilenameShelf(filename, flag, protocol, writeback, binary) File "/usr/lib/python2.4/shelve.py", line 215, in __init__ Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback, binary) File "/usr/lib/python2.4/anydbm.py", line 83, in open return mod.open(file, flag, mode) File "/usr/lib/python2.4/dbhash.py", line 16, in open return bsddb.hashopen(file, flag, mode) File "bsddb/__init__.py", line 298, in hashopen bsddb.db.DBInvalidArgError: (22, 'Invalid argument -- ./db_lengths: unsupported hash version: 9') >>> shelve.open('pepe') # does not exist {}
Ver: Comments on python shelve module incompatibility
Lo resuelvo ejecutando de nuevo update_opac.py
:
rm -f testdata/demo/ (no todo, hay que salvar los dos archivos *.mrc básicos) python opaccore/update_opac.py demo
Por otra parte, había un error por falta de permisos para escribir en el shelve, pero eso se debe a que el default es abrir un shelve para lectura y escritura; ahora se abre para sólo lectura.
El script ~/bin/opacdemo.sh
está andando bien. Toma el código de la carpeta unison
y lo copia a ~/www/opac2009
; luego ejecuta python update_opac.py demo
y reinicia los servidores.
Lo importante (que me suelo olvidar) es hacer el tangling en mi PC antes de transferir los archivos con Unison al servidor. O bien, hacer el tangling en el servidor.
¿Por qué veo este mensaje de malete al reiniciar apache?
$ sudo /etc/init.d/apache2 reload Reloading web server config...1374 got 0 in recv .
Para bloquear el acceso al puerto 2042 (malete) desde afuera, configuré iptables
en base a las indicaciones de Debian Etch setup (Slicehost). La secuencia de comandos usada (reiteradas veces, para hacer algunas pruebas) es:
$ sudo -i # nano /etc/iptables.test.rules # iptables-restore < /etc/iptables.test.rules # iptables -L # iptables-save > /etc/iptables.up.rules
Además,
# nano /etc/network/interfaces
para añadir la línea
pre-up iptables-restore < /etc/iptables.up.rules
Dejé habilitado el acceso a los puertos 80, 443, 22 y 8080.
Falta consultar a Santiago.
$ apt-cache search "log anal" | grep serv awffull - web server log analysis program awstats - powerful and featureful web server log analyzer visitors - A fast web server log analyzer webalizer - web server log analysis program $ sudo apt-get install awstats
TODO: leer http://awstats.sourceforge.net/docs/awstats_setup.html
Usuario uma
creado, 24-nov-2009.
Creado vhost de Apache para pruebas (ServerName uma.inmabb-conicet.gob.ar).
A fines de agosto de 2011 creé un usuario visitante
para permitir que Félix Bou (visitante que estuvo unos días con Patricio Díaz Varela) se conectase por ssh a su máquina de Barcelona. Luego de unos días, deshabilité el usuario mediante sudo passwd -l visitante
.
Luego de haber detectado gran cantidad de intentos de login como root, edité /etc/ssh/sshd_config
y cambié PermitRootLogin yes
por PermitRootLogin no
.