viernes, 16 de julio de 2010

Compartir ficheros en Kubuntu Lucid Lynx usando Samba.

   Este tutorial muestra como compartir ficheros entre diferentes equipos Linux (en concreto Kubuntu) y entre Kubuntu y Windows. Samba es un demonio (programa que se ejecuta en segundo plano) de Linux que se encarga de la compartición de ficheros entre máquinas.


   El primer paso consiste en instalar samba, para ello abrimos un terminal o konsole e introducimos lo siguiente:

sudo aptitude install samba samba-client smbfs smbclient

   Para poder compartir archivos hay que indicar que una carpeta es de compartición. Esta carpeta compartida es aconsejable que se use únicamente para compartir ficheros entre equipos. Por ejemplo, vamos a construir la carpeta public en el directorio /home/public. Para ello en el terminal escribimos:

sudo mkdir /home/public

   Se asignan los permisos necesarios para que los demás equipos puedan acceder a los datos, modificarlos, borrarlos, ...


sudo chmod ugo+rwx /home/public

   Ahora sólo falta especificar que se trata de una carpeta compartida, para hacer esto en Kubuntu editamos el siguiente fichero:

sudo vim /etc/samba/smb.conf


   Nos desplazamos hasta el final del fichero pulsamos la tecla i y a continuación pegamos el siguiente código:

[public]
  comment =  Carpeta compartida
  path = /home/public/
  public = yes
  writeable = yes

  Nota: Para pegar el código en vim se puede usar Shift+Insert.
   Guarda y sal del vim pulsando Esc + :x
 
  Es necesario reiniciar el demonio samba para que los cambios surtan efecto, por lo que el siguiente comando reinicia el servidor samba.


sudo smbd restart


   Con lo hecho hasta el momento, ya la carpeta debe ser compartida por ordenadores Linux. Para compartir ficheros con Windows habrá que hacer lo siguiente:
Primero en la máquina Kubuntu añadimos el usuario de la máquina Windows. Para ello, en la konsole escribimos

sudo useradd -s /usr/sbin/nologin Usuario_de_Windows.
  Donde obviamente Usuario_de_Windows es el nombre de usuario del ordenador con Windows. Lo siguiente es añadir la contraseña que se utilizará para hacer transferencias a través de la red.


sudo smbpasswd -a Contraseña_De_Red
  Donde Contraseña_De_Red es la que nosotros queramos.



  En la máquina Windows, una vez hecho todo lo anterior, estando en el escritorio pulsamos Win+r, o bien Inicio -> Ejecutar. En el cuadro de texto escribimos:

\\Dirección_De_Red_Privada\public

  Donde Dirección_De_Red_Privada es la dirección privada del equipo de Kubuntu en la red. que ¿cómo sé cuál es la dirección privada del equipo de Kubuntu? Pues simple, en la terminal de Kubuntu escribe:

ifconfig

Y pondrá algo como:

eth0      Link encap:Ethernet  direcciónHW 00:1f:d0:db:b3:68 
          Direc. inet:192.168.1.33  Difus.:192.168.1.255  Másc:255.255.255.0

A la que me refiero es a la dirección inet: 192.168.1.33

Mucha suerte.
            

domingo, 16 de mayo de 2010

EPSON SX400 Kubuntu Impresora + Escáner.

Si estás utilizando Kubuntu 8.10 o mayor debes instalar:

sudo apt-get install libltdl7

luego, hay que bajar el siguiente paquete e instalarlo. Es un deb, simplemente un clic y ya se instala solo.

iscan_2.24.0-4.ltdl7_i386.deb


Hay un post que explica otras cosas que se pueden hacer si el hecho de instalar solamente el paquete anterior no funciona.

Además en un comentario del post que pongo a continuación y a su vez en varias páginas más como en algún foro de ubuntu se recomienda también añadir al fichero /lib/udev/rules.d/40-libsane.rules las siguientes líneas:

# Epson SX400 scanner
ATTRS{idVendor}==”04b8″, ATTRS{idProduct}==”084a”, ENV{libsane_matched}=”yes”

Por cierto, el fichero .deb está originalmente sacado de:

http://www.avasys.jp/lx-bin2/linux_e/spc/DL1.do

Este post está sacado de:

http://blog.bluemonki.net/2009/03/28/ubuntu-epson-sx400-all-in-one-making-it-work/

Sólo he probado la parte del escáner y funciona correctamente.

Printing
First off make sure you have cupsys installed, from a Terminal (Applications->Accessories->Terminal) type:
sudo apt-get install cupsys (input your password if asked)
And say yes if you need to.
Right now it’s time to go and grab the driver, visit http://www.avasys.jp/lx-bin2/linux_e/spc/DL1.do and fill in the form to get the driver for your printer (SX400 in my case).
You should now have a deb file that you can double click on and install. Right, now make sure the printer is connected and turned on.
Then, in a terminal, type:
sudo pipslite-install
This will have a bit of a poke around and probably appear with just a cancel button. If it does appear with a cancel button then reboot your computer and try again (which worked for me).
When you get a continue button then you need to fire up the printing configuration program (System->Administration->Printing), click Change on the right of where the driver name is written and choose the driver model called LITE. Then choose the recommended driver.
Now you should be able to print a test page :D
Scanning
Scanning is a little bit harder, but not impossible. First off lets make sure we’ve got all the scanning tools installed:
sudo apt-get install sane sane-utils
Once again say yes to everything.
When that’s done run:
sudo sane-find-scanner
This should hopefully produce some thing that looks like:
$ sane-find-scanner
# sane-find-scanner will now attempt to detect your scanner. If the
# result is different from what you expected, first make sure your
# scanner is powered up and properly connected to your computer.

# No SCSI scanners found. If you expected something different, make sure that
# you have loaded a kernel SCSI driver for your SCSI adapter.
found USB scanner (vendor=0x04b8, product=0x084a) at libusb:005:002
# Your USB scanner was (probably) detected. It may or may not be supported by
# SANE. Try scanimage -L and read the backend's manpage.
# Not checking for parallel port scanners.
# Most Scanners connected to the parallel port or other proprietary ports
# can't be detected by this program.
# You may want to run this program as root to find all devices. Once you
# found the scanner devices, be sure to adjust access permissions as
# necessary.
What you need are those two kind of number looking things:
vendor=0x04b8, product=0x084a
Now we have those we need to add them to a file, so now type:
sudo gedit /etc/sane.d/epson.conf (assuming your scanner is an epson)
Find the line that just says: usb
# USB scanner:
# There are two different methods of configuring a USB scanner: libusb and the kernel module
# For any system with libusb support (which is pretty much any recent Linux distribution) the
# following line is sufficient. This however assumes that the connected scanner (or to be more
# accurate, it's device ID) is known to the backend.
usb
# For libusb support for unknown scanners use the following command

And change it to make it read:
# USB scanner:
# There are two different methods of configuring a USB scanner: libusb and the kernel module
# For any system with libusb support (which is pretty much any recent Linux distribution) the
# following line is sufficient. This however assumes that the connected scanner (or to be more
# accurate, it's device ID) is known to the backend.
usb 0x04b8 0x084a
# For libusb support for unknown scanners use the following command

Obviously use your numbers not mine (unless you have a SX400 too), save that and close it.
Right lets see if it works at all, type
sudo xsane
Click OK to the warning. In the large window towards the right of the screen (titled Preview ….) click the Aquire button. If you get an image back then we’re all set to go. If you don’t then I can’t help you as it worked perfectly for me.
Now we need to make the scanner available for everyone to use so once again from the terminal type:
sudo gedit /etc/udev/rules.d/90-modprobe.rules
and add the line:
SUBSYSTEM=="usb" ATTRS{manufacturer}=="EPSON", GROUP="scanner", OWNER="root", MODE="0660"
Save that, now we need to create a script to load our map so type:
sudo gedit /etc/hotplug/usb/epson_scanner.sh
And add the lines
#!/bin/bash
if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
chown root "${DEVICE}"
chgrp scanner "${DEVICE}"
chmod 660 "${DEVICE}"
fi
And save it.
Right that’s it. Reboot and you should be able to use your scanner via xsane (Applications->Graphics->XSane Image Scanner)
Reference
Printing: http://ubuntuforums.org/showthread.php?t=903905
Scanning: http://www.freecolormanagement.com/sane/libusb.html
Enjoy!

miércoles, 17 de marzo de 2010

martes, 16 de febrero de 2010

Crear tablas en MySQL y cargar datos desde un fichero.

  • Crear una tabla:
CREATE TABLE LIBROS ( ISBN INT(4) PRIMARY KEY,
                      T VARCHAR(80),
                      NP VARCHAR(80),
                      CAT VARCHAR(80),
                      ED(80));
  • Crear una tabla con claves ajenas:
CREATE TABLE AUTORES( ISBN INT(4),
                      DNI INT(4),
                      FOREIGN KEY(ISBN) REFERENCES LIBROS(ISBN) 
                      ON DELETE CASCADE
                      ON UPDATE CASCADE);
  • Cargar datos en una tabla desde un fichero donde cada colummna va separada por tabuladores o espacios.
LOAD DATA LOCAL INFILE "libros.txt" INTO TABLE LIBROS;

domingo, 14 de febrero de 2010

Instalar fuentes libres de Office 2007 en Kubuntu.

Las fuentes de libres de Office que vamos a instalar son las siguientes:

Calibri, Cambria, Candara, Consolas, Constantia, y Corbel.

$sudo apt-get install cabextract curl
 Guarda el siguiente script en un archivo llamado vista-fonts-installer.sh
$ chmod a+x ~/vista-fonts-installer.sh
 
$ ~/vista-fonts-installer.sh 
 Otras fuentes interesantes como Airal, Times New Roman....
$ apt-get install msttcorefonts