martes, 31 de julio de 2007

MySQL: restaurar un dump (backup) de una database

mysql -u #username# -p #database# < #dump_file#

martes, 24 de julio de 2007

Origami: Rose Cube en YouTube

  • http://www.youtube.com/watch?v=E2Yr_SIXkVo

Excelente

lunes, 23 de julio de 2007

Bash: buscar archivos de cierta extension y grabarlos en otro archivo

find -iname *.png > pngfiles

Bash: extraer multiples archivos tar

Para extraer múltiples archivos tar (tar.gz o tar.bz2) en un cierto directorio "extracted", se necesito una lista con el nombre de los archivos a extraer, y luego un for para recorrerla e ir haciendo la extracción individual de cada archivo en el directorio "extracted".

Comando:

for a in $(ls *.tar*); do tar -xvzf $a -C extracted; done

P2PMPI: Configuracion de Variables

Editar el archivo .profile del home del usuario y añadir las siguientes entradas:

#P2P-MPI
export P2PMPI_HOME=/home/martin/bin/p2pmpi-0.22.0
export JXTA_PATH=/home/martin/bin/jxta/myjxta-2.4.1/lib
export PATH=$PATH:$P2PMPI_HOME/bin
export CLASSPATH=$CLASSPATH:$P2PMPI_HOME/p2pmpi.jar

Instalar Netbeans y Java (JDK6)

  1. Descargar JAVA
  2. Extraer el paquete en el directorio donde queremos instalarlo
  3. Editar el archivo .profiile del home del usuario (martin)=y añadir las siguientes entradas

    directorio donde se instalo java
    export JAVA_HOME='/home/martin/bin/java/jdk1.6.0_02'
    PATH=.:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

  4. Descargar Netbeans
  5. chmod +x netbeans*.bin
  6. sudo ./netbeans*.bin

domingo, 22 de julio de 2007

Plugin de java para Firefox (Ubuntu)

Post obtenido de:
  • http://www.ubuntu-es.org/index.php?q=node/49472

cito:
"

Primero bajamos el archivo de
http://www.java.com/en/download/linux_manual.jsp

Creamos el subdirectorio
# mkdir /usr/java

movemos el archivo descargado
# mv jre-6u1-linux-i586.bin /usr/java

Lo hacemos ejecutable
# chmod a+x jre-6u1-linux-i586.bin

Comenzamos la instalación aceptando el acuerdo
# ./jre-6u1-linux-i586.bin

Ahora vamos a
# cd /usr/lib/mozilla-firefox/plugins

y creamos un link simbólico
ln -s /usr/java/jre1.6.0_01/plugin/i386/ns7/libjavaplugin_oji.so

Eso es todo.

"

jueves, 19 de julio de 2007

VirtualBox: Como compartir carpetas entre el HOST (Ubuntu) y el Guest (WIndows)

La mejor fuente que encontré para realizar esto fue
  • http://tuxpepino.wordpress.com/2007/05/29/virtualbox-windows-en-ubuntu-linux/
Cito el texto del blog que detalla el proceso a seguir para compartir archivos entre el host (ubuntu) y el guest (windows). Muchas gracias a Creative Commons por su excelente manual de VirtualBox.

"

Compartir carpeta entre sistema anfitrión y huésped

Como decía antes, las Guest Additions deben estar instaladas. Vamos a compartir una carpeta. Os aconsejo que en vuestra carpeta personal haya una que sirva de intercambio con otros sistemas (reales o virtuales). Yo por ejemplo la he llamado “compartido“.

Ahora id a “Sistema > Administración > Carpetas compartidas“. Tras meter vuestra clave os preguntará si queréis instalar ciertos paquetes. Decidle que sí, es el soporte para compartir carpetas en redes Linux y redes Windows. Hecho esto, volved a “Sistema > Administración > Carpetas compartidas“. Ahora se abrirá una ventana. Dade a “Añadir“, en ruta buscad la carpeta que vais a compartir (en mi caso /home/ceec/compartido”, y en “Compartir a través de” seleccionad “Redes Windows (SMB)“. La casilla de “Sólo lectura” dejadla habilitada si no queréis que el visitante (o vosotros desde el Windows virtual) pueda copiar/borrar/modificar algo de esa carpeta. Si va a ser de intenrcambio real, deshabilitadlo. Aceptad.

Bien, compartida la carpeta vamos a hacer que nuestro Windows pueda acceder a ella. Para hacerlo tenemos que poner dos comandos, uno en Ubuntu y otro en Windows. Para el primero, abrimos consola y escribimos esto (es una sola línea):

$ sudo VBoxManage sharedfolder add “Wxp” -name “compartido” -hostpath “/home/nombre_tu_cuenta/compartido”

Tenéis que conservar las comillas dobles. “Wxp” es el nombre que le hemos dado a la máquina virtual, ha de ser exactamente igual, incluyendo mayúsculas y minúsculas. “compartido” es el nombre que recibirá el recurso compartido (valga la rebuznancia). Y la ruta final es la de la carpeta compartida.

Eso por la parte que le toca a Ubuntu. Ahora vamos a hacer que Windows pueda conectar con esa carpeta. Abrimos una consola de Windows (tecla_win+r, cmd, enter) y escribimos lo siguiente:

net use Z: \\vboxsvr\compartido

Te debe responder: “Se ha completado el comando correctamente“. En vez de Z, puedes usar otra letra, pero ha de ser una que no esté tomada por otra unidad. Ahora si vas a “Mi PC” verás que puedes acceder ya a dicha carpeta. Puedes hacer esto con tantas como quieras, aunque personalmente soy de la opinión de usar sólo una y simplemente muevo/copio los archivos a esa.



"

Virtual Box, Configurar un bridge entre interfaz NO inalámbrica e interfaz virtual.

Para lograr crear este tipo de bridges, se siguieron las siguientes guías:

  • http://www.virtualbox.org/discussion/1/141
  • http://www.virtualbox.org/wiki/Automatic_Bridge_Ubuntu

Me basé Principalmente la primer guía. Cito a continuación su contenido:

"

I have a "typical" production requirement. My linux host needs a static IP address. I also have a linux guest that needs a different IP address in the same subnet on the same ethernet interface.

I managed to get my system working using the instructions in the VirtualBox User Manual, but needed automatic configuration when the host system boots. I found so much confusing information around that I thought it would be useful to document what I did (and why it works). This guide applies to Ubuntu Dapper 6.06 LTS, but will probably apply to later releases and other Debian distributions.

The network interface drivers are loaded early in the boot process. Further configuration takes place under the control of /etc/rcS.d/S40networking, which uses the /etc/network/interfaces control file.

You need to have installed both the uml-utils and bridge-utils packages before you start.

The key concept is that you will create an internal (virtual) ethernet bridge on your host operating system. The only external interface on this bridge will be the real ethernet card on the machine. We will also define a TAP (virtual) interface on the bridge to be used by the guest machine. The host operating system does NOT need to know how this interface will be used.

I assume both the host and the guest machines need to access the external network, each using their own unique IP addresses.

1. Configure the real ethernet interface

You have probably already configured the real ethernet interface during installation of the host linux system. This is no longer required. Edit the /etc/network/interfaces file and change the relevant section (mine is eth0) as follows :

auto eth0

iface eth0 inet manual

This section says the eth0 interface is to be brought up automatically during system boot (and also with ifup -a), but the interface is NOT to be configured further.

2. Define a TAP interface to be used by the guest virtual machine

I decided my production virtual guest should always have its own virtual network adapter which is setup when the host system boots. It is defined by adding a new section to /etc/network/interfaces :

auto tap1

iface tap1 inet manual

tunctl_user brian

The name of this interface MUST match the Host Interface Name of the virtual adapter for the virtual machine.

It is not configured in the host system, because the guest operating system will configure the interface when it boots... either with static values or from a DHCP server.

The TAP interface will be created when the host system boots and it MUST be associated with a valid HOST username that the guest virtual machine will run under. It MUST also be a member of the uml-net group.

The tunctl_user attribute is processed by the /etc/network/if-up.d/uml-utilities script.

3. Define the ethernet bridge

The definitions in /etc/network/interfaces are processed in physical order. This means you MUST define the bridge AFTER the interfaces that will be associated with the bridge. Add a new section to the file something like this:

auto bridge0

iface bridge0 inet static

address 10.1.100.101

netmask 255.255.255.0

broadcast 10.1.100.255

gateway 10.1.100.1

bridge-ports eth0 tap1

bridge-ageing 7200

bridge-fd 0

The first few statements assign a meaningful static IP configuration to the external interface of the bridge. This ensures the bridge knows how to communicate with other hosts on the same local LAN. The gateway statement ensures the bridge can route messages to the rest of the network. (If you don't have a "production" environment, you could use "iface bridge inet dhcp" instead to get the interface automatically configured by a DHCP server.)

The following three bridge-* statements are processed by the script /etc/network/if-pre-up.d/uml-utilities. The external (real) and the TAP interfaces are both added to the bridge. This means the virtual machine will be able to communicate with the external network via the local LAN.

I set bridge-aging (equivalent to "brctl setageing") to 2 hours because only my virtual machines use the bridge and I do not expect them to change very much. I also set the forward delay to zero because I want to be sure the host and VM's get their messages sent quickly soon after they boot.

This bridge configuration will automatically create two IP routes on the host - one for the local LAN subnet and the other for a default route to the local gateway router. Both these routes are via the bridge. With this kind of setup, no explicit routes are required.

4. Testing

The new TAP interface can be brought up with "sudo ifup [-v] tap1" and down again with "sudo ifdown tap1". Verify it is UP without ANY IPv4 configuration using "ifconfig tap1".

The best way to reset the ethernet interface is with "sudo ifdown eth0" and "sudo ifup eth0". However, this might not work properly if your interface has been previously configured for IP. You can also try resetting it with "sudo ifconfig eth0 0.0.0.0 down", but I've not been able to get rid of an unwanted netmask (as others have suggested) by assigning all zeros. If "ifconfig eth0" still shows residual IPv4 configuration, you might need to reboot so the new /etc/network/interfaces becomes active.

You can bring up the bridge manually with "sudo ifup [-v] bridge0". You can verify your configuration with "ifconfig bridge0", "sudo brctl show bridge0" and "netstat -r". You should be able to access your local LAN and the rest of the external network from the host operating system.

Next, boot your virtual machine and use it's operating system tools to configure the virtual network interface. The VM should have access to the external network via the bridge.

Finally, shutdown and reboot the host. Confirm your bridge configuration is still as expected.

5. Other configurations

I haven't tested any other configurations, such as using DHCP for the bridge interface, or wireless 802.11 for the real network interface. However, I hope my procedure makes enough sense for you to adapt it to these other situations.

Virtual Box, Configurar un bridge entre interfaz inalámbrica y interfaz virtual

Para hacer esto se siguieron los comandos descritos en la siguiente página web:

  • http://www.ubuntu-es.org/index.php?q=node/51037

resumidos los mismos serían:

1. Ejecutar los siguientes comandos:
sudo aptitude install parprouted uml-utilities
sudo -i
chown root:vboxusers /dev/net/tun
tunctl -t tap1 -u usuario // Cambiar usuario por el nombre de tu usuario
ip link set tap1 up
ip addr add IP dev tap1 // Cambiar IP por la IP que ya asignamos al HOST (Ubuntu en este caso). Ej.: 192.168.1.4
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/tap1/proxy_arp
parprouted eth0 tap1 // Sustituir eth0 por eth1, wlan0 etc. según cual sea la interface wireless

2. Iniciar VirtualBox e ir a "Network". En "Attached to" seleccionar "Host Interface" , y en Interface Name poner "tap1" (sin las comillas)

3. Guardar y salir de VirtualBox

4. Arrancar nuevamente VirtualBox

5. Cuando windows (el GUEST) haya iniciado completamente, asignarle una IP esática a la interfaz de red virtual, distinta a la que tiene el HOST (Ubuntu).



Bienvenidos a remembrants

Bienvenidos a remembrants, donde podrán encontrar recuerdos, memorias e ideas que fueron surgiendo con el transcurso del tiempo.