jueves, abril 19, 2012

Nuevo Blog ;-)

Hola amigos, estoy haciendo un nuevo blog con contenido actualizado, si quieres verlo, entra a: http://angelcontents.blogspot.com

Gracias!

martes, diciembre 07, 2010

FreeBSD + PHP5

Requerimientos:

FreeBSD instalado
Apache instalado

Instalando

# whereis php5
php5: /usr/ports/lang/php5
# cd /usr/ports/lang/php5
# make config
Activar la opcion
[X] APACHE Build Apache module
[ OK ]
# make install clean

Configurando

# edit /usr/local/www/apache22/data/test.php

<?php
phpinfo();
?>

# cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

# edit /usr/local/etc/apache22/httpd.conf

Desactivo las siguientes lineas:

#<IfModule dir_module>
#DirectoryIndex index.html
#</IfModule>

Agregamos las nuevas:

# Lineas agregadas para PHP inicio
<IfModule mod_php5.c>
DirectoryIndex default.php index.html index.php login.php
</IfModule>

<IfModule mod_php5.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>
# Lineas agregadas para PHP fin

# /usr/local/etc/rc.d/apache22 restart

http://serverip/test.php

FreeBSD + Apache

Requerimientos:

FreeBSD instalado

Instalando

# whereis apache22
apache22: /usr/ports/www/apache22
# cd /usr/ports/www/apache22
# make config
# make install clean

Configurando
# edit /usr/local/etc/apache22/httpd.conf

Verificar una configuracion en httpd.conf
# /usr/local/etc/rc.d/apache22 configtest

Hacer que Apache se inicie con el sistema
# echo 'apache22_enable="YES"' >> /etc/rc.conf

Iniciar apache
# /usr/local/etc/rc.d/apache22 start

Aplicando los cambios luego de modificar algo en httpd.conf
# apachectl graceful

sábado, octubre 23, 2010

FreeBSD Updating and Upgrading

FreeBSD Updating and Upgrading
Requerimientos:

FreeBSD instalado
Conexion a Internet

Ahora vamos sincronizar y/o actualizar las fuentes de FreeBSD (Kernel + World) con csup

Chapter 24 Updating and Upgrading FreeBSD
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-upgrading.html

---------------------------------------

24.4.3 Updating the Documentation Sources
# csup -h cvsup15.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/doc-supfile

---------------------------------------

24.6 Synchronizing Your Source
A.6 Using CVSup
Note: The csup utility is a rewrite of the CVSup...
...if you are using FreeBSD 6.2 or later, you can use it out-of-the-box, since it is included in the base system.
# csup -h cvsup15.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/standard-supfile <-(VIEW THE TIP)
---
TIP :
# cp /usr/share/examples/cvsup/standard-supfile /root
# edit /root/standard-supfile
Change the lines
*default host=CHANGE_THIS.FreeBSD.org
*default release=cvs tag=RELENG_7_1
for
*default host=cvsup15.us.FreeBSD.org
*default release=cvs tag=RELENG_8_1

Exit from editor and save changes (en edit, con "Esc" main menu, "a" leave editor, "a" save changes)

Note :
for FreeBSD 8.1 RELEASE use tag=RELENG_8_1, for FreeBSD 8.2 use tag=RELENG_8_2
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/cvs-tags.html
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/cvsup.html#CVSUP-MIRRORS

# csup -g -L 2 /root/standard-supfile
---

---------------------------------------

24.7 Rebuilding “world”

These concerns have led to the following recommended sequence. Note that the detailed sequence for particular updates may require additional steps, but this core process should remain unchanged for some time:

# cd /usr/src (hay que estar dentro de este directorio para el siguiente comando)

1. make buildworld
This first compiles the new compiler and a few related tools, then uses the new compiler to compile the rest of the new world. The result ends up in /usr/obj.

2. make buildkernel <-(VIEW THE TIP)
Unlike the older approach, using config(8) and make(1), this uses the new compiler residing in /usr/obj. This protects you against compiler-kernel mismatches.

3. make installkernel <-(VIEW THE TIP)
Place the new kernel and kernel modules onto the disk, making it possible to boot with the newly updated kernel.
---
TIP: Storing your kernel configuration file directly under /usr/src can be a bad idea. If you are experiencing problems it can be tempting to just delete /usr/src and start again. After doing this, it usually only takes a few seconds for you to realize that you have deleted your custom kernel configuration file. Also, do not edit GENERIC directly, as it may get overwritten the next time you update your source tree, and your kernel modifications will be lost.

You might want to keep your kernel configuration file elsewhere, and then create a symbolic link to the file in the i386 directory.

For example:
# cd /usr/src/sys/i386/conf
# mkdir /root/kernels
# cp GENERIC /root/kernels/MYKERNEL
# ln -s /root/kernels/MYKERNEL

8.6 The Configuration File
Now, edit MYKERNEL with your favorite text editor.
# edit MYKERNEL
Change the line:
ident GENERIC
for
ident MYKERNEL

Save an exit for editor (en edit, con "Esc" se abre el menu, "a" salir del editor, "a" guardar cambios)
8.5 Building and Installing a Custom Kernel
Building a Kernel
1. Change to the /usr/src directory:
# cd /usr/src
2. Compile the kernel:
# make buildkernel KERNCONF=MYKERNEL
3. Install the new kernel:
# make installkernel KERNCONF=MYKERNEL
---

4. Reboot into single user mode <-(VIEW THE TIP)
Single user mode minimizes problems from updating software that's already running. It also minimizes any problems from running the old world on a new kernel.
---

TIP:
24.7.5 Drop to Single User Mode

As the superuser, you can execute:

# shutdown now

from a running system, which will drop it to single user mode.

Alternatively, reboot the system, and at the boot prompt, select the “single user” option. The system will then boot single user. At the shell prompt you should then run:

# fsck -p
# mount -u /
# mount -a -t ufs
# swapon -a
---

5. mergemaster -p <-(VIEW THE NOTE)
This does some initial configuration file updates in preparation for the new world. For instance it may add new user groups to the system, or new user names to the password database. This is often necessary when new groups or special system-user accounts have been added since the last update, so that the installworld step will be able to use the newly installed system user or system group names without problems.
---
NOTE:
http://www.understudy.net/makeworld.html#mergemaster1

*** The directory specified for the temporary root environment,
/var/tmp/temproot, exists. This can be a security risk if untrusted users have access to the system.

Use 'd' to delete the old /var/tmp/temproot and continue
Use 't' to select a new temporary root directory
Use 'e' to exit mergemaster

Default is to use /var/tmp/temproot as is

How should I deal with this? [Use the existing /var/tmp/temproot]

Press Enter ( which means use /var/tmp/temproot ) and you should be good to go. This will keep the temporary root environment in /var/tmp/temproot. It will now start to compare a large number of files. And show you the differences between them.

Now it is going to start going through your /etc/ directory and /dev/MAKEDEV file .This is the beginning of the hellish part of Make World. Some notes on what you will see here. Mergemaster brings up the current file on the hard drive and the new version.If they are the same it smiles and moves on. If they are different it will point out the differences. It brings up what is different between the files and shows you just the things that are different in the file. It may not need to bring up everything in the file. The symbols used in Mergemaster:

--- 3 minus symbols in a row usually pertaining to the date of the file installation. I have only seen them at the top of a file that is to be changed. It means the line next to them really has to be removed.

+++ 3 plus symbols in a row usually pertaining to the date of the file installation. I have only seen them at the top of a file that is to be changed. It means the line next to them really has to be added (replace the existing line).

@@ means the line numbers that will be affected by the change. @@ -1,5 +1,24 @@ means line 1 and the next 4 lines will become line 1 and the next 24 lines. Look at the next symbols to understand.
+ means the line that will be added.

- means the line that will be replaced/ removed

. The mergemaster then brings up this dialogue.

Use 'd' to delete the temporary .name of file
Use 'i' to install the temporary .name of file
Use 'm' to merge the temporary and installed versions or parts of them.
Use 'v' to view the diff results again

Default is to leave the temporary file to deal with by hand

How should I deal with this? [Leave it for later]

'd' will remove any new lines for the file leaving it the way it was. No changes.
'i' will install all of the new lines and remove all of the old lines.
'm' will place both old and /or new lines in the file.
'v' lets you look at it again.

Use 'i' if you want to upgrade. Use 'd' if you don't. Use 'm' if you want to screw with things. And do it without the quotes.

Okay important notes here. If you have custom files in the /etc/ directory And you just click through this without checking. I can assure you they will be gone when your trip to Make World is done. and you will not have had a good time on the rides.You did remember to backup didn't you?
So how do I know what to upgrade and what to not upgrade? And what to merge?

My rules of thumb on this is:

The 'd' is for files that I have customized. Files I don't want changes in. Files like ppp.conf.
---

*** Comparison complete
Do you wish to delete what is left of /var/tmp/temproot? [no] (dar enter)


# cd /usr/src (hay que estar dentro de este directorio para el siguiente comando)

6. make installworld
Copies the world from /usr/obj. You now have a new kernel and new world on disk.

7. mergemaster
Now you can update the remaining configuration files, since you have a new world on disk.
---
Default is to use /var/tmp/temproot as is

How should I deal with this? [Use the existing /var/tmp/temproot] (dar enter)

The presence of stale files in this directory can cause the
dreaded unpredictable results, and therefore it is highly
recommended that you delete them.

*** Delete them now? [n] yes (poner 'yes' y dar enter)

Default is to leave the temporary file to deal with by hand

How should I deal with this? [Leave it for later] ( si es un archivo que hemos modificado como ppp.conf doy 'd', pero si me sirve el nuevo poner 'i' y dar enter)

Do you wish to delete what is left of /var/tmp/temproot? [no] yes (poner yes y dar enter)
---

8. reboot
A full machine reboot is needed now to load the new kernel and new world with new configuration files.

---------------------------------------

Para verificar que version de kernel tenemos, usamos el comando:
# uname -a
FreeBSD pruebas.alpha.telemedellin.tv 8.1-RELEASE-p1 FreeBSD 8.1-RELEASE-p1 #0: Thu Oct 21 07:44:33 COT 2010 angel@pruebas.alpha.telemedellin.tv:/usr/obj/usr/src/sys/MYKERNEL i386

Si hemos actualizado la version de FreeBSD modificando el RELENG_X_Y puede que tengamos que recompilar e instalar todos los ports que tengamos actualmente instalados, para hacer esto ejecutamos
# portupgrade -af

Si quisieramos desistalar todos los ports que tengamos en un solo comando, puedemos ejecutar
# cd /var/db/pkg
# pkg_delete *

---------------------------------------

Si algo sale mal y el nuevo kernel no funciona bien, puedo regresar al anterior
Al iniciar el equipo nos muestra el listado de opciones de inicio de FreeBSD

6. Escape to loader prompt
Type '?' for a list of commands, 'help' for more detailed help.
OK

(escribimos)
unload kernel (enter)
(escribimos)
boot /boot/kernel.old/kernel (enter)

Luego podemos renombrar el kernel problematico y renombrar el kernel anterior que funciona (kernel.old)
# mv /boot/kernel /boot/kernel.bad
# mv /boot/kernel.old /boot/kernel

---------------------------------------

Ahora vamos a actualizar el arbol de ports

# csup -h cvsup15.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/ports-supfile <-(VIEW THE TIP)
---
TIP :
# cp /usr/share/examples/cvsup/ports-supfile /root
# edit /root/ ports-supfile
Change the lines
*default host=CHANGE_THIS.FreeBSD.org
for
*default host=cvsup15.us.FreeBSD.org

Exit from editor and save changes (en edit, con "Esc" main menu, "a" leave editor, "a" save changes)

# csup -h cvsup15.us.FreeBSD.org -g -L 2 /root/ports-supfile

Note :
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/cvsup.html#CVSUP-MIRRORS
---

---------------------------------------

Ejemplo de como se usan los ports, aqui instalaremos portupgrade, es una utilidad para mantener actualizados los ports que se instalen luego y hasta portupgrade mismo.

Instalar nuestro primer port, portupgrade:
# whereis portupgrade
portupgrade: /usr/ports/ports-mgmt/portupgrade
# cd /usr/ports/ports-mgmt/portupgrade
# make install clean
Options for portupgrade 2.4.6_4,2
[X] BDB4 Use Berkeley DB >=2 as backend
[ OK ]

Suele pasar que luego de instalar algun port, al ejecutar el comando, nos muestre
Command not found.

Hay dos formas de hacer que permita usar el port:

Ejecutar el comando
# rehash

Tambien podemos simplemente salir de la sesion (exit), iniciar de nuevo sesion y ejecutar el comando de nuevo

Comandos basicos de portupgrade:
# pkg_version -v <- Imprime como estan las versiones
# portupgrade -a <- Actualiza los ports instalados
# portsclean -DD <- Limpia los ports viejos guardados en /usr/ports/distfiles

martes, julio 27, 2010

FreeBSD 8 + Migracion usuarios

Manuales:

http://forums.freebsd.org/showthread.php?t=5446
http://forums.freebsd.org/showthread.php?t=3292
http://www.afterschool.dk/documents/freebsd/freebsd-migrate-users/

Para migrar los usuarios de un equipo con FreeBSD a otro equipo con FreeBSD, se debe hacer backup a los siguientes archivos:

BACKUPS (en el servidor viejito)

Usuarios de FreeBSD
/etc/passwd
/etc/master.passwd
/etc/group

Documentos de los usuarios de FreeBSD
/usr/home
/var/mail

Usuarios de SAMBA de FreeBSD
/usr/local/etc/samba34/passdb.tdb
/usr/local/etc/samba34/secrets.tdb

Archivo con los parametros para compartir en SAMBA
/usr/local/etc/smb.conf

RESTAURACION (en el servidor nuevo)

Se instala FreeBSD
Se crea el usuario root y si lo deseamos para ssh creamos algun otro usuario.
Se instala SAMBA
Hacemos que SAMBA arranque con el sistema agregando en /etc/rc.conf las lineas:

# Activamos Samba
nmbd_enable="YES"
smbd_enable="YES"

Se reemplazan los archivos existentes con los del backups, que son los que tienen los datos importantes (usuarios, passwords y grupos)
Con "pwd_mkdb" se regeneran los passwords, con el siguiente comando:
# pwd_mkdb -p /etc/master.passwd

Si nuestro FreeBSD actua como file server, el contenido de
/usr/home
es donde ellos tienen su informacion importante y que debemos restaurar del backup

El directorio
/var/mail
guarda los e-mails de los usuarios del equipo, si nuestro FreeBSD actua como file server, no es importante restaurar esto.

Aqui les dejo un script para automatizar el proceso, pero cuidado que lo deben ajustar a su equipo y lo mas importante, deben activar o no el backup de /usr/home y /var/mail segun se desee (por defecto los dejo activo!)

Contenido del script INICIO

#! /bin/sh

# Manual
# http://forums.freebsd.org/showthread.php?t=5446
# http://forums.freebsd.org/showthread.php?t=3292

# http://www.afterschool.dk/documents/freebsd/freebsd-migrate-users/
#
# Move user entries from the following old files:
# /etc/passwd
# /etc/group
# /etc/master.passwd
#
# Then run the following command to rebuild the password database:
# pwd_mkdb -p /etc/master.passwd

# Macros
path="/root/backups"

# USUARIOS y PASSWORDS de FreeBSD
#

# 1 Backup /etc/passwd
tar -czf $path/passwd-`date +%Y-%m-%d-%H-%M`.tar.gz /etc/passwd

# 2 Backup /etc/master.passwd
tar -czf $path/master.passwd-`date +%Y-%m-%d-%H-%M`.tar.gz /etc/master.passwd

# 3 Backup /etc/group
tar -czf $path/group-`date +%Y-%m-%d-%H-%M`.tar.gz /etc/group

# 4 Backup /usr/home
tar -czf $path/home-`date +%Y-%m-%d-%H-%M`.tar.gz /usr/home

# 5 Backup /var/mail
tar -czf $path/mail-`date +%Y-%m-%d-%H-%M`.tar.gz /var/mail

# USUARIOS y PASSWORDS de SAMBA en FreeBSD
#
# Parte 1. Backup a: /usr/local/etc/samba o /usr/local/etc/samba34, activar el que corresponda a la version de samba
#
# =<> samba34 (samba34-3.4.9) /usr/local/etc/samba34/ por defecto utiliza 'passdb.tdb' + 'secrets.tdb' para sus usuarios
#tar -czf /usr/home/hd1/backups/FreeBSD/Usuarios-Samba34-`date +%Y-%m-%d-%H-%M`.tar.gz /usr/local/etc/samba34
#
# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration.
# ; passdb backend = tdbsam
#
# Entonces podemos emplear tdbsam o smbpasswd segun se desee, la linea para el archivo 'smbpasswd' seria.
# passdb backend = smbpasswd
#
# Convertir 'smbpasswd' a 'passdb.tdb' con el comando (como root):
# pdbedit -i smbpasswd:/path/smbpasswd -e tdbsam:/path/passdb.tdb
#
# Convertir 'passdb.tdb' a 'smbpasswd'con el comando (como root):
# pdbedit -i tdbsam:/path/passdb.tdb -e smbpasswd:/path/smbpasswd
#
# Podemos preguntarle a SAMBA cual usa actualmente con el comando:
# smbd -b | less
# ...
# SMB_PASSWD_FILE: /usr/local/etc/samba/smbpasswd
# ...
#
# Parte 2. Backup a: /usr/local/etc/smb.conf
tar -czf $path/samba.conf-`date +%Y-%m-%d-%H-%M`.tar.gz /usr/local/etc/smb.conf
#
# Parte 3. Backup a: /root/.nsmbrc <- Aqui se ingresan los host, usuarios y claves para montajes remotos con SAMBA
tar -czf $path/dotnsmbrc-`date +%Y-%m-%d-%H-%M`.tar.gz /root/.nsmbrc

Contenido del script FIN

Los comandos usados son basicamente:

Descomprimir los .tar.gz
# tar -xvzf archivo.tar.gz

Copiar un archivo
# cp archivo /ruta/

Copiar un directorio recursivamente, osea con los archivos y sub-directorios
# cp -r /ruta/directorio /ruta/

Borrar un directorio que tenga archivos y sub-directorios
# rm -rf directorioaborrar

martes, junio 01, 2010

FreeBSD + APCUPSD

Requerimientos:

FreeBSD instalado
UPS APC con tarjeta AP9619 conectada al servidor

Manuales:
/usr/local/share/doc/apcupsd/apcupsd.pdf
http://www.apcupsd.com/manual/manual.pdf
http://www.apcupsd.com/
http://www.freebsddiary.org/apcupsd.php
http://www.packetwatch.net/documents/guides/2010031301.php

Instrucciones:

1) Instalar el port apcupsd-3.14.8
# whereis apcupsd
apcupsd: /usr/ports/sysutils/apcupsd
# cd /usr/ports/sysutils/apcupsd
# make config
[X] APCSMART_DRV Compile APC SmartUPS serial driver
[X] APCDUMB_DRV Compile dumb UPS driver
[ ] CLIENT_ONLY Only NIS client (no network server or drivers)
[X] CGI Compile with CGI programs to show status
[X] PCNET_DRV Compile PowerChute Network Shutdown driver
[X] USB Compile with USB Support driver
[X] SNMP_DRV Compile with SNMP driver
[ ] SNMP_DRV_OLD Compile with old SNMP driver
[X] TCP_WRAPPERS Compile with TCP_WRAPPERS support
[ ] TEST_DRV Compile TEST driver
[ ] GAPCMON Build GTK GUI front-end

[ OK ]

# make install clean
---
**********************************************************************
Read the manual

/usr/local/share/doc/apcupsd/apcupsd.pdf

to do site specific configuration assigenments! Especially have a
detailed look into the chapter describing the shutdown procedure.

Sample files are installed in /usr/local/etc/apcupsd. These files
must be copied and/or configured for a proper working apcupsd.
You need to modify /usr/local/etc/apcupsd/apcupsd.conf as follows:

For serial cable: DEVICE /dev/cuadX (or /dev/cuaaX for [45.]x)
For USB cable: DEVICE (yes, leave it blank after DEVICE)

NOTE that for USB cable you must comment out the line

device uhid # "Human Interface Devices"

in your kernel configuration file and recompile the kernel.
Your keyboard and mouse will still work.

WARNING USB support on FreeBSD is still considered BETA!

Add apcupsd_enable=YES to your /etc/rc.conf[.local] to have apcupsd
starting up at boot time.

**********************************************************************
---

2) Configurar APCUPSD
# cd /usr/local/etc/apcupsd
# ls
apccontrol apcupsd.conf.sample apcupsd.css.sample changeme commok
hosts.conf.sample multimon.conf.sample onbattery apcupsd.conf
apcupsd.css cgi commfailure hosts.conf multimon.conf offbattery
# cp apcupsd.conf apcupsd.conf.sample
# cp apccontrol apccontrol.sample
# edit apcupsd.conf

# egrep -v '#|^ *$' apcupsd.conf
---
UPSNAME SURT10000XLT-1TF10K
UPSCABLE ether
UPSTYPE snmp
DEVICE 192.168.1.187:161:APC:private
POLLTIME 60
LOCKFILE /var/spool/lock
SCRIPTDIR /usr/local/etc/apcupsd
PWRFAILDIR /var/run
NOLOGINDIR /var/run
ONBATTERYDELAY 6
BATTERYLEVEL 5
MINUTES 3
TIMEOUT 0
ANNOY 300
ANNOYDELAY 60
NOLOGON disable
KILLDELAY 0
NETSERVER on
NISIP 0.0.0.0
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
UPSCLASS standalone
UPSMODE disable
STATTIME 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0
---

# touch /var/log/apcupsd.events
# touch /var/log/apcupsd.status

# edit hosts.conf
# egrep -v '#|^ *$' hosts.conf
---
MONITOR 127.0.0.1 "SURT10000XLT-1TF10K"
---

# edit multimon.conf
# egrep -v '#|^ *$' multimon.conf
---
TEMPC
FIELD SYSTEM "System" ""
FIELD MODEL "Model" ""
FIELD STATUS "Status" ""
FIELD battpct "Battery Chg" "%"
FIELD utility "Utility" "VAC"
FIELD loadpct "UPS Load" "%"
FIELD UPSTEMP "UPS Temp" ""
FIELD runtime "Batt. Run Time" "min."
FIELD DATA "Data" "All data"
---

3) Verificar que en el firewall se pueda acceder al puerto TCP 3551 del servidor desde la LAN

4) Editar el archivo /etc/rc.conf para agregar las lineas de APCUPSD para que inicie con el equipo

# edit /etc/rc.conf
---
# Activamos apcupsd (Si tengo una UPS marca APC)
apcupsd_enable="YES"
---

5) Crear el sitio en APACHE para monitorear la UPS remotamente por WWW ([X] CGI) agregando unas lineas
# edit /usr/local/etc/apache22/httpd.conf
---
# Modificacion para APCUPSD inicio
<Directory /usr/local/etc/apcupsd>
AllowOverride Options FileInfo
Order deny,allow
Allow from all
</Directory>
<Directory /usr/local/etc/apcupsd/cgi>
Options ExecCGI
</Directory>
ScriptAlias /apcupsd/cgi/ /usr/local/etc/apcupsd/cgi/
Alias /apcupsd /usr/local/etc/apcupsd/
# Modificacion para APCUPSD fin
---

Re-iniciar APACHE
# /usr/local/etc/rc.d/apache22 restart

6) Ajustar los parametros de la UPS
PARAMETROS DE LA UPS
IP Address: 192.168.1.187
Mask: 255.255.255.0
Gateway: 192.168.1.1

Tarjeta AP9619 S/N:
MAC Address 00:C0:B7:80:CA:D1

Enviarle la IP a la tarjeta desde FreeBSD
# arp -s 192.168.1.187 00:C0:B7:80:CA:D1
# ping 192.168.1.187 -s 113

Entrar por telnet a la ip de la tarjeta
# telnet 192.168.1.187

Login: apc
Passwd: apc

7) Iniciar el servicio
# /usr/local/etc/rc.d/apcupsd start

8) Monitorear la UPS via WWW, entrar a:
http://ipdemiserver/apcupsd/cgi/multimon.cgi

9) apcaccess Test
# apcaccess status
---
APC : 001,048,1167
DATE : 2010-09-01 07:36:10 -0500
HOSTNAME : alpha.company.com
VERSION : 3.14.8 (16 January 2010) freebsd
UPSNAME : UPS_IDEN
CABLE : Ethernet Link
MODEL : SNMP UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2010-08-31 06:34:22 -0500
STATUS : ONLINE
LINEV : 205.0 Volts
LOADPCT : 38.0 Percent Load Capacity
BCHARGE : 100.0 Percent
TIMELEFT : 19.0 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
MAXLINEV : 205.0 Volts
MINLINEV : 204.0 Volts
OUTPUTV : 207.0 Volts
SENSE : Unknown
DWAKE : 000 Seconds
DSHUTD : 020 Seconds
DLOWBATT : 02 Minutes
LOTRANS : 146.0 Volts
HITRANS : 229.0 Volts
RETPCT : 000.0 Percent
ITEMP : 34.0 C Internal
ALARMDEL : 5 seconds
BATTV : 214.0 Volts
LINEFREQ : 59.0 Hz
LASTXFER : Unacceptable line voltage changes
NUMXFERS : 0
TONBATT : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
SELFTEST : OK
STESTI : 336
STATFLAG : 0x07000008 Status Flag
MANDATE : 07/19/06
SERIALNO : NS0630013487
BATTDATE : 07/19/06
NOMOUTV : 208 Volts
NOMBATTV : 4294967295.0 Volts
EXTBATTS : 1
BADBATTS : -1
FIRMWARE : 476.17.W
APCMODEL : Smart-UPS RT 10000
END APC : 2010-09-01 07:37:10 -0500
---

10) APCUPSD SLAVE:
Se instala y configura en modo slave, estos son equipos que aunque reciben
energia de la UPS no estan conectados directamente a ella.

Nota:
La ip del servidor que corre APCUPSD en modo MASTER es 192.168.1.1

Parametros para los SLAVE en apcupsd.conf
UPSCABLE ether
UPSTYPE net
DEVICE 192.168.1.1:3551

WINDOWS
Cliente http://sourceforge.net/projects/apcupsd/files/win-binaries%20-%20Stable/
C:\apcupsd\etc\apcupsd\apcupsd.conf
Log
C:\apcupsd\etc\apcupsd\apcupsd.events

GNU/LINUX UBUNTU
$ sudo su
[sudo] password for angel:
# gedit /etc/apcupsd/apcupsd.conf
# gedit /etc/default/apcupsd
cambiar
ISCONFIGURED=no
por
ISCONFIGURED=yes

GNU/LINUX SUSE
YaST / Software / Software Management
apcupsd
# gedit /etc/apcupsd/apcupsd.conf
YaST / System / System Services (Runlevel)
apcupsd
Enable

MAC OS X
Configurar
sudo vi /private/etc/apcupsd/apcupsd.conf

Desinstalar
sudo /sbin/apcupsd-uninstall

FreeBSD
Configurar
# edit /usr/local/etc/apcupsd/apcupsd.conf
# edit /etc/rc.conf
apcupsd_enable="YES"
# /usr/local/etc/rc.d/apcupsd start
# exit

viernes, mayo 28, 2010

FreeBSD + MySQL

Requerimientos:

FreeBSD Instalado


Instrucciones:
1) Instalar MySQL desde los ports
# cd /usr/ports/databases/mysql50-server
# make install clean

2) Hacer que el MySQL se inicie con el sistema poniendo una linea en /etc/rc.conf como esta

# Activamos MySQL
mysql_enable="YES"

3) Iniciar MySQL para no tener que re-iniciar el servidor
# /usr/local/etc/rc.d/mysql-server start

4) Creamos el usuario administrador del gestor
# mysqladmin -u root password 'PASSWORDROOT'

Nota:
PASSWORDROOT se debe cambiar por una clave valida para el usuario root en MySQL
MyDB se debe cambiar por el nombre de la base de datos que requiero crear
usuario1 se debe cambiar por el nombre de usuario con el que se ingresara a DB
passusuario1 se debe cambiar por la clave que queremos para usuario1

5) Creamos la DB con su usuario correspondiente

# mysql -u root -p
Enter password: <- PASSWORDROOT
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15 Server version: 5.0.90 FreeBSD port: mysql-server-5.0.90 Type 'help;' or '\h' for help.
Type '\c' to clear the current input statement. mysql>

6) Crear la DB junto con el usuario y clave (todo de una)

CREAMOS DB utf8, permiso solo desde red clase "C", usuario y password, recargamos permisos
# mysql -u root -p
Enter password: <- PASSWORDROOT
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.0.90 FreeBSD port: mysql-server-5.0.90

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE MyDB CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.01 sec)

mysql> GRANT ALL PRIVILEGES ON MyDB.* TO usuario1@'192.168.1.%' IDENTIFIED BY 'passusuario1';

Query OK, 0 rows affected (0.05 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> \q


Nota:

Esta permite conectar desde cualquier ip de la lan clase "C"
mysql> GRANT ALL PRIVILEGES ON MyDB.* TO usuario1@'192.168.1.%' IDENTIFIED BY 'passusuario1';

Con esta linea solo se permite conectar desde la ip 192.168.1.244
mysql> GRANT ALL PRIVILEGES ON MyDB.* TO usuario1@192.168.1.244 IDENTIFIED BY 'passusuario1';

7) Creamos la estructura (no se puede hacer si en el shell estoy como root)
$ mysql --user=root --password=PASSWORDROOT* MyDB < /tmp/dbiniciar.sql

8) Importamos los datos a la DB (no se puede hacer si en el shell estoy como root)
$ mysql --user=root --password=PASSWORDROOT* MyDB < /tmp/datos.sql

NOTA: Para borrar la DB que en este caso llamamos MyDB
# mysqladmin -u root drop MyDB -p
Enter password: <- PASSWORDROOT
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.

Do you really want to drop the 'MyDB' database [y/N]y

9) PRUEBAS CONEXION

REMOTA (desde un linux con mysql-client -> FreeBSD)

$ mysql -h 192.168.1.1 -u usuario1 MyDB -p
Enter password: <- passusuario1
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 522
Server version: 5.0.90 FreeBSD port: mysql-server-5.0.90

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> \q
Bye

LOCAL (desde FreeBSD)

# mysql -u root MyDB -p
Enter password: <- PASSWORDROOT
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 5.0.90 FreeBSD port: mysql-server-5.0.90

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> \q
Bye

BACKUP A LA DB ACTUAL (NO SE PUEDE HACER COMO ROOT)
$ mysqldump --user=root --password=PASSWORDROOT MyDB | gzip > /tmp/MyDB.sql.gz

IMPORTAR BACKUP

DESCOMPRIMIR EL BACKUP
# cd /tmp
# gunzip MyDB.sql.gz

IMPORTAR LA DB DEL BACKUP (NO SE PUEDE HACER COMO ROOT)
$ mysql --user=root --password=PASSWORDROOT MyDB < /tmp/MyDB.sql

martes, mayo 25, 2010

FreeBSD + Squid-cache + squidGuard

Este resumen no está disponible. Haz clic aquí para ver la publicación.