miércoles, 22 de septiembre de 2010

Clonar la instalación de un equipo Debian a otro Debian

Bien pues si mal no recuerdo esto era en el caso de 2 discos duros la cosa es facil clonando el disco ahora resulta que tengo que clonar esa misma instalación a una portátil Dell 1545, y lo único que se me ocurrió fue clonar los paquetes instalados.


Paso 1:
En una terminal como root hacemos el siguiente comando completo:

dpkg --list | grep "^ii" | cut -f3 -d ' ' | sed ':a;N;$!ba;s/\n/ /g' > Listadepaquetes
Esto descarga toda las lista de paquetes a un archivo llamado Listadepaquetes


Paso2:
El archivo generado lo llevamos al portátil u otro PC según se de el caso.
Ahora una vez copiado el archivo en el portátil o PC como root hacemos lo siguiente

apt-get install $(cat Listadepaquetes)
Eso comenzara con el proceso de instalación de los paquetes instalados en el otro PC o portatil


Listo ahora ya tienes un clon de instalación a mano.


Pdta: En mi caso copie todo el home de mi usuario al otro pc le di el propietario correcto con

chown -R gary:gary /home/gary
y listo ahora también me fue muy útil copiar el contenido del /var/cache/archives/apt/ a la misma dirección del otro equipo para no descargar los mas de 900MB de actualizaciones que tenia en el otro equipo.

miércoles, 16 de junio de 2010

Obtener la iniciales de un nombre y apellidos | Csharp

Solución temporal que encontre a la obtención de las iniciales de un nombre y apellidos por ejemplo de:
San Francisco Toledo = SFT
Se debe enviar una cadena con el nombre y apellidos completo por ej;
MessageBox.Show(iniciales_de_un_nombre("San Francisco Toledo"));

Lo que nos mostrara el MessageBox es "SFT"

Bien sin mas que decir aqui el método que lo hace posible ñ_ñ
public string iniciales_de_un_nombre(string nombrecompleto)
{
string[] nombreyapellidos = new string[4];
char[] splitter = { ' ' };
nombreyapellidos = nombres.Split(splitter);
string[] iniciales = new string[4];

for (int x = 0; x < nombreyapellidos.Length; x++)
{
string temp= nombreyapellidos[x];
temp = temp.Remove(1, temp.Length - 1);
iniciales[x]= temp;
result +=iniciales[x];
}

return result;
}


Salu2 y espero que alguien le sea útil a pesar de ser muy simple.

miércoles, 12 de mayo de 2010

De repositorio a DVD |Ubuntu 10.04

Esto es sumamente sencillo si no se comenten error en su procedimiento, yo ya tengo bajados los 43.x GB de ubuntu 10.04 para AMD64 con mi script de descarga y si no lo viste esta acá e Intel a continuación procedemos a la creación de los DVD's a partir del repositorio.
Nota importante: Antes que nada minimamente debemos tener el Doble de espacio del repositorio ya que los DVD's ocuparan el mismo tamaño del repositorio.

1. cd /home

2. wget http://archive.ubuntu.com/ubuntu/pool/universe/d/debpartial/debpartial_0+20030508-0.1_all.deb

3. dpkg -i debpartial_0+20030508-0.1_all.deb

4. cp /usr/share/doc/debpartial/examples/debcopy.gz /home

5. gunzip debcopy.gz

6. debpartial --nosource --dirprefix=ubuntu --section=main,universe,restricted,multiverse --dist=lucid --size=DVD /home/ubuntu/ubuntu /home/ubuntudvd/

7. Con ls -l Verificamos la cantidad de DVD que se crearan.
ls -l /home/ubuntudvd/

total 32
drwxr-xr-x 4 root root 4096 2010-05-12 10:37 ubuntu0
drwxr-xr-x 4 root root 4096 2010-05-12 10:38 ubuntu1
drwxr-xr-x 4 root root 4096 2010-05-12 10:38 ubuntu2
drwxr-xr-x 4 root root 4096 2010-05-12 10:38 ubuntu3
drwxr-xr-x 4 root root 4096 2010-05-12 10:38 ubuntu4
drwxr-xr-x 4 root root 4096 2010-05-12 10:38 ubuntu5
drwxr-xr-x 4 root root 4096 2010-05-12 10:38 ubuntu6
drwxr-xr-x 4 root root 4096 2010-05-12 10:38 ubuntu7


8. Este es tal vez el paso mas importante y no debemos cometer error alguno en la ejecución de la siguientes lineas (mucho mejor si las hacemos de una en una).

ruby debcopy -l /home/ubuntu/ubuntu /home/ubuntudvd/ubuntu0
ruby debcopy -l /home/ubuntu/ubuntu /home/ubuntudvd/ubuntu1
ruby debcopy -l /home/ubuntu/ubuntu /home/ubuntudvd/ubuntu2
ruby debcopy -l /home/ubuntu/ubuntu /home/ubuntudvd/ubuntu3
ruby debcopy -l /home/ubuntu/ubuntu /home/ubuntudvd/ubuntu4
ruby debcopy -l /home/ubuntu/ubuntu /home/ubuntudvd/ubuntu5
ruby debcopy -l /home/ubuntu/ubuntu /home/ubuntudvd/ubuntu6
ruby debcopy -l /home/ubuntu/ubuntu /home/ubuntudvd/ubuntu7



9. Ahora procedemos a crear los ISOS.
mkisofs -f -J -r -V "Ubuntu 1/8 i386-amd64" -o ubuntu-complete-i386-amd64-dvd1.iso /home/ubuntudvd/ubuntu0
mkisofs -f -J -r -V "Ubuntu 2/8 i386-amd64" -o ubuntu-complete-i386-amd64-dvd2.iso /home/ubuntudvd/ubuntu1
mkisofs -f -J -r -V "Ubuntu 3/8 i386-amd64" -o ubuntu-complete-i386-amd64-dvd3.iso /home/ubuntudvd/ubuntu2
mkisofs -f -J -r -V "Ubuntu 4/8 i386-amd64" -o ubuntu-complete-i386-amd64-dvd4.iso /home/ubuntudvd/ubuntu3
mkisofs -f -J -r -V "Ubuntu 5/8 i386-amd64" -o ubuntu-complete-i386-amd64-dvd5.iso /home/ubuntudvd/ubuntu4
mkisofs -f -J -r -V "Ubuntu 6/8 i386-amd64" -o ubuntu-complete-i386-amd64-dvd6.iso /home/ubuntudvd/ubuntu5
mkisofs -f -J -r -V "Ubuntu 7/8 i386-amd64" -o ubuntu-complete-i386-amd64-dvd7.iso /home/ubuntudvd/ubuntu6
mkisofs -f -J -r -V "Ubuntu 8/8 i386-amd64" -o ubuntu-complete-i386-amd64-dvd8.iso /home/ubuntudvd/ubuntu7


10. procedemos con la grabación de los DVD's desde consola.
Buscamos el grabador cdrecord -scanbus

scsibus1:
1,0,0 100) *
1,1,0 101) 'TSSTcorp' 'CDDVDW SH-S223B ' 'SB00' Removable CD-ROM
1,2,0 102) *
1,3,0 103) *
1,4,0 104) *
1,5,0 105) *
1,6,0 106) *
1,7,0 107) *


11. Ahora grabamos todos y cada uno de los ISO's con el siguiente comando.
cdrecord -v dev=1,1,0 -driveropts=burnfree -dao /home/ubuntu-complete-i386-amd64-dvd1.iso

Saludos ñ_ñ

sábado, 1 de mayo de 2010

Informix IDS |Debian o deribados

(ACTUALIZACION): Guia de instalación de encuentra actualizada en el siguiente link: http://garysandi.blogspot.com/2016/08/informix-ids-centos.html

Informix IDS es una base de datos que se usa hasta el día de hoy para aplicaciones de tarea critica y en su mayoría para entidades financieras que requieren el máximo provecho de una BD poderosa, escalable, estable y por sobre todo, CONFIABLE.
A continuación un mini how-to que tengo para hacer la instalación de Informix IDS 11.5 Develper Edition.

1. Bajar Informix 11.5 IDS desde la web http://www.ibm.com/developerworks/downloads/im/ids/dev.html?S_TACT=105AGX28&S_CMP=TRIALS

2. Instalamos los requerimientos. apt-get install sun-java6-jdk libaio-dev libaio
  Actualización: para versiones 11.50 o mayores ahora IBM incluye la JRE en el paquete de instalación instalar solamente lo siguiente: 
apt-get install build-essential gcc g++ libstdc++6

3. Descomprimir el Tar bajado tar xvf iif.11.50.UC3DE.Linux-RHEL4.tar
4. Ingresar al tar descomprimidocd iif.11.50.UC3DE.Linux-RHEL4
5. Listar el contenido del directorio. iif.11.50.UC3DE.Linux-RHEL4# ls
bundle.ini DBLD ids_install images README.html suite.jar
CSDK ICONNECT ids_install.command JDBC SERVER

6. Comenzar la instación.
sh ids_install o tambien ./ids_install
7. Responder de la siguiente manera.
Do you want to run installer in GUI mode [y/n] :
n <=== luego pulsamos Enter

Initializing InstallShield Wizard........
Launching InstallShield Wizard........


Provide information to create the user informix. The password must contain at
least 8 characters.

User Informix home directory : [/home/informix] <===pulsamos Enter


Password :<===pulsamos Enter
Please press Enter to Continue
Password: <===Escribes tu Password


Confirm Password :<===pulsamos Enter
Please press Enter to Continue
Password: <===Repites tu password


Press 1 for Next, 3 to Cancel or 4 to Redisplay [1]

1. Release Notes
2. Installation Guide
3. Launch Information Center
4. Begin Installation

Please select one of these options [4] <===pulsamos Enter

Beginning installation...


Press 1 for Next, 3 to Cancel or 4 to Redisplay [1] <===pulsamos Enter

Welcome to the InstallShield Wizard for IBM Informix Dynamic Server Version
11.50 Bundle

The InstallShield Wizard will install IBM Informix Dynamic Server Version 11.50
Bundle on your computer.
To continue, choose Next.
Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1]

International License Agreement for Non-Warranted Programs

Part 1 - General Terms

BY DOWNLOADING, INSTALLING, COPYING, ACCESSING, OR USING THE PROGRAM
YOU AGREE TO THE TERMS OF THIS AGREEMENT. IF YOU ARE ACCEPTING THESE
TERMS ON BEHALF OF ANOTHER PERSON OR A COMPANY OR OTHER LEGAL
ENTITY, YOU REPRESENT AND WARRANT THAT YOU HAVE FULL AUTHORITY TO
BIND THAT PERSON, COMPANY, OR LEGAL ENTITY TO THESE TERMS. IF YOU DO
NOT AGREE TO THESE TERMS,



- DO NOT DOWNLOAD, INSTALL, COPY, ACCESS, OR USE THE PROGRAM; AND



- PROMPTLY RETURN THE PROGRAM AND PROOF OF ENTITLEMENT TO THE PARTY

Press Enter to continue viewing the license agreement, or, Enter "1" to accept
the agreement, "2" to decline it or "99" to go back to the previous screen, "3"
Print, "4" Read non-IBM terms.

1<===pulsamos 1 y luego Enter

Press 1 for Next, 3 to Cancel or 4 to Redisplay [1] <===pulsamos Enter

IBM Informix Dynamic Server Version 11.50 Bundle Install Location

Please specify a directory or press Enter to accept the default directory.

Directory Name: [/opt/IBM/informix]<===pulsamos Enter

Press 1 for Next, 3 to Cancel or 4 to Redisplay [1] <===pulsamos Enter


Searching for products available for install: this may take a few minutes.

Select the products you would like to install:

To select/deselect a product or to change its setup type, type its number:

Product Setup Type
------------------------------------------------ ------------------------
1. [ ] IBM Informix IConnect Version 3.50
2. [x] IBM Informix Client-SDK Version 3.50 Typical
3. [x] IBM Informix Dynamic Server Version 11.50 Typical
4. [x] IBM Informix JDBC Driver Version 3.50

Other options:

0. Continue installing

Enter command [0] <===pulsamos Enter


Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] <===pulsamos Enter


Checking for Server Prerequisites ...

Do you want to enable role separation for auditing procedures?

[ ] 1 - Yes
[X] 2 - No

To select an item enter its number, or 0 when you are finished: [0] <===pulsamos Enter


If you enable role separation, you can assign existing groups of users to
specific roles.

If you do not enable role separation, the database server administrator
performs all administration tasks.

Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] <===pulsamos Enter

Do you want to create an IDS demonstration database server instance?

[ ] 1 - Yes
[X] 2 - No

To select an item enter its number, or 0 when you are finished: [0] <===pulsamos Enter


You can use a demonstration database server instance to verify that IDS is
installed correctly and that the hardware is configured correctly. You can also
configure the demonstration database server instance to use it as a production
instance.

Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] <===pulsamos Enter

IBM Informix Dynamic Server Version 11.50 Bundle will be installed in the
following location:

/opt/IBM/informix

with the following features:

IBM Informix Client-SDK Version 3.50
IBM Informix Dynamic Server Version 11.50
IBM Informix JDBC Driver Version 3.50

for a total size:

417.9 MB

Press 1 for Next, 2 for Previous, 3 to Cancel or 4 to Redisplay [1] <===pulsamos Enter

Installing IBM Informix Dynamic Server Version 11.50 Bundle. Please wait...

0 % complete
10 % complete
20 % complete
30 % complete
40 % complete
50 % complete
60 % complete
70 % complete
80 % complete
90 % complete
100 % complete


Installing IBM Informix Client-SDK Version 3.50. Please wait...

Installing IBM Informix JDBC Driver Version 3.50. Please wait...

Creating uninstaller...


Performing GSKit Installation ...
Performing GSKit installation for Linux ...
cp: cannot stat `/usr/local/ibm/gsk7/icc/icclib/libicclib.so': No such file or directory
cp: cannot stat `/usr/local/ibm/gsk7/icc/osslib/libcrypto*': No such file or directory
cp: cannot stat `/usr/local/ibm/gsk7/lib/libgsk7icc*.so': No such file or directory
cp: cannot stat `/usr/local/ibm/gsk7/icc/icclib/libicclib.so': No such file or directory
cp: cannot stat `/usr/local/ibm/gsk7/icc/osslib/libcrypto*': No such file or directory
cp: cannot stat `/usr/local/ibm/gsk7/lib/libgsk7icc*.so': No such file or directory


Branding Installed Files ...


Branding Files ...
Installing directory .
Installing directory etc
Installing directory bin
Installing directory lib
Installing directory lib/client
Installing directory lib/client/csm
Installing directory lib/esql
Installing directory lib/dmi
Installing directory lib/c++
Installing directory lib/cli
Installing directory release
Installing directory release/en_us
Installing directory release/en_us/0333
Installing directory incl
Installing directory incl/esql
Installing directory incl/dmi
Installing directory incl/c++
Installing directory incl/cli
Installing directory demo
Installing directory demo/esqlc
Installing directory demo/c++
Installing directory demo/cli
Installing directory doc
Installing directory doc/gls_api
Installing directory doc/gls_api/en_us
Installing directory doc/gls_api/en_us/0333
Installing directory tmp
Installing directory gsk
Installing directory gsk/client
Installing directory gskit
Installing directory gsk
Installing directory gsk/client

IBM Informix Product: IBM INFORMIX-Client SDK
Installation Directory: /opt/IBM/informix

Performing root portion of installation of IBM INFORMIX-Client SDK...


Installation of IBM INFORMIX-Client SDK complete.

Installing directory etc
Installing directory gls
Installing directory gls/cm3
Installing directory gls/cv9
Installing directory gls/dll
Installing directory gls/etc
Installing directory gls/lc11
Installing directory gls/lc11/cs_cz
Installing directory gls/lc11/da_dk
Installing directory gls/lc11/de_at
Installing directory gls/lc11/de_ch
Installing directory gls/lc11/de_de
Installing directory gls/lc11/en_au
Installing directory gls/lc11/en_gb
Installing directory gls/lc11/en_us
Installing directory gls/lc11/es_es
Installing directory gls/lc11/fi_fi
Installing directory gls/lc11/fr_be
Installing directory gls/lc11/fr_ca
Installing directory gls/lc11/fr_ch
Installing directory gls/lc11/fr_fr
Installing directory gls/lc11/is_is
Installing directory gls/lc11/it_it
Installing directory gls/lc11/ja_jp
Installing directory gls/lc11/ko_kr
Installing directory gls/lc11/nl_be
Installing directory gls/lc11/nl_nl
Installing directory gls/lc11/no_no
Installing directory gls/lc11/os
Installing directory gls/lc11/pl_pl
Installing directory gls/lc11/pt_br
Installing directory gls/lc11/pt_pt
Installing directory gls/lc11/ru_ru
Installing directory gls/lc11/sk_sk
Installing directory gls/lc11/sv_se
Installing directory gls/lc11/th_th
Installing directory gls/lc11/zh_cn
Installing directory gls/lc11/zh_tw

IBM Informix Product: Gls
Installation Directory: /opt/IBM/informix

Performing root portion of installation of Gls...


Installation of Gls complete.

Installing directory etc
Installing directory msg
Installing directory msg/en_us
Installing directory msg/en_us/0333

IBM Informix Product: messages
Installation Directory: /opt/IBM/informix

Performing root portion of installation of messages...


Installation of messages complete.

Please read the information below.

Set required environment variables
Set $INFORMIXDIR to the directory where the IDS server is installed.
Set $PATH to include $INFORMIXDIR/bin
Set $INFORMIXSERVER to the name of the database server
Set $ONCONFIG to the name of the active onconfig configuration file.
If using a sqlhosts file other than $INFORMIXDIR/etc/sqlhosts
Set $INFORMIXSQLHOSTS
If using a locale/language other than the default
Set $CLIENT_LOCALE
Set $DB_LOCALE
Set $SERVER_LOCALE
Set $DBLANG
Prepare connectivity files
sqlhosts
/etc/hosts
/etc/services
Prepare configuration file
Set DBSERVERNAME
Set SERVERNUM
Set ROOTNAME

Press ENTER to read the text [Type q to quit]

Set ROOTPATH
Set ROOTSIZE
Initialize database server
As informix or root, run oninit
If initializing a new server for the FIRST time, run oninit -i
This will overwrite any existing data, so use caution on an existing setup


For more information please refer to the IBM Informix Dynamic Server Getting
Started Guide

Press 1 for Next, 3 to Cancel or 4 to Redisplay [1] <===pulsamos Enter

The InstallShield Wizard has successfully installed IBM Informix Dynamic Server
Version 11.50 Bundle. Choose Next to continue the wizard.

Press 1 for Next, 3 to Cancel or 4 to Redisplay [1] <===pulsamos Enter

1. Release Notes
2. Installation Guide
3. Launch Information Center
4. Finish Installation

Please select one of these options [4] <===pulsamos Enter

Finishing installation...


Press 3 to Finish or 4 to Redisplay [3] <===pulsamos Enter


8. Editamos el archivo /etc/profile o el /home/usuario/.profile de cada usuario y ponemos lo siguiente luego de todo el contenido (luego de la ultima fila)

#############para levantar informix
export PATH=$PATH:$INFORMIXDIR/bin
unset USERNAME
export INFORMIXDIR=/opt/IBM/informix
export INFORMIXSERVER=informixserver #####Tomar en cuenta el nombre informixserver
export PATH=$INFORMIXDIR/bin:$PATH
export LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/tools
export SQLHOSTS=$INFORMIXDIR/etc/sqlhosts
export DBSCREENOUT=/u/tmp/${USER}.out

#########configuracion general
export ONCONFIG=onconfig
export DBDATE=DMY4/
export DBCENTURY=C
export DBEDIT=nano
export TERMCAP=/opt/IBM/informix/etc/termcap
export INFORMIXTERM=termcap
export TERM=vt100
export DBPATH=/u/bexe


9. Reiniciamos el equipo.

10. Probamos.
cd $INFORMIXDIR/etc
12. Editamos
nano sqlhosts

13. editamos y dejamos el final del archivo como se muestra: (El hostname de obtiene haciendo hostname -f en la consola.)

#=================================================
#DBSERVER PROTOCOL HOSTNAME SERVICE
#=================================================
informixserver onsoctcp titan 40000
informixserver_shm onipcshm titan dummy

#demo_on onipcshm on_hostname on_servername
#demo_se seipcpip se_hostname sqlexec

14. Copiamos onconfig
cp -p onconfig.std onconfig
15. Editamos onconfirg
nano onconfig

#editamos solo lo siguiente:
ROOTNAME rootdbs
ROOTPATH $INFORMIXDIR/data/chk01.chk01
ROOTOFFSET 0
ROOTSIZE 200000
MIRROR 0
MIRRORPATH $INFORMIXDIR/data/chk02.chk02
MIRROROFFSET 0
.....
TAPEDEV /dev/null
...
SERVERNUM 1
DBSERVERNAME gaya
DBSERVERALIASES gaya_shm

16. Preparamos los Chunks para el Servidor de Base de datos Informix de la siguiente manera.

cd /home/informix/
mkdir data
touch data/chk01.chk01
touch data/chk02.chk02
chmod 660 data/
chmod 660 data/chk01.chk01
chmod 660 data/chk02.chk02
chown informix:informix data/chk01.chk01
chown informix:informix data/chk02.chk02

17. Editamos los Services de Debian
nano /etc/services

#añadimos al final lo siguiente
onsoctcp 1520/tcp
onipcshm 5121/tcp

19. Nos logeamos como informix.

su - informix
20. Inicializamos la BD Informix
oninit -ivy


Checking group membership to determine server run mode...succeeded
Reading configuration file '/opt/IBM/informix/etc/onconfig'...succeeded
Creating /INFORMIXTMP/.infxdirs...succeeded
Creating infos file "/opt/IBM/informix/etc/.infos.gaya"...succeeded
Linking conf file "/opt/IBM/informix/etc/.conf.gaya"...succeeded
Checking config parameters...succeeded
Writing to infos file...succeeded
Allocating and attaching to shared memory...succeeded
Creating resident pool 10570 kbytes...succeeded
Allocating 100016 kbytes for buffer pool of 2K page size...succeeded
Initializing rhead structure...succeeded
Initialization of Encryption...succeeded
Initializing ASF...succeeded
Initializing Dictionary Cache and SPL Routine Cache...succeeded
Bringing up ADM VP...succeeded
Creating VP classes...succeeded
Onlining 0 additional cpu vps...succeeded
Onlining 2 IO vps...succeeded
Forking main_loop thread...succeeded
Initializing DR structures...succeeded
Forking 1 'soctcp' listener threads...succeeded
Forking 1 'ipcshm' listener threads...succeeded
Starting tracing...succeeded
Initializing 8 flushers...succeeded
Initializing log/checkpoint information...succeeded
Initializing dbspaces...succeeded
Opening primary chunks...succeeded
Opening mirror chunks...succeeded
Validating chunks...succeeded
Creating database partition...succeeded
Initialize Async Log Flusher...succeeded
Starting B-tree Scanner...succeeded
Initializing DBSPACETEMP list...succeeded
Checking database partition index...succeeded
Initializing dataskip structure...succeeded
Checking for temporary tables to drop...succeeded
Forking onmode_mon thread...succeeded
Creating periodic thread...succeeded
Starting scheduling system...succeeded
Verbose output complete: mode = 5


Fin: si obtenemos Verbose output complete: mode = 5 ya podemos comenzar a usar la BD.
dbaccess

Salu2

viernes, 30 de abril de 2010

Clonar discos duros en Gnu/Linux |Debian

Hoy pase por un problema, compre un disco de 80GB para reemplazar el anterior disco de sistema base que tenia también de 80GB un poco dañado por tantos años de uso, y surgió el problema de la clonación de discos.

Bien pues pude encontrar una solución en "dd" Partimage no me sirvio de mucho, Mongo tampoco y que decir de g4l no me ayudaron para nada.

lo que sirvio fue:

1. Bootear desde el instalador de Debian.
2. Alt+F2 luego de la detección de la red.
3. dd if=/dev/sda of=/dev/sdb bs=1M

Tardo una media hora en pasar todo el sistema base pero al final termino correctamente y ahora el Disco viejo reposa en paz. mientras busco una solución a sus problemas.

Sincronizar repositorios de Ubuntu 10.04

Pues para hacerlo debemos crear la siguiente estructura y tener suficiente espacio en disco. unos 60GB libres nos caerán bien.
1.mkdir -p /home/ubuntu/ubuntu
2.cd /home
3.nano ubuntu-all-lucid.sh
4. Dentro escribimos lo siguiente:
ARQUITECTURA=i386,amd64
METODO=http
RAMA=lucid
PRINCIPAL=archive.ubuntu.com
DIR_MIRROR=/home/ubuntu/ubuntu
SECCIONES=main,universe,multiverse,restricted
debmirror -a ${ARQUITECTURA} \
-s ${SECCIONES} \
-h ${PRINCIPAL}/ubuntu \
-d ${RAMA} -r / --progress \
-e ${METODO} --ignore-release-gpg --nosource \
${DIR_MIRROR}


si no quieres amd solamente quita ",amd64" y deja el "i386" o viceversa.

5. Luego corremos como root el script.
sudo sh /home/ubuntu-all-lucid.sh
6. Finalmente comenzara a sincronizar todos los GB's que hay en el repo de ubuntu 10.04.

sh ubuntu-all-lucid.sh
Mirroring to /home/ubuntu/ubuntu from http://archive.ubuntu.com/ubuntu///
Arches: i386,amd64
Dists: lucid
Sections: main,universe,multiverse,restricted
Will clean up AFTER mirroring.
Pdiff mode: use.
Attempting to get lock, this might take 2 minutes before it fails.
Get Release files.
[0%] Getting: dists/lucid/Release... ok
[0%] Getting: dists/lucid/Release.gpg... ok
Get Packages and Sources files and other miscellany.
dists/lucid/main/binary-i386/Packages.gz needs fetch
[ 0%] Getting: dists/lucid/main/binary-i386/Packages.gz... ok
dists/lucid/main/binary-i386/Release needs fetch
[ 11%] Getting: dists/lucid/main/binary-i386/Release... ok
dists/lucid/main/binary-amd64/Packages.gz needs fetch
[ 11%] Getting: dists/lucid/main/binary-amd64/Packages.gz... ok
dists/lucid/main/binary-amd64/Release needs fetch
[ 23%] Getting: dists/lucid/main/binary-amd64/Release... ok
dists/lucid/universe/binary-i386/Packages.gz needs fetch
[ 23%] Getting: dists/lucid/universe/binary-i386/Packages.gz...
dists/lucid/universe/binary-i386/Release needs fetch
[ 60%] Getting: dists/lucid/universe/binary-i386/Release... ok
dists/lucid/universe/binary-amd64/Packages.gz needs fetch
[ 60%] Getting: dists/lucid/universe/binary-amd64/Packages.gz... ok
dists/lucid/universe/binary-amd64/Release needs fetch
[ 98%] Getting: dists/lucid/universe/binary-amd64/Release... ok
dists/lucid/multiverse/binary-i386/Packages.gz needs fetch
[ 98%] Getting: dists/lucid/multiverse/binary-i386/Packages.gz... ok
dists/lucid/multiverse/binary-i386/Release needs fetch
[ 99%] Getting: dists/lucid/multiverse/binary-i386/Release... ok
dists/lucid/multiverse/binary-amd64/Packages.gz needs fetch
[ 99%] Getting: dists/lucid/multiverse/binary-amd64/Packages.gz... ok
dists/lucid/multiverse/binary-amd64/Release needs fetch
[100%] Getting: dists/lucid/multiverse/binary-amd64/Release... ok
dists/lucid/restricted/binary-i386/Packages.gz needs fetch
[100%] Getting: dists/lucid/restricted/binary-i386/Packages.gz... ok
dists/lucid/restricted/binary-i386/Release needs fetch
[100%] Getting: dists/lucid/restricted/binary-i386/Release... ok
dists/lucid/restricted/binary-amd64/Packages.gz needs fetch
[100%] Getting: dists/lucid/restricted/binary-amd64/Packages.gz... ok
dists/lucid/restricted/binary-amd64/Release needs fetch
[100%] Getting: dists/lucid/restricted/binary-amd64/Release... ok
Parse Packages and Sources files and add to the file list everything therein.
Download all files that we need to get (43355 MiB).


Luego de unos días de descarga tendrán el repo sincronizado. y para actualizarlo bastara con correr nuevamente:
sudo sh /home/ubuntu-all-lucid.sh y el repo se actualizara al día en que se hace el comando.

Salu2

martes, 20 de abril de 2010

Horde Webmail + poppassd | Debian Lenny o Squeeze

Horde webmail supera sin ningún problema a squirrelmail por la facilidad de uso y por la documentación existente sobre el, pero antes de proceder a la configuración de horde debemos tener instalado minimamente Postfix ya funcionando con algún filtro de virus como clamav u otro en este ejemplo usaremos spamassassin y tendremos configurado postfix, la versión Webmail de Horde que configuraremos administra los usuarios directamente desde linux es decir, tendremos crear o añadir usuarios a linux manualmente o tal vez hacer algo así como un php gui para añadirlos manualmente desde la web.

Primeramente Debemos configurar Postfix con SMTP-AUTH y TLS con IMAP, para este ejemplo use: sandi.org como dominio podemos cambiar ese valor según nuestras necesidades.


apt-get install postfix sasl2-bin libsasl2-modules procmail


Aceptamos los valores por defecto .

Escribimos y también aceptamos los valores por defecto de:

dpkg-reconfigure postfix


Ok ahora estos son los pasos posteriores, preferentemente hacerlos todos individualmente, linea por linea en la terminal.


postconf -e 'smtpd_sasl_local_domain ='
postconf -e 'smtpd_sasl_auth_enable = yes'
postconf -e 'smtpd_sasl_security_options = noanonymous'
postconf -e 'broken_sasl_auth_clients = yes'
postconf -e 'smtpd_sasl_authenticated_header = yes'
postconf -e 'smtpd_recipient_restrictions =
permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
postconf -e 'inet_interfaces = all'
echo 'pwcheck_method: saslauthd' >> /etc/postfix/sasl/smtpd.conf
echo 'mech_list: plain login' >> /etc/postfix/sasl/smtpd.conf
mkdir /etc/postfix/ssl
cd /etc/postfix/ssl/
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
chmod 600 smtpd.key
openssl req -new -key smtpd.key -out smtpd.csr
openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
openssl rsa -in smtpd.key -out smtpd.key.unencrypted
mv -f smtpd.key.unencrypted smtpd.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650
postconf -e 'myhostname = sandi.org'
postconf -e 'smtpd_tls_auth_only = no'
postconf -e 'smtp_use_tls = yes'
postconf -e 'smtpd_use_tls = yes'
postconf -e 'smtp_tls_note_starttls_offer = yes'
postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key'
postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt'
postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem'
postconf -e 'smtpd_tls_loglevel = 1'
postconf -e 'smtpd_tls_received_header = yes'
postconf -e 'smtpd_tls_session_cache_timeout = 3600s'
postconf -e 'tls_random_source = dev:/dev/urandom'
mkdir -p /var/spool/postfix/var/run/saslauthd


Ahora debemos editar el archivo saslauthd

nano /etc/default/saslauthd


#cambiar a yes si se encuentra en lo la linea START=

START=yes
DESC="SASL Authentication Daemon"
NAME="saslauthd"
MECHANISMS="pam"
MECH_OPTIONS=""
THREADS=5
#Debe escribirse correctamente la linea de abajo:
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"


En la terminal añadir postfix a sasl

adduser postfix sasl

reiniciar postfix

/etc/init.d/postfix restart

iniciar saslauthd

/etc/init.d/saslauthd start


Ahora instalar los paquetes para pop3 e imap

apt-get install courier-authdaemon courier-base courier-imap courier-imap-ssl courier-pop courier-pop-ssl courier-ssl gamin libgamin0 libglib2.0-0


Ahora hacer lo siguiente

cd /etc/courier


Borrar:

rm -f /etc/courier/imapd.pem
rm -f /etc/courier/pop3d.pem

Editar imapd.cnf

nano /etc/courier/imapd.cnf


[...]
CN=sandi.org
[...]

Editar pop3d,cnf


nano /etc/courier/pop3d.cnf


[...]
CN=sandi.org
[...]

Crear los certificados pop3 e imap

mkimapdcert && mkpop3dcert


Reiniciar los servicios

/etc/init.d/courier-imap-ssl restart


En la terminal:

postconf -e 'home_mailbox = Maildir/'


postconf -e 'mailbox_command ='


/etc/init.d/postfix restart


/etc/init.d/courier-pop-ssl restart


Instalar Mutt para ver los correos desde consola.

apt-get install mutt


Configurar Mutt


nano /etc/Muttrc


set folder="~/Maildir"
set mask="!^\\.[^.]"
set mbox="~/Maildir"
set record="+.enviados"
set postponed="+.borradores"
set spoolfile="~/Maildir"


Ahora a provar el envio y recepción con telnet enviandonos un mensaje de nosotros a nosotros mismos en este ejemplo usare mi usuario de linux gary.

En la terminal hacer:

telnet localhost smtp

Esperamos a que se conecte y listo!

Trying 127.0.0.1...
Connected to localhost.loaldomain.
Escape character is '^]'.
220 sandi.org ESMTP Postfix (Debian/GNU)

Ahora esta conectado probar enviando un correo escribiendo lo siguiente, primero el remitente.

mail from:

Al hacer enter devuelve lo siguiente

250 2.1.0 Ok

Ahora el destinatario:

rcpt to:


250 2.1.5 Ok

Ahora el comando para escribir el texto del correo.

data



354 End data with .

ahora a escribir

Aki va el texto y luego pulso un enter y el punto luego otro enter para salir el . es algo asi como salir de redacción
.

Escribir . y pulsar enter para salir

250 2.0.0 Ok: queued as 5E72D4805E

Esto nos dice que fue enviado correctamente.

quit

Salir del envio desde terminal

221 2.0.0 Bye


Ahora nos logeamos o abrimos una terminal como el usuario al que enviamos el correo y verificamos que llego el correo.


=================================================================================
q:Salir d:Sup. u:Recuperar s:Guardar m:Nuevo r:Responder g:Grupo ?:Ayuda
1 F Aug 16 To undisclosed- (0,1K) (este es el correo que nos autoenviamos)
=================================================================================


Ahora debemos instalar spamassassin y configurarlo

apt-get install spamassassin spamc


groupadd -g 5001 spamd


useradd -u 5001 -g spamd -s /sbin/nologin -d /var/lib/spammassassin spamd


mkdir /var/lib/spamassassin


chown spamd:spamd /var/lib/spamassassin/


Editar el archivo spamassassin para configurar.

nano /etc/default/spamassassin


ENABLED=1
SAHOME="/var/lib/spamassassin/"
OPTIONS="--create-prefs --max-children 5 --username spamd --helper-home-dir ${SAHOME} -s ${SAHOME}spamd.log"
PIDFILE="${SAHOME}spamd.pid"
CRON=0


posteriormente el archivo local.cf

nano /etc/spamassassin/local.cf


rewrite_header Subject [***** SPAM _SCORE_ *****]
required_score 2.0
report_safe 0
use_bayes 1
use_bayes_rules 1
bayes_auto_learn 1
skip_rbl_checks 0
use_razor2 0
use_dcc 0
use_pyzor 0


Ahora a reiniciar el servicio de spamassassin

/etc/init.d/spamassassin start

Bien en este punto es donde tenemos configurado el correo electronico.

Ahora configuraremos Horde pero debemos tener los siguientes paquetes instalados.


apt-get install libapache2-mod-php5 php5-gd php5-mysql php5-mcrypt php5-imap php5-tidy php5-cli php-pear memcached php5-memcache libmagic-dev libgeoip-dev make php5-dev unrtf libwpd-tools xlhtml source-highlight ppthtml rpm wv enscript fortunes aspell-en aspell-es gnupg openssl ca-certificates


Extensa la lista pero son los paquetes que "si o si" debe tener nuestro servidor Debian para soportar correctamente horde webmail.

Primeramente Descargar la ultima version de horde webmail desde su web en http://www.horde.org
horde-webmail-1.2.3.tar.gz, luego copiar a la carpeta /var/www/ usaremos la carpeta /var/www/webmail/


cp horde-webmail-1.2.3.tar.gz /var/www/


cd /var/www/


tar xvf horde-webmail-1.2.3.tar.gz


mv horde-webmail-1.2.3 webmail

Ahora hacemos lo siguiente para instalar la base de datos y el usuario administrador


/usr/bin/php /var/www/webmail/scripts/setup.php


Horde Groupware Webmail Edition Configuration Menu
(0) Exit
(1) Configure database settings
(2) Create database or tables
(3) Configure administrator settings
(4) Update from an older Horde Groupware Webmail Edition version


Type your choice: 1


Type your choice: 1
What database backend should we use? [false]
(false) [None]
(dbase) dBase
(ibase) Firebird/InterBase
(fbsql) Frontbase
(ifx) Informix
(msql) mSQL
(mssql) MS SQL Server
(mysql) MySQL
(mysqli) MySQL (mysqli)
(oci8) Oracle
(odbc) ODBC
(pgsql) PostgreSQL
(sqlite) SQLite
(sybase) Sybase


Type your choice: mysql


Request persistent connections? [0]
(1) Yes
(0) No


Type your choice: 0


Username to connect to the database as* [] root
Password to connect with [] passwordderoot


How should we connect to the database? [unix]
(unix) UNIX Sockets
(tcp) TCP/IP


Type your choice: tcp


Database server/host* [] mail.sandi.org


Port the DB is running on, if non-standard [3306]


Database name to use* [] webmail


Internally used charset* [utf-8]
Use SSL to connect to the server? [0]
(1) Yes
(0) No


Type your choice:0


Certification Authority to use for SSL connections []
Split reads to a different server? [false]
(false) Disabled
(true) Enabled


Type your choice:false


Writing main configuration file
Done configuring database settings.


Horde Groupware Webmail Edition Configuration Menu
(0) Exit
(1) Configure database settings
(2) Create database or tables
(3) Configure administrator settings
(4) Update from an older Horde Groupware Webmail Edition version

Type your choice: 2

Should we create the database for you? If yes, you need to provide a database
user that has permissions to create new databases on your system. If no, we
will only create the database tables for you. [y]
(y) Yes
(n) No

Type your choice: y


Database superuser for creating the database if necessary for your database system: root


Specify a password for the database user: passwordderoot
Loading database module...
[ OK ] Successfully created the database webmail.
[ OK ] Successfully created the global tables.
[ OK ] Successfully created the tables for Mail (imp).
[ OK ] Successfully created the tables for Filters (ingo).
[ OK ] Successfully created the tables for Address Book (turba).
[ OK ] Successfully created the tables for Calendar (kronolith).
[ OK ] Successfully created the tables for Tasks (nag).
[ OK ] Successfully created the tables for Notes (mnemo).
Done creating tables.


Horde Groupware Webmail Edition Configuration Menu
(0) Exit
(1) Configure database settings
(2) Create database or tables
(3) Configure administrator settings
(4) Update from an older Horde Groupware Webmail Edition version

Type your choice: 3

Aqui seleccionamos al administrador del sistema webmail, en este caso el usuario gary.

Specify an existing mail user who you want to give administrator permissions (optional): gary


Writing main configuration file
Done configuring administrator settings.


Horde Groupware Webmail Edition Configuration Menu
(0) Exit
(1) Configure database settings
(2) Create database or tables
(3) Configure administrator settings
(4) Update from an older Horde Groupware Webmail Edition version

Type your choice: 0

Thank you for using Horde Groupware Webmail Edition!

Tal vez esta sea la parte mas dura de todo el proceso este script o el texto siguiente esta extraido de: http://howto.landure.fr/gnu-linux/debian-4-0-etch-en/install-horde-groupware-webmail-edition-on-debian-4-0-etch

Es recomendable copiar y pegar en la terminal todo lo que hay acontinuación:


/bin/sed -i -e 's/memory_limit = .*/memory_limit = 128M/' /etc/php5/apache2/php.ini
/bin/sed -i -e "s/^\(.*problems.*email.*=\).*;/\1 'sistemas@sandi.org';/" /var/www/webmail/config/conf.php
/bin/sed -i -e "s/^\(.*problems.*maildomain.*=\).*;/\1 ' sistemas@sandi.org';/" /var/www/webmail/config/conf.php
touch /var/log/horde.log
/bin/chown www-data:www-data /var/log/horde.log
/bin/chmod 0640 /var/log/horde.log
/bin/sed -i -e 's/\/tmp\/horde\.log/\/var\/log\/horde\.log/' /var/www/webmail/config/conf.php
/bin/cp /var/www/webmail/scripts/horde.logrotate /etc/logrotate.d/horde
/etc/init.d/apache2 restart
/bin/sed -i -e 's/^\(.*memcache.*enabled.*=\).*;/\1 true;/' /var/www/webmail/config/conf.php
/bin/sed -i -e "/^\(.*conf.*memcache.*enabled.*=\).*/i\
\$conf['memcache']['hostspec'] = array('localhost');\n\
\$conf['memcache']['port'] = array('11211');\n\
\$conf['memcache']['weight'] = array();\n\
\$conf['memcache']['persistent'] = false;\n\
\$conf['memcache']['compression'] = false;\n\
\$conf['memcache']['large_items'] = true;" /var/www/webmail/config/conf.php
/bin/mkdir /var/cache/horde
/bin/chown www-data:root /var/cache/horde
/bin/chmod 0700 /var/cache/horde
/bin/sed -i -e "/^\(.*conf.*umask.*=\).*/a\
\$conf['tmpdir'] = '/var/cache/horde';" /var/www/webmail/config/conf.php
/bin/cp /var/www/webmail/scripts/temp-cleanup.cron /etc/cron.daily/horde-temp-cleanup
/bin/chmod +x /etc/cron.daily/horde-temp-cleanup
/bin/sed -i -e 's/^\(TMP_DIR=\).*/\1\/var\/cache\/horde/' /etc/cron.daily/horde-temp-cleanup
/bin/echo "# /etc/cron.d/horde : crontab fragment for horde
# Horde Alarms
*/5 * * * * /usr/bin/php /var/www/webmail/scripts/alarms.php" \
| /usr/bin/tee /etc/cron.d/horde
/bin/chown www-data /var/lib/php5
sed -i -e 's/\/usr\/local\/bin\/xlhtml/\/usr\/bin\/xlhtml/' \
-e 's/\/usr\/local\/bin\/ppthtml/\/usr\/bin\/ppthtml/' \
/var/www/webmail/config/mime_drivers.php
sed -i -e "s/\/\/ \('deb'\)/\1/g" \
-e "s/\/\/ \('enscript'\)/\1/g" \
-e "s/\/\/ \('msword'\)/\1/g" \
-e "s/\/\/ \('msexcel'\)/\1/g" \
-e "s/\/\/ \('mspowerpoint'\)/\1/g" \
-e "s/\/\/ \('rpm'\)/\1/g" \
-e "s/\/\/ \('rtf'\)/\1/g" \
-e "s/\/\/ \('srchighlite'\)/\1/g" \
-e "s/\/\/ \('webcpp'\)/\1/g" \
-e "s/\/\/ \('wordperfect'\)/\1/g" \
/var/www/webmail/config/mime_drivers.php
/bin/sed -i -e "/^\(.*conf.*sessionhandler.*type.*=\).*/a\
\$conf['mime']['magic_db'] = '/usr/share/file/magic';" /var/www/webmail/config/conf.php
/bin/sed -i -e '/.*mime_drivers.*imp.*html.*=.*array.*/{n;d}' /var/www/webmail/imp/config/mime_drivers.php
/bin/sed -i -e "/.*mime_drivers.*imp.*html.*=.*array.*/a\
'inline' => true," /var/www/webmail/imp/config/mime_drivers.php
/bin/sed -i -e "s/^\(.*'value' =>\).*'sent-mail',/\1 'Sent',/" /var/www/webmail/imp/config/prefs.php
/bin/sed -i -e "s/^\(.*'value' =>\).*'drafts',/\1 'Drafts',/" /var/www/webmail/imp/config/prefs.php
/bin/sed -i -e "s/^\(.*'value' =>\).*'trash',/\1 'Trash',/" /var/www/webmail/imp/config/prefs.php
/bin/sed -i -e "s/^\(.*'value' =>\).*'Spam',/\1 'Junk',/" /var/www/webmail/imp/config/prefs.php
/bin/sed -i -e "s/^\(.*'value' =>\).*'sent-mail',/\1 '&AMk-l&AOk-ments envoy&AOk-s',/" /var/www/webmail/imp/config/prefs.php
/bin/sed -i -e "s/^\(.*'value' =>\).*'drafts',/\1 'Brouillons',/" /var/www/webmail/imp/config/prefs.php
/bin/sed -i -e "s/^\(.*'value' =>\).*'trash',/\1 '&AMk-l&AOk-ments supprim&AOk-s',/" /var/www/webmail/imp/config/prefs.php
/bin/sed -i -e 's/^\(.*mailbox.*show_preview.*=\).*;/\1 true;/' /var/www/webmail/imp/config/conf.php
/bin/sed -i -e 's/^\(.*mboxcache.*use_mboxcache.*=\).*;/\1 true;/' /var/www/webmail/imp/config/conf.php
/bin/sed -i -e "/^\(.*conf.*mboxcache.*use_mboxcache.*=\).*/i\
\$conf['mboxcache']['use_compress'] = false;\n\
\$conf['mboxcache']['preview_size'] = 1000;\n\
\$conf['mboxcache']['lifetime'] = 2592000;" /var/www/webmail/imp/config/conf.php
/bin/sed -i -e 's/^\(.*mlistcache.*use_mlistcache.*=\).*;/\1 true;/' /var/www/webmail/imp/config/conf.php
/bin/sed -i -e "/^\(.*conf.*mlistcache.*use_mlistcache.*=\).*/i\
\$conf['mlistcache']['lifetime'] = 604800;" /var/www/webmail/imp/config/conf.php
/bin/sed -i -e 's/^\(.*mailbox.*show_attachments.*=\).*;/\1 true;/' \
-e 's/^\(.*mailbox.*show_xpriority.*=\).*;/\1 true;/' \
/var/www/webmail/imp/config/conf.php
/bin/sed -i -e 's/^\(.*server.*cachejs.*=\).*;/\1 true;/' /var/www/webmail/imp/config/conf.php
/bin/sed -i -e "/^\(.*conf.*server.*cachejs.*=\).*/i\
\$conf['server']['cachejsparams']['timeout'] = 86400;\n\
\$conf['server']['cachejsparams']['mtime'] = false;" /var/www/webmail/imp/config/conf.php
/bin/sed -i -e 's/^\(.*server.*cachecss.*=\).*;/\1 true;/' /var/www/webmail/imp/config/conf.php
/bin/sed -i -e "/^\(.*conf.*server.*cachecss.*=\).*/i\
\$conf['server']['cachecssparams']['timeout'] = 86400;\n\
\$conf['server']['cachecssparams']['mtime'] = false;" /var/www/webmail/imp/config/conf.php
/bin/sed -i -e 's/^\(.*server.*cachejs.*=\).*;/\1 true;/' /var/www/webmail/dimp/config/conf.php
/bin/sed -i -e "/^\(.*conf.*server.*cachejs.*=\).*/i\
\$conf['server']['cachejsparams']['timeout'] = 86400;\n\
\$conf['server']['cachejsparams']['mtime'] = false;" /var/www/webmail/dimp/config/conf.php
/bin/sed -i -e 's/^\(.*server.*cachecss.*=\).*;/\1 true;/' /var/www/webmail/dimp/config/conf.php
/bin/sed -i -e "/^\(.*conf.*server.*cachecss.*=\).*/i\
\$conf['server']['cachecssparams']['timeout'] = 86400;\n\
\$conf['server']['cachecssparams']['mtime'] = false;" /var/www/webmail/dimp/config/conf.php
/bin/sed -i -e "/^\(.*conf.*portal.*fixed_blocks.*=\).*/a\
\$conf['fortune']['exec_path'] = '/usr/games/fortune';" /var/www/webmail/config/conf.php
/bin/sed -i \
-e "s/^\(.*spell.*driver.*=\).*;/\1 'aspell';/" \
-e "/^\(.*conf.*spell.*driver.*=\).*/i\
\$conf['spell']['path'] = '/usr/bin/aspell';" /var/www/webmail/imp/config/conf.php
/bin/sed -i -e "/^\(.*conf.*utils.*gnupg_keyserver.*=\).*/i\
\$conf['utils']['gnupg'] = '/usr/bin/gpg';" /var/www/webmail/imp/config/conf.php
/bin/sed -i -e "/^\(.*conf.*menu.*print.*=\).*/i\
\$conf['utils']['gnupg'] = '/usr/bin/gpg';" /var/www/webmail/mnemo/config/conf.php
/bin/sed -i -e "/^\(.*conf.*utils.*gnupg_timeout.*=\).*/a\
\$conf['utils']['openssl_cafile'] = '/etc/ssl/certs';\n\
\$conf['utils']['openssl_binary'] = '/usr/bin/openssl';" /var/www/webmail/imp/config/conf.php
/usr/bin/find /var/www/webmail -type f -wholename "*config/*" | /usr/bin/xargs /bin/chown -R root:www-data
/usr/bin/find /var/www/webmail -type f -wholename "*config/*" | /usr/bin/xargs /bin/chmod 0440
/usr/bin/find /var/www/webmail -type f -name "test.php" | /usr/bin/xargs /bin/chmod a-rwx
/usr/bin/find /var/www/webmail -type d -name "scripts" | /usr/bin/xargs /bin/chown -R root:root
/usr/bin/find /var/www/webmail -type d -name "scripts" | /usr/bin/xargs /bin/chmod -R go-rwx
/bin/chmod -R ugo-w /var/www/webmail
/bin/echo "# Secure PHP for horde
expose_php = Off
display_errors = Off
log_errors = On
register_globals = Off
" | tee /etc/php5/conf.d/horde.ini
/etc/init.d/apache2 restart


Configuraciones porteriores y personalización general de Horde Webmail Edition.

Para cambiar el pie de firma por defecto editar:


nano /var/www/webmail/imp/config/trailer.txt


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


Cambiar lo que esta debajo por lo que sea conveniente por ejemplo:

----------------------------------------------------------------
Este mensaje fue enviado desde mail.sandi.org id jdjdjdjd


Cambiar la identidad por defecto:


Alrededor de la linea 105 en /var/www/webmail/lib/Horde/Identity.php exite lo siguiente
if (empty($identity['id'])) {
$identity['id'] = _("Default Identity");
}


podemos cambiarlo por ejemplo a:


if (empty($identity['id'])) {
$identity['id'] = _("Mi servidor de Ejemplo");
}


Esto para cambiar la identidad por defecto de todos los usuarios.

Ahora para establecer el tema por defecto en le archivo /var/www/webmail/config/prefs.php en la linea 304 tenemos


// UI theme
$_prefs['theme'] = array(
'value' => 'default',
'locked' => false,
'shared' => true,
'type' => 'select',
'desc' => _("Select your color scheme.")
);


Podemos cambiar para usar por ejemplo el tema tango-blue


// UI theme
$_prefs['theme'] = array(
'value' => 'tango-blue',
'locked' => false,
'shared' => true,
'type' => 'select',
'desc' => _("Select your color scheme.")
);


listo ahora todos los usuarios tendran el mismo tema/skin en el entorno web.

ahora para seleccionar un servidor por defecto editamos


/var/www/webmail/imp/config/servers.php


En la ultima parte podemos cambiar todo de manera que quede como se muestra acontinuación.


$servers['_prompt'] = array(
'name' => _("Choose a mail server:")
);


/* Example configurations: */

$servers['imap'] = array(
'name' => 'Sandi MailServer',
'server' => 'localhost',
'hordeauth' => false,
'protocol' => 'imap/notls',
'port' => 143,
);

ahora para quitar el pie de pagina de todo el webmail o cambiar la imagen editamos


/var/www/webmail/imp/config/motd.php


en la ultima linea añadimos <!-- --> para comentar:


<!--
<table width="100%">
<tr>
<td align="center"></td>
</tr>
</table>
-->

o cambiamos la imagen por defecto por otra.


<table width="100%"><tr><td align="center"><?php echo Horde::img('sandi-logo.png', _("Sandi.org"), '', $registry->getImageDir('horde')) ?></td></tr></table>

Para cambiar los correos por defecto editamos:


nano /var/www/webmail/config/hooks.php


y al final añadimos:


if (!function_exists('_passwd_hook_userdn')) {
function _passwd_hook_userdn($auth)
{
return 'uid=' . $auth . ',ou=people,o=sandi.org';
}
}


Para cambiar los correos por defecto editamos


nano /var/www/webmail/config/registry.php


y cambiamos:


$this->applications['horde'] = array(
'fileroot' => dirname(__FILE__) . '/..',
'webroot' => _detect_webroot(),
'initial_page' => 'login.php',
'name' => _("Horde"),
'status' => 'active',
'templates' => dirname(__FILE__) . '/../templates',
'provides' => 'horde',
);


por


$this->applications['horde'] = array(
'fileroot' => dirname(__FILE__) . '/..',
'webroot' => _detect_webroot(),
'initial_page' => 'login.php',
'name' => _("C.A.S. Mail Server"),
//'name' => _(preg_replace('/^webmail./', '', $GLOBALS['HTTP_SERVER_VARS']['SERVER_NAME']) ),
'status' => 'active',
'templates' => dirname(__FILE__) . '/../templates',
'provides' => 'horde',
);


Instalar y configurar passwd
Descargar y descomprimir passwd donde tengamos instalado horde webmail:

wget ftp://ftp.horde.org/pub/passwd/passwd-h3-3.1.tar.gz


cp passwd-h3-3.1.tar.gz /var/www/webmail


tar xvf passwd-h3-3.1.tar.gz


mv passwd-h3-3.1 passwd


Instalar Poppassd y xinetd:

apt-get install poppassd xinetd


Buscar o editar en /etc/services solo debe existir un solo poppassd


poppassd 106/tcp


Editar poppassd en /etc/xinetd.d/
Añadimos lo sgte:


service poppassd
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/sbin/poppassd
log_on_success += HOST DURATION
log_on_failure += HOST
}


Editar poppassd en /etc/pam.d/

#%PAM-1.0
@include common-auth
@include common-password


Editar /var/www/webmail/passwd/config/conf.php y añadir:

$conf['menu']['apps'] = array('imp', 'ingo', 'kronolith', 'turba');
$conf['backend']['backend_list'] = 'hidden';
$conf['user']['change'] = true;
$conf['user']['refused'] = array('root', 'bin', 'daemon', 'adm', 'lp', 'shutdow$
$conf['password']['strengthtests'] = true;
$conf['hooks']['full_name'] = true;
$conf['hooks']['default_username'] = false;
$conf['hooks']['username'] = false;
$conf['hooks']['userdn'] = false;

Editar /var/www/webmail/config/registry.php y añadir esto:

$this->applications['passwd'] = array(
'fileroot' => dirname(__FILE__) . '/../passwd',
'webroot' => $this->applications['horde']['webroot'] . '/passwd',
'icon' => $this->applications['horde']['webroot'] .
'/passwd/graphics/lock.gif',
'name' => _("Password"),
'allow_guests' => false,
'status' => 'active'
);


Editar /var/www/webmail/imp/config/conf.php y añadir esto al final:


$conf['menu']['apps'] = array('turba', 'passwd');


Editar /var/www/webmail/passwd/config/backends.php (borrar todo y poner solo lo siguiente:


'http://www.ejemplo.com',
'preferred' => '',
'password policy' => array(),
'driver' => 'poppassd',
'params' => array(
'host' => 'localhost',
'port' => 106
)
);


bien con esto probamos en un navegador la pagina webmail:


http://www.tuip.com/webmail


Espero a alguien le sirva, son recopilaciones de lo que hize en un pequeño tiempo que tenia.

Saludos desde Llallagua - Bolivia

Cambiar el Verbose Mode en Apache2

Una de las configuraciones que debe tener cualquier apache recién configurado y por cuestiones de seguridad es, no mostrar todos los datos del verbose mode en apache.

El verbose de apache2 es un mesaje que aparece al final del error de pagina no encontrada.

Not Found


The requested URL /ss was not found on this server.




Apache/version (Debian) PHP/version+lenny2 with Suhosin-Patch mod_python/version Python/version mod_ruby/versionRuby/version(2008-08-11) Server at www.tuservidor.com Port 80
Esto puede ser facilmente configurado, es extraño por que en Debian Etch esto estaba directamente en apache.conf pero ahora esta en security dentro de la carpeta conf.d

Ahora lo configuramos así.

nano /etc/apache2/conf.d/security

Dentro de una de este archivo buscamos una linea parecida a esta:

# Set to one of: Full | OS | Minimal | Minor | Major | Prod
# where Full conveys the most information, and Prod the least.
#
#ServerTokens Minimal
ServerTokens Full

Podemos configurarlo de varias maneras, para ello debemos reemplazar la linea ServerTokens Full por una de las que mejor se acomode a nuestras necesidades:

ServerTokens Full
Muestra toda la información


Not Found


The requested URL /ss was not found on this server.




Apache/version (Debian) PHP/version+lenny2 with Suhosin-Patch mod_python/version Python/version mod_ruby/versionRuby/version(2008-08-11) Server at www.tuservidor.com Port 80
ServerTokens OS
Muestra el Sistema Operativo

Not Found


The requested URL /ss was not found on this server.




Apache/2.2.9 (Debian) Server at www.informatica-unsxx.edu.bo Port 80

ServerTokens Minimal
Muestra lo mínimo que es lo mas recomendable
.

Not Found


The requested URL /ss was not found on this server.




Apache/2.2.9 Server at www.informatica-unsxx.edu.bo Port 80

ServerTokens minor
Es lo mismo que Minimal pero no muestra la version minima en 2.2.x


Not Found


The requested URL /ss was not found on this server.




Apache/2.2 Server at www.informatica-unsxx.edu.bo Port 80


Severtokens Major
Muestra lo siguiente, ademas

muestra la version mayor apache/2.

Not Found


The requested URL /ss was not found on this server.




Apache/2 Server at www.informatica-unsxx.edu.bo Port 80

Severtokens Prod
Muestra lo siguiente


Not Found


The requested URL /ss was not found on this server.




Apache Server at www.informatica-unsxx.edu.bo Port 80
Saludos y espero que a alguien le sea de u

Repositorios Debian o Ubuntu a DVD's

Bien pensé que esto de llevar los repositorios de Debian a DVD's seria cosa difícil pero llegado el momento no lo fue, así que ahora les mostrare los pasos que seguí para hacerlo, ahh si esta guía también sirve para ubuntu y derivados.

Esto es sumamente útil ya que en lugares donde la conexión es sumamente lenta o en algunos casos como el mio el acceso a Internet es restringido.

Lo uso para Universidad de mi población, donde la conexión es una lagrima, pero los ánimos de aprender son los mejores...

Primero instalamos los requerimientos:

apt-get install debmirror liblockfile-simple-perl liblog-agent-perl ruby mkisofs dpkg-dev libdigest-sha1-perl libruby libzlib-ruby

Es importante ubicarnos en /home para hacer todo el proceso

cd /home


Preparamos los directorios necesarios

mkdir /home/debian/
mkdir /home/debian/debian
mkdir /home/debian/debiandvd


Luego hacemos un Script para sincronizar los repositorios de Debian, OJO que para hacer esto debemos tener minimamente 60GB de espacio disponible en alguna partición, en mi caso usare la partición /home.


nano /home/debmirror.sh


Dentro pegamos lo siguiente:

ARQUITECTURA=i386,amd64
METODO=http
RAMAS=lenny,squeeze,sid,experimental
PRINCIPAL=ftp.debian.org
DIR_MIRROR=/home/debian/debian
SECCIONES=main,contrib,non-free

debmirror -a ${ARQUITECTURA} \
-s ${SECCIONES} \
-h ${PRINCIPAL}/debian \
-d ${RAMAS} -r / --progress \
-e ${METODO} --ignore-release-gpg --nosource \
${DIR_MIRROR}

Para ubuntu seria:

ARQUITECTURA=i386,amd64
METODO=http
RAMAS=karmic
PRINCIPAL=archive.ubuntu.com
DIR_MIRROR=/home/ubuntu/ubuntu
SECCIONES=main,universe,multiverse,restricted

debmirror -a ${ARQUITECTURA} \
-s ${SECCIONES} \
-h ${PRINCIPAL}/ubuntu \
-d ${RAMAS} -r / --progress \
-e ${METODO} --ignore-release-gpg --nosource \
${DIR_MIRROR}

Ahora corremos el script para sincronizar.

sh /home/debmirror.sh


Este proceso llevara como uno o 2 días depende a nuestra velocidad de conexión a Internet, como dije anteriormente son como 60GB el total de los repositorios para amd64 y también la arquitectura i386, en el caso de ubuntu los repositorios de karmic koala en su totalidad con 39GB.

Luego obtenemos este paquete llamado debpartial, es el encargado de dividir el repositorio a DVD's


wget http://archive.ubuntu.com/ubuntu/pool/universe/d/debpartial/debpartial_0+20030508-0.1_all.deb


Lo instalamos:

dpkg -i debpartial_0+20030508-0.1_all.deb


Copiamos el script debcopy a la carpeta /home:


cp /usr/share/doc/debpartial/examples/debcopy.gz /home


Descomprimimos debcopy

gunzip debcopy.gz


Ahora si a dividir todo:


debpartial --nosource --dirprefix=debian --section=main,contrib,non-free --dist=lenny --size=DVD /home/debian/debian /home/debiandvd/


Es importante ver la cantidad de dvd's que requeriremos por eso hacemos un:

ls -l /home/debian/debiandvd

para ver cuantos serán.

Ahora procedemos con el llenado a cada uno de los DVD's

ruby debcopy -l /home/debian/debian /home/debiandvd/debian0



ruby debcopy -l /home/debian/debian /home/debiandvd/debian1



ruby debcopy -l /home/debian/debian /home/debiandvd/debian2



ruby debcopy -l /home/debian/debian /home/debiandvd/debian3



ruby debcopy -l /home/debian/debian /home/debiandvd/debian4



ruby debcopy -l /home/debian/debian /home/debiandvd/debian5



ruby debcopy -l /home/debian/debian /home/debiandvd/debian6



ruby debcopy -l /home/debian/debian /home/debiandvd/debian7



ruby debcopy -l /home/debian/debian /home/debiandvd/debian8



ruby debcopy -l /home/debian/debian /home/debiandvd/debian9



ruby debcopy -l /home/debian/debian /home/debiandvd/debian10


Ahora creamos los DVD's


mkisofs -f -J -r -V "Debian 1/10" -o Debian-$(date -I)-complete-i386-amd64-dvd1.iso /home/debiandvd/debian1


mkisofs -f -J -r -V "Debian 2/10" -o Debian-$(date -I)-complete-i386-amd64-dvd2.iso /home/debiandvd/debian2


mkisofs -f -J -r -V "Debian 3/10" -o Debian-$(date -I)-complete-i386-amd64-dvd3.iso /home/debiandvd/debian3


mkisofs -f -J -r -V "Debian 4/10" -o Debian-$(date -I)-complete-i386-amd64-dvd4.iso /home/debiandvd/debian4


mkisofs -f -J -r -V "Debian 5/10" -o Debian-$(date -I)-complete-i386-amd64-dvd5.iso /home/debiandvd/debian5


mkisofs -f -J -r -V "Debian 6/10" -o Debian-$(date -I)-complete-i386-amd64-dvd6.iso /home/debiandvd/debian6


mkisofs -f -J -r -V "Debian 7/10" -o Debian-$(date -I)-complete-i386-amd64-dvd7.iso /home/debiandvd/debian7


mkisofs -f -J -r -V "Debian 8/10" -o Debian-$(date -I)-complete-i386-amd64-dvd8.iso /home/debiandvd/debian8


mkisofs -f -J -r -V "Debian 9/10" -o Debian-$(date -I)-complete-i386-amd64-dvd9.iso /home/debiandvd/debian9


mkisofs -f -J -r -V "Debian 10/10" -o Debian-$(date -I)-complete-i386-amd64-dvd10.iso /home/debiandvd/debian10


Listo con esto ya podemos grabar los DVD's y usarlos con synaptic o apt-cdrom

Long Live to Debian!

martes, 13 de abril de 2010

Mysql easy Class

Esta es una librería que uso para acceder a la BD desde cualquier form u otra clase, lo concentro en este dll, luego lo importo a la nueva aplicación y lo uso, es básica pero muy útil.

using MySql.Data.MySqlClient;
namespace library.mysqldb
{
public class mysql_db
{
#region datos de acceso a la BD
public static string host()
{
string server = "host/ip";
return server;
}
public static string database()
{
string database = "basededatos";
return database;
}
public static string username()
{
string username = "userdb";
return username;
}
public static string password()
{
string password = "password";
return password;
}
#endregion

public static string LogStr()
{
string mysqlconn = "server = " + host() + ";" +
"database=" + database() + ";" +
"user id=" + username() + ";" +
"pwd=" + password() + ";";
return mysqlconn;
}

public static bool testconexionDB()
{
string DBString = "";
MySqlConnection dbConnection = new MySqlConnection();
dbConnection.ConnectionString = LogStr();

try
{
dbConnection.Open();
DBString = "Server Version: " + dbConnection.ServerVersion + "\nDatabase: " + dbConnection.Database;
dbConnection.Close();
return true;
}

catch
{
return false;
}

}

public static string versionDB()
{
string DBString;
MySqlConnection dbConnection = new MySqlConnection();
dbConnection.ConnectionString = LogStr();

try
{
dbConnection.Open();
DBString = "Server Version: " + dbConnection.ServerVersion + "\nDatabase: " + dbConnection.Database;
dbConnection.Close();

return DBString;
}

catch
{
DBString = "No se pueden obtener datos, error en la conexión...";
return DBString;
}

}

}

}