jueves, 30 de octubre de 2008

Como crear un repositorio en una Red Local para Ubuntu 8.04 Hardy Heron (Spanish)

Todo ello se realiza con el objetivo de descargar los paquetes necesarios para la operatividad del sistema, desde cualquier lugar dentro de la red local sin necesidad de una conexión a internet, a excepción de la máquina que será designada como servidor de actualizaciones.


La principal ventaja es que una vez descargado un paquete del repositorio oficial, todas las demás máquinas podran descargarlo a través de la red local, de esta manera no se descargará un paquete más de una vez de los repositorios oficiales.


CONFIGURACIÓN DEL SERVIDOR


1. Instalación de Paquetes



Como es normal, en primer lugar necesitas instalar los paquetes necesarios. En la terminal escribimos:

$sudo apt-get install apt-cacher



Una vez está hecho, es el momento de empezar la configuración que se encuentra en /etc/apt-cacher/apt-cacher.conf


  1. Configurando Apt-Cacher

2.1. apt-cacher.conf
Una vez abierto el archivo principal de configuración de apt-cacher: /etc/apt-cacher/apt-cacher.conf podemos comenzar a editarlo de acuerdo a las necesidades.

El puerto por defecto y el que estamos utilizando para apt-cacher es el 3142. Si quieres puedes cambiar este valor de acuerdo a tus necesidades.

allowed_hosts: por defecto, todos los host tienen permiso de acceder a tu repositorio cache. Se puedes cambiar este valor si quieres permitir que sólo ciertos host accedan a él. En nuestro caso, le permitimos el acceso a todos

generate_reports: Esta opción hace que apt-cacher cree un informe sobre como de eficiente es tu cache en el uso diario. El valor por defecto es 1, si quieres deshabilitarlo deberás ponerlo a 0

path_map: Esta es una opción interesante. Aquí puedes definir diferentes redirecciones a diferentes repositorios. Para la versión 8.04 de Ubuntu que estamos utilizando, debemos descomentar el path_map y agregar las siguientes lineas, en este caso hacemos referencia a los servidores de México y de seguridad:


# Server mapping - this allows to hide real server names behind virtual paths

# that appear in the access URL. This method is known from apt-proxy. This is

# also the only method to use FTP access to the target hosts. The syntax is simple, the part of the beginning to replace, followed by a list of mirror urls, all space separated. Multiple profile are separated by semicolons

path_map = debian ftp.uni-kl.de/pub/linux/debian ftp2.de.debian.org/debian ; ubuntu archive.ubuntu.com/ubuntu ; security security.debian.org/debian-security ftp2.de.debian.org/debian-security ; ubuntumexico http://mx.archive.ubuntu.com/ubuntu ; seguridad http://security.ubuntu.com/ubuntu




Ahora, para acceder a un repositorio específico, necesitamos simplemente añadir el nombre del mapeado a nuestro servidor repositorio cache, de esta forma: :port/mapping_name

Para acceder al repositorio ubuntumexico a través de http://archive:3142/ubuntumexico y al repositorio seguridad a través de http://archive:3142/seguridad



en este caso archive es el nombre de nuestro servidor



2.2. Activando apt-cacher al comienzo

Para arrancar apt-cacher necesitamos activarlo desde /etc/default/apt-cacher. Abre /etc/default/apt-cacher y configura AUTOSTART a 1:

AUTOSTART=1

Ahora reinicia apt-cacher:

$sudo /etc/init.d/apt-cacher restart

Ahora que apt-cacher arranca, es hora de actualizar el /etc/apt/sources.list de todos tus clientes para que que puedas usar nuestro repositorio cache.



3. Configurando el sources.list de los clientes y el Servidor

Ahora es el momento de configurar el sources.list de los clientes: /etc/apt/sources.list. Es importante utilizar nuestro repositorio cache en el servidor también, ya que, cualquier actualización hecha por el servidor repercutirá en la cache.

Aquí esta el /etc/apt/sources.list original:



#deb cdrom:[Ubuntu 8.04 _Hardy Heron_ - Release i386 (20080423)]/ hardy main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to

# newer versions of the distribution.



deb http://mx.archive.ubuntu.com/ubuntu/ hardy main restricted

deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy main restricted



## Major bug fix updates produced after the final release of the

## distribution.

deb http://mx.archive.ubuntu.com/ubuntu/ hardy-updates main restricted

deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy-updates main restricted



## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team, and may not be under a free licence. Please satisfy yourself as to

## your rights to use the software. Also, please note that software in

## universe WILL NOT receive any review or updates from the Ubuntu security

## team.

deb http://mx.archive.ubuntu.com/ubuntu/ hardy universe

deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy universe

deb http://mx.archive.ubuntu.com/ubuntu/ hardy-updates universe

deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy-updates universe



## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team, and may not be under a free licence. Please satisfy yourself as to

## your rights to use the software. Also, please note that software in

## multiverse WILL NOT receive any review or updates from the Ubuntu

## security team.

deb http://mx.archive.ubuntu.com/ubuntu/ hardy multiverse

deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy multiverse

deb http://mx.archive.ubuntu.com/ubuntu/ hardy-updates multiverse

deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy-updates multiverse



## Uncomment the following two lines to add software from the 'backports'

## repository.

## N.B. software from this repository may not have been tested as

## extensively as that contained in the main release, although it includes

## newer versions of some applications which may provide useful features.

## Also, please note that software in backports WILL NOT receive any review

## or updates from the Ubuntu security team.

# deb http://mx.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse

# deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse



## Uncomment the following two lines to add software from Canonical's

## 'partner' repository. This software is not part of Ubuntu, but is

## offered by Canonical and the respective vendors as a service to Ubuntu

## users.

# deb http://archive.canonical.com/ubuntu hardy partner

# deb-src http://archive.canonical.com/ubuntu hardy partner



deb http://security.ubuntu.com/ubuntu hardy-security main restricted

deb-src http://security.ubuntu.com/ubuntu hardy-security main restricted

deb http://security.ubuntu.com/ubuntu hardy-security universe

deb-src http://security.ubuntu.com/ubuntu hardy-security universe

deb http://security.ubuntu.com/ubuntu hardy-security multiverse

deb-src http://security.ubuntu.com/ubuntu hardy-security multiverse



Para utilizar nuestro repositorio cache, necesitamos cambiar las líneas en color rojo.



# deb cdrom:[Ubuntu 8.04 _Hardy Heron_ - Release i386 (20080423)]/ hardy main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to

# newer versions of the distribution.



deb http://archive:3142/ubuntumexico hardy main restricted

deb-src http://archive:3142/ubuntumexico hardy main restricted

## Major bug fix updates produced after the final release of the

## distribution.

deb http://archive:3142/ubuntumexico hardy-updates main restricted

deb-src http://archive:3142/ubuntumexico hardy-updates main restricted



## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team, and may not be under a free licence. Please satisfy yourself as to

## your rights to use the software. Also, please note that software in

## universe WILL NOT receive any review or updates from the Ubuntu security

## team.

deb http://archive:3142/ubuntumexico hardy universe

deb-src http://archive:3142/ubuntumexico hardy universe

deb http://archive:3142/ubuntumexico hardy-updates universe

deb-src http://archive:3142/ubuntumexico hardy-updates universe



## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team, and may not be under a free licence. Please satisfy yourself as to

## your rights to use the software. Also, please note that software in

## multiverse WILL NOT receive any review or updates from the Ubuntu

## security team.

deb http://archive:3142/ubuntumexico hardy multiverse

deb-src http://archive:3142/ubuntumexico hardy multiverse

deb http://archive:3142/ubuntumexico hardy-updates multiverse

deb-src http://archive:3142/ubuntumexico hardy-updates multiverse

## Uncomment the following two lines to add software from the 'backports'

## repository.

## N.B. software from this repository may not have been tested as

## extensively as that contained in the main release, although it includes

## newer versions of some applications which may provide useful features.

## Also, please note that software in backports WILL NOT receive any review

## or updates from the Ubuntu security team.

# deb http://mx.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse

# deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse



## Uncomment the following two lines to add software from Canonical's

## 'partner' repository. This software is not part of Ubuntu, but is

## offered by Canonical and the respective vendors as a service to Ubuntu

## users.

# deb http://archive.canonical.com/ubuntu hardy partner

# deb-src http://archive.canonical.com/ubuntu hardy partner



deb http://archive:3142/seguridad hardy-security main restricted

deb-src http://archive:3142/seguridad hardy-security main restricted



deb http://archive:3142/seguridad hardy-security universe

deb-src http://archive:3142/seguridad hardy-security universe



deb http://archive:3142/seguridad hardy-security multiverse

deb-src http://archive:3142/seguridad hardy-security multiverse



Bien, ahora, cada cliente debe ser capaz de descargar los paquetes .deb desde nuestro repositorio cache:

$sudo apt-get update



debe ser ejecutado en cada cliente.


4. Importando los paquetes desde /var/cache/apt/archives/ al repositorio apt-cacher

Puede que tu servidor ya tenga una gran cantidad de paquetes en su cache local: /var/cache/apt/archives/. apt-cacher ofrece una herramienta para importar estos archivos al repositorio de apt-cacher.

Hay unos scripts muy útiles que se encuentran en /usr/share/apt-cacher/. El que nos interesa es apt-cacher-import.pl. Para importar archivos .deb desde /var/cache/apt/archives al repositorio de to apt-cacher ejecuta:

$sudo /usr/share/apt-cacher/apt-cacher-import.pl /var/cache/apt/archives

Debe ejecutarse como root o los archivos .deb no serán copiados a nuestro repositorio cache

Ahora, en el directorio /var/cache/apt-cacher/packages/ habrá unos cuantos paquetes.


5. Obteniendo el informe de uso del repositorio cache

Si dejas la opción generate_reports configurada a 1, apt-cacher generará un informe de uso diario de la cache.

Podrás acceder a él en la dirección:

http://archive:3142/report



Si necesitas regenerar el informe, ejecuta:



$sudo /usr/share/apt-cacher/apt-cacher-report.pl


Dudas o comentarios a:

cmonterrosa@sef-chiapas.gob.mx

Más informacion:

http://www.debuntu.org/how-to-set-up-a-repository-cache-with-apt-cacher



viernes, 3 de octubre de 2008

METODOS NUMERICOS EN RUBY (in Spanish)

MÉTODOS NÚMERICOS EN RUBY

He trabajado con algunos de los más elementales métodos numéricos para la solución de ecuaciónes lineales en ruby, a diferencia de C++, los scripts hechos en ruby, se enfocan más a la lógica del problema, hacen sentir cómodo al programador, y tienen una potencia muy significativa,
"ha tomado lo mejor de varios lenguajes tales como pearl, smalltalk y lisp."

Comparto lo siguiente con ustedes, Los links siguientes contienen los archivos fuente.


Comentarios o dudas
cmonterrosa@sef-chiapas.gob.mx