2016/04/26
FreeBSD 10.3 RELEASE AMD64
Instalar FreeBSD 10.3 RELEASE AMD64
Se instalaran algunos paquetes binarios
Requerimientos:
* Conexion a Internet
* Instalador de FreeBSD
* Leer este tutorial
El proceso:
Iniciar el equipo desde el medio de instalacion
FreeBSD Installer
---------------------------------------------------------------------------------------------------
Welcome
Welcome to FreeBSD! Would you
like to begin an installation
or use the live CD?
<Install> < Shell > <Live CD>
Keymap Selection
>>> Continue with default keymap
<Select> <Cancel>
Set Hostname
freebsd.example.com
< OK >
Distribution Select
[*] doc Additional documentation
[ ] games Games (fortune, etc.)
[ ] lib32 32-bit compatibility libraries
[*] ports Ports tree
[*] src System source code
< OK >
Partitioning
Auto (UFS) Guide Disk Setup
Manual Manul Disk Setup (experts)
Shell Open a shell nd partition by hand
Auto (ZFS) Guided Root-on-ZFS
< OK >
ZFS Configuration
>>> Install Proceed with Installation
T Pool Type/Disks: stripe: 0 disks
- Rescan Devices *
- Disk Info *
N Pool Name zroot
4 Force 4K Sectors? YES
E Encrypt Disk? NO
P Partition Scheme GPT (BIOS)
S Swap Size 2g <- Este valor se puede cambiar RAM x 2 => 8g
M Mirror Swap? NO
W Encrypt Swap? NO
< Select >
ZFS Configuration
Select Virtual Device type:
stripe Stripe - No Redundancy
mirror Mirror - n-Way Mirroring
raidz1 RAID-Z1 - Single Redundant RAID
raidz2 RAID-Z2 - Double Redundant RAID
raidz3 RAID-Z3 - Triple Redundant RAID
< OK >
ZFS Configuration
[*] xyz0 VirtIO Block Device <- Esto puede cambiar, use un disco virtual
< OK >
ZFS Configuration
Last Change! Are you sure you want to destroy
the current contents of the following disks:
vtbd0
< YES >
Overall Progress:
]]]]]]]]]]]]]]] 40%
Please select a password for the system management account (root):
Changing local password for root
New Password: ********
Retype New Password: ********
Network Configuration
Please select a network interface to
configure:
vtnet0 VirtIO Networking Adapter
< OK >
Network Configuration
Would you like to
configure IPv4 for this
interface?
< YES >
Network Configuration
Would you like to use
DHCP to configure this
interface?
< YES > < NO >
Network Configuration
Static Network Interface Configuration
IP Address 172.16.3.50 <- Ajuste estos parametros a su red
Subnet Mask 255.255.0.0
Default Router 172.16.1.1
< OK >
Network Configuration
Would you like to
configure IPv6 for this
interface?
< YES > < NO >
Network Configuration
Would you like to try
stateless address
autoconfiguration
(SLAAC)?
< YES > < NO >
Network Configuration
Static IPv6 Network Interface Configuration
IPv6 Address fc00::3:50/7
Default Router fc00::1:1
< OK >
Network Configuration
Resolver Configuration
Search samdom.example.com
IPv6 DNS #1 2001:4860:4860::8888
IPv6 DNS #2 2001:4860:4860::8844
IPv4 DNS #1 8.8.8.8
IPv4 DNS #2 8.8.4.4
< OK >
Select local or UTC (Greenwich Mean Time) clock
Is this machine's CMOS clock set to UTC? If it is to local time,
or you don't know, please choose NO here!
< YES > < NO >
Time Zone Selector
Select a region
1 Africa
2 America -- North and South
3 Antarctica
4 Arctic Ocean
5 Asia
6 Atlantic Ocean
7 Australia
8 Europe
9 Indian Ocean
0 Pacific Ocean
a UTC
< OK >
Countries in America -- North and South
Select a country or region
1 Anguilla
2 Antigua and Barbuda
3 Argentina
4 Aruba
5 Bahamas
6 Barbados
7 Belize
8 Bolivia, Plurinational State of
9 Bonaire, Sint Eustatius and Saba
10 Brazil
11 Canada
12 Cayman Islands
13 Chile
14 Colombia
15 Costa Rica
16 Cuba
< OK >
Confirmation
Does the abbreviation `COT' look reasonable?
< YES >
System Configuration
Choose the services you would like to be started at boot:
[ ] local_unbound Local caching validating resolve
[*] sshd Secure shell daemon
[ ] moused PS/2 mouse pointer or console
[ ] ntpd Synchronize system and network time
[ ] powerd Adjust CPU frequency dynamically if supported
[*] dumpdev Enable kernel crsh dumps to /var/crash
< OK >
Add User Accounts
Would you like to add
users to the installed
system now?
< YES >
Add Users
Username: jdoe
Full name: John Doe
Uid (Leave empty for default):
Login group [jdoe]:
Login group is jdoe. Invite jdoe into other groups? []:wheel
Shell (sh csh tcsh nologin) [sh]:
Home directory [/home/jdoe]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a randon password? (yes/no) [no]:
Enter password: ********
Enter password again: ********
Lock out the account after creation? [no]:
Username : jdoe
Password : ********
Full Name : John Doe
Uid : 1001
Class :
Groups : jdoe wheel
Home : /home/jdoe
Home Mode :
Shell : /bin/sh
Locked : no
OK? (yes/no) : yes
adduser: INFO : Successfully added (jdoe) to the user database.
Add another user? (yes/no): no
Goodbye!
Final Configuration
Setup of your FreeBSD system is nearly complete. You can now
modify your configuration choices. After this screen, you will
have an opportunity to make more complex changes using a shell.
Exit Apply configuration and exit installer
Add User Add a user to the system
Root Password Change root password
Hostname Set system hostname
Network Networking configuration
Services Set daemons to run on startup
Time Zone Set system timezone
Handbook Install FreeBSD Handbook (requires network)
< OK >
Manual Configuration
The installation is now finished.
Before exiting the installer, would
you like to open a shell in the new
system to make any final manual
modification?
< YES > < NO >
Complete
Installation of FreeBSD
complete! Would you like
ro reboot into the
installed system now?
<Reboot> <Live CD>
Actualizar los binarios de FreeBSD
# freebsd-update fetch
# freebsd-update install
Instalar algunos paquetes binarios
# /usr/sbin/pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:10:amd64/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-1.7.2...
Extracting pkg-1.7.2: 100%
---
For more information on available commands and options see 'pkg help'.
# pkg info pkg
pkg-1.7.2
---
# pkg update
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
---------------------------------------------------------------------------------------------------------------
Actualización 2016/12/14 Inicio
El paquete binario de openntpd no esta disponible en este momento
En su lugar activaremos el ntp que ya tiene FreeBSD, para activarlo
# echo '# NTP' >> /etc/rc.conf
# echo 'ntpd_enable="YES"' >> /etc/rc.conf
Y omitiremos la parte referente al openntpd que siguen aqui abajo!
# pkg search openntpd
openntpd-5.7p4_2,2 Network Time Protocol (NTP) daemon
# pkg install openntpd
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Updating database digests format: 100%
The following 3 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
openntpd: 5.7p4_2,2
libressl: 2.2.6
ca_root_nss: 3.22.2
The process will require 10 MiB more space.
3 MiB to be downloaded.
Proceed with this action? [y/N]: y
Fetching openntpd-5.7p4_2,2.txz: 100% 41 KiB 42.4kB/s 00:01
Fetching libressl-2.2.6.txz: 100% 2 MiB 1.2MB/s 00:02
Fetching ca_root_nss-3.22.2.txz: 100% 324 KiB 331.5kB/s 00:01
Checking integrity... done (0 conflicting)
[1/3] Installing libressl-2.2.6...
[1/3] Extracting libressl-2.2.6: 100%
[2/3] Installing ca_root_nss-3.22.2...
[2/3] Extracting ca_root_nss-3.22.2: 100%
[3/3] Installing openntpd-5.7p4_2,2...
Agregamos las tres lineas al archivo rc.conf para que inicie con el sistema
# echo '# OpenNTP' >> /etc/rc.conf
# echo 'openntpd_enable="YES"' >> /etc/rc.conf
# echo 'openntpd_flags="-sv"' >> /etc/rc.conf
Verificamos que se agregaron las tres lineas al archivo rc.conf
# cat /etc/rc.conf | egrep "OpenNTP|openntpd"
# OpenNTP
openntpd_enable="YES"
openntpd_flags="-sv"
Iniciamos el servico
# /usr/local/etc/rc.d/openntpd start
Starting openntpd.
ntp_adjtime adjusted frequency by 0.000000ppm
Actualización 2016/12/14 Fin
---------------------------------------------------------------------------------------------------------------
Nota:
FreeBSD envia automaticamente reportes de estado al usuario root y solo los vemos si iniciamos localmente con este usuario, pero podemos hacer que estos reportes sean enviados a una cuenta en otro lugar, por ejemplo a nuestra cuenta en Gmail, para hacer esto debemos:
# edit /etc/mail/aliases
Buscamos una linea que dice
# root: me@my.domain
Y luego de esa creamos una nueva con nuestro mail
root: micorreo@gmail.com
Guardamos los cambios en el editor y ejecutamos el comando
# cd /etc/mail && make
Si root tiene un monton de correos, los podemos eliminar con
# cat /dev/null > /var/mail/root
Comandos basicos de la utilidad pkg:
Buscar un programa
# pkg search name
Instalar un programa
# pkg install name
Informacion de un programa instalado
# pkg info name
Desinstalar un programa
# pkg delete name
Actualizar todos los programas instalados
# pkg upgrade
Ejemplo de pkg:
# pkg search nvidia-driver
---
nvidia-driver-346.96 NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-304-304.128 NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-340-340.93 NVidia graphics card binary drivers for hardware OpenGL rendering
Como se puede ver hay varias versiones del driver de nvidia, para instalar una especificamente, la 340 en este caso
# pkg install nvidia-driver-340
Luego para verificar el paquete instalado
# pkg info nvidia-driver-340
nvidia-driver-340-340.93
---
Activar UTF-8 "Alternately, the superuser"
Ver las localizaciones disponibles
$ locale -a | grep '\.UTF-8$'
# edit /etc/login.conf
Modificar esta seccion de modo que quede asi:
default:\
:passwd_format=sha512:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K,LC_COLLATE=C:\
:path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\
:nologin=/var/run/nologin:\
:cputime=unlimited:\
:datasize=unlimited:\
:stacksize=unlimited:\
:memorylocked=64K:\
:memoryuse=unlimited:\
:filesize=unlimited:\
:coredumpsize=unlimited:\
:openfiles=unlimited:\
:maxproc=unlimited:\
:sbsize=unlimited:\
:vmemoryuse=unlimited:\
:swapuse=unlimited:\
:pseudoterminals=unlimited:\
:priority=0:\
:ignoretime@:\
:umask=022:\
:charset=UTF-8:\
:lang=en_US.UTF-8:
Aplicar los cambios
# cap_mkdb /etc/login.conf
Especificamos el locale en este otro lugar tambien
# edit /etc/profile
[...]
LANG=en_US.UTF-8; export LANG
CHARSET=UTF-8; export CHARSET
El cambio a UTF-8 requiere reiniciar.
Ver los logs del sistema
# cat /var/run/dmesg.boot
# cat /var/log/messages
# tail -f /var/log/auth.log
# dmesg -a
Ejemplo para desinstalar todos los pkg instalados
# pkg delete -a
2015/10/05
NIS
Instalar un Network Information System (NIS)
Requerimientos:
* FreeBSD instalado
* Conexion a Internet
* Leer este tutorial
Manuales:
https://www.freebsd.org/doc/handbook/network-nis.html
http://daemon-notes.com/articles/network/unix-lan/nis
http://blog.zespre.com/posts/2014/12/freebsd-nis-nfs
Proceso:
-------------------------------------------------------------------------------------------------------------------------------------
NIS Master Server
# cat /etc/rc.conf
...
# Network Information System (NIS)
# NIS Master Server
nisdomainname="samdom.dominio.com"
nis_server_enable="YES"
nis_yppasswdd_enable="YES"
# A server that is also a client
nis_client_enable="YES" # run client stuff as well
nis_client_flags="-S samdom.dominio.com,alpha"
# mkdir /var/yp/samdom.dominio.com
# service ypserv start
# cp /etc/master.passwd /var/yp/master.passwd
# cd /var/yp
# edit /var/yp/master.passwd
Borro todos los usuarios especiales y solo dejo los que iniciaran en los equipos.
# chmod 0600 /var/yp/master.passwd
# ypinit -m samdom.dominio.com
Server Type: MASTER Domain: samdom.dominio.com
Creating an YP server will require that you answer a few questions.
Questions will all be asked at the beginning of the procedure.
Do you want this procedure to quit on non-fatal errors? [y/n: n]
Ok, please remember to go back and redo manually whatever fails.
If you don't, something might not work.
Can we destroy the existing /var/yp/samdom.dominio.com and its contents? [y/n: n] y
At this point, we have to construct a list of this domains YP servers.
alpha.samdom.dominio.com is already known as master server.
Please continue to add any slave servers, one per line. When you are
done with the list, type a <control D>.
master server : alpha.samdom.dominio.com
next host to add: ^D
The current list of NIS servers looks like this:
alpha.samdom.dominio.com
Is this correct? [y/n: y] y
[..output from map generation..]
NIS Map update completed.
alpha.samdom.dominio.com has been setup as an YP master server without any errors.
# adduser
Username: jdoe
Full name: John Doe
Uid (Leave empty for default):
Login group [jdoe]:
Login group is jdoe. Invite jdoe into other groups? []:
Login class [default]:
Shell (sh csh tcsh nologin) [sh]:
Home directory [/home/jdoe]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username : jdoe
Password : *****
Full Name : John Doe
Uid : 1002
Class :
Groups : jdoe
Home : /home/jdoe
Home Mode :
Shell : /bin/sh
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added (jdoe) to the user database.
Add another user? (yes/no): no
Goodbye!
# cd /var/yp
# make samdom.dominio.com
`samdom.dominio.com' is up to date.
# cat /var/yp/securenets
# allow connections from local host -- mandatory
127.0.0.1 255.255.255.255
# allow connections from my LAN
# on the 192.168.128.0 network
#192.168.128.0 255.255.255.0
# on the 172.16.0.0 network
172.16.0.0 255.255.0.0
# allow connections from any host
# between 10.0.0.0 to 10.0.15.255
#10.0.0.0 255.255.240.0
# shutdown -r now
# dmesg -a
...
Setting NIS domain: samdom.dominio.com.
Starting rpcbind.
Starting ypserv.
Starting ypbind.
-------------------------------------------------------------------------------------------------------------------------------------
NIS Slave Server
# cat /etc/rc.conf
...
# Network Information System (NIS)
# NIS Slave Server
nisdomainname="samdom.dominio.com"
nis_server_enable="YES"
nis_yppasswdd_enable="YES"
# A server that is also a client
nis_client_enable="YES" # run client stuff as well
nis_client_flags="-S samdom.dominio.com,alpha"
# mkdir /var/yp/samdom.dominio.com
# ypinit -s alpha samdom.dominio.com
Server Type: SLAVE Domain: samdom.dominio.com Master: alpha
Creating an YP server will require that you answer a few questions.
Questions will all be asked at the beginning of the procedure.
Do you want this procedure to quit on non-fatal errors? [y/n: n] n
Ok, please remember to go back and redo manually whatever fails.
If not, something might not work.
There will be no further questions. The remainder of the procedure
should take a few minutes, to copy the databases from alpha.
Transferring netgroup...
ypxfr: Exiting: Map successfully transferred
Transferring netgroup.byuser...
ypxfr: Exiting: Map successfully transferred
Transferring netgroup.byhost...
ypxfr: Exiting: Map successfully transferred
Transferring master.passwd.byuid...
ypxfr: Exiting: Map successfully transferred
Transferring passwd.byuid...
ypxfr: Exiting: Map successfully transferred
Transferring passwd.byname...
ypxfr: Exiting: Map successfully transferred
Transferring group.bygid...
ypxfr: Exiting: Map successfully transferred
Transferring group.byname...
ypxfr: Exiting: Map successfully transferred
Transferring services.byname...
ypxfr: Exiting: Map successfully transferred
Transferring rpc.bynumber...
ypxfr: Exiting: Map successfully transferred
Transferring rpc.byname...
ypxfr: Exiting: Map successfully transferred
Transferring protocols.byname...
ypxfr: Exiting: Map successfully transferred
Transferring master.passwd.byname...
ypxfr: Exiting: Map successfully transferred
Transferring networks.byname...
ypxfr: Exiting: Map successfully transferred
Transferring networks.byaddr...
ypxfr: Exiting: Map successfully transferred
Transferring netid.byname...
ypxfr: Exiting: Map successfully transferred
Transferring hosts.byaddr...
ypxfr: Exiting: Map successfully transferred
Transferring protocols.bynumber...
ypxfr: Exiting: Map successfully transferred
Transferring ypservers...
ypxfr: Exiting: Map successfully transferred
Transferring hosts.byname...
ypxfr: Exiting: Map successfully transferred
bravo has been setup as an YP slave server without any errors.
Remember to update map ypservers on alpha.
-------------------------------------------------------------------------------------------------------------------------------------
NIS Client
# cat /etc/rc.conf
...
# Network Information System (NIS)
# NIS Client
nisdomainname="samdom.dominio.com"
nis_client_enable="YES" # run client stuff as well
nis_client_flags="-S samdom.dominio.com,alpha
# /etc/netstart
# service ypbind start
DDNS + DHCPd
Instalar un servidor DDNS que sera actualizado desde el servidor DHCPd.
Requerimientos:
* FreeBSD instalado
* Conexion a Internet
* Leer este tutorial
Proceso:
(pendiente, pero los comandos y los archivos son validos para poner a funcionar todo)
Comandos usados:
# bsdconfig
# passwd
# freebsd-update fetch
# freebsd-update install
# portsnap fetch extract
# portsnap fetch update
# cd /usr/ports/dns/bind910
# make config-recursive
# make install clean
# rndc-confgen -a
wrote key file "/usr/local/etc/namedb/rndc.key"
# cd /usr/ports/net/isc-dhcp43-server
# make config-recursive
# make install clean
Por un tema de cambio de rutas en FreeBSD 8.2 y FreeBSD 10.2 creo un link simple
# ln -s /usr/local/etc/namedb/ /etc/namedb
Ajusto y/o creo los siguientes archivos
------------------------------------------------------------------------------------------------------------------------------------
# cat /etc/rc.conf
hostname="alpha.samdom.dominio.com"
# Servicio SSH
sshd_enable="YES"
# Primera tarjeta de red (INTERNET)
ifconfig_em0="inet 192.168.16.22 netmask 255.255.240.0"
defaultrouter="192.168.16.1"
# Segunda tarjeta de red (LAN)
ifconfig_em1="inet 172.16.100.1 netmask 255.255.0.0"
# NTP
ntpd_enable="YES"
ntpd_config="/etc/ntp.conf"
# ISC-DHCPd Server
dhcpd_enable="YES"
dhcpd_conf="/usr/local/etc/dhcpd.conf"
dhcpd_ifaces="em1"
# ISC BIND
named_enable="YES"
# Activamos OpenBSD Packet Filter (PF)
pf_enable="YES" # Enable PF (load module if required)
pf_rules="/etc/pf.conf" # rules definition file for pf
pf_flags="" # additional flags for pfctl startup
pflog_enable="YES" # start pflogd(8)
pflog_logfile="/var/log/pflog" # where pflogd should store the logfile
pflog_flags="" # additional flags for pflogd startup
gateway_enable="YES" # Enable as LAN gateway (PF)
# Network Information System (NIS)
# NIS Master Server
nisdomainname="samdom.dominio.com"
nis_server_enable="YES"
nis_yppasswdd_enable="YES"
nis_client_enable="YES"
nis_client_enable="YES" # run client stuff as well
nis_client_flags="-S NIS domain,server"
# IPv6
#ipv6_activate_all_interfaces="YES"
ifconfig_em1_ipv6="inet6 2001:0db8:1000:8b00::2 prefixlen 64"
ipv6_defaultrouter="2001:0db8:1000:8b00::1"
------------------------------------------------------------------------------------------------------------------------------------
# cat /etc/ntp.conf
# Associate to the public NTP pool servers
server 0.pool.ntp.org prefer
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
# Location of drift file
driftfile /var/db/ntp.drift
# Location of the log file
logfile /var/log/ntpd
# Restrictions
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
restrict 127.127.1.0
------------------------------------------------------------------------------------------------------------------------------------
# cat resolv.conf
# Generated by resolvconf
#nameserver 192.168.16.1
#nameserver 192.168.16.8
# FreeBSD DNS
search samdom.dominio.com
#nameserver 2001:4860:4860::8888
#nameserver 2001:4860:4860::8844
#nameserver 8.8.8.8
#nameserver 8.8.4.4
nameserver 127.0.0.1
------------------------------------------------------------------------------------------------------------------------------------
# cat /usr/local/etc/namedb/named.conf
Google Drive
------------------------------------------------------------------------------------------------------------------------------------
# cat /usr/local/etc/namedb/dynamic/samdom.dominio.com
Google Drive
------------------------------------------------------------------------------------------------------------------------------------
# cat /usr/local/etc/namedb/dynamic/16.172.in-addr.arpa
Google Drive
------------------------------------------------------------------------------------------------------------------------------------
# cat /usr/local/etc/dhcpd.conf
Google Drive
------------------------------------------------------------------------------------------------------------------------------------
# cat /etc/pf.conf
Google Drive
------------------------------------------------------------------------------------------------------------------------------------
# touch /var/log/ntpd
# /usr/local/etc/rc.d/named start
# /usr/local/etc/rc.d/isc-dhcpd start
# shutdown -r now
# rndc status
version: BIND 9.9.8 (Extended Support Version) <id:2d6d4ba>
CPUs found: 1
worker threads: 1
UDP listeners per interface: 1
number of zones: 163
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running
Para poder editar mis archivos de zonas hay que congelarlos con:
# rndc freeze samdom.dominio.com
# rndc freeze 16.172.in-addr.arpa
Luego de editarlos (recordar actualizar el serial "2015100101" de cada uno) descongelarlos con:
# rndc thaw samdom.dominio.com
# rndc thaw 16.172.in-addr.arpa
2015/02/06
Instalar fuentes en FreeBSD
Instalar fuentes adicionales en FreeBSD.
Requerimientos:
* FreeBSD instalado
* The X Window System instalado
* Leer este tutorial
El proceso:
Type1 Fonts
# cd /usr/ports/x11-fonts/urwfonts
# make install clean
# edit /etc/X11/xorg.conf
Agregamos al final la linea FontPath "/usr/local/lib/X11/fonts/urwfonts/", se ve asi:
Section "Files"
ModulePath "/usr/local/lib/xorg/modules"
...
FontPath "/usr/local/lib/X11/fonts/75dpi/"
FontPath "/usr/local/lib/X11/fonts/urwfonts/"
Para cargar las nuevas fuentes sin reiniciar las X, ejecutamos desde la cuenta del usuario
$ xset fp+ /usr/local/lib/X11/fonts/urwfonts
$ xset fp rehash
TrueType® Fonts
# edit /etc/X11/xorg.conf
Agregamos al final la linea FontPath "/usr/local/lib/X11/fonts/TrueType/", se ve asi:
Section "Files"
ModulePath "/usr/local/lib/xorg/modules"
...
FontPath "/usr/local/lib/X11/fonts/urwfonts/"
FontPath "/usr/local/lib/X11/fonts/TrueType/"
Agregamos al final la linea Load "freetype", se ve asi:
Section "Module"
...
Load "dri2"
Load "freetype"
# mkdir /usr/local/lib/X11/fonts/TrueType
# cd /usr/ports/x11-fonts/ttmkfdir
# make install clean
Copiar las fuentes al directorio /usr/local/lib/X11/fonts/TrueType
# cp /usr/home/jdoe/*.ttf /usr/local/lib/X11/fonts/TrueType
Luego las hacemos compatibles con FreeBSD
# cd /usr/local/lib/X11/fonts/TrueType
# ttmkfdir -o fonts.dir
Para cargar las nuevas fuentes sin reiniciar las X, ejecutamos desde la cuenta del usuario
$ xset fp+ /usr/local/lib/X11/fonts/TrueType
$ xset fp rehash
2014/12/01
Dispositivos USB
Introduccion:
Montar memorias USB en FreeBSD
El usuario root no tiene problemas para montar un dispositivo USB mediante el comando
Ver el dispositivo detectado por el sistema
# dmesg
# camcontrol devlist
Montar el dispositivo detectado
# mount -t msdosfs -o -m=644,-M=755 /dev/da0s1 /mnt
Este tutorial explica como permitir que los usuarios no-root puedan montar dispositivos USB.
Requerimientos:
* Acceso a root
* Leer este tutorial
Tutoriales:
https://www.freebsd.org/doc/handbook/usb-disks.html
http://www.codebuddies.de/2014/03/28/0x0b-howto-mount-a-extfat-filesystem-on-freebsd
https://forums.freebsd.org/threads/mount-exfat-fuse-as-regular-user.46985
http://olivier.cochard.me/bidouillage/installation-et-configuration-de-freebsd-comme-poste-de-travail
http://blog.desdelinux.net/freebsd-que-hacer-despues-instalar
https://forums.freebsd.org/threads/formatting-a-usb-stick.10986
http://www.freebsdonline.com/content/view/890/524
http://bsdgurl.net/text/formatting-external-disk-to-fat32.txt
El proceso:
Agregamos nuestro usuario john al grupo operator
# pw groupmod operator -m john
# edit /etc/devfs.rules
# USB Storage Devices
[localrules=5]
add path 'da*' mode 0660 group operator
# edit /etc/rc.conf
# USB Storage Devices
devfs_system_ruleset="localrules"
# edit /etc/sysctl.conf
# USB Storage Devices
vfs.usermount=1
# sysctl vfs.usermount=1
# service devfs restart
# mkdir /mnt/usb
# chown john:john /mnt/usb
# camcontrol devlist
<Generic Flash Disk 5.00> at scbus10 target 0 lun 0 (da0,pass7)
% ls /dev/da0*
/dev/da0s1
% mount -t msdosfs -o -m=644,-M=755 /dev/da0s1 /mnt/usb
% umount /mnt/usb
Para facilitar el montar y desmontar la memoria, se puede usar el siguiente scirpt:
$ edit ~/Desktop/USB-Key.sh
#!/bin/sh
if [ "$(df -h | grep '/mnt/usb' | cut -d ' ' -f1)" != '/dev/da0s1' ]; then
echo 'Montando memoria'
mount -t msdosfs -o -m=644,-M=755 /dev/da0s1 /mnt/usb
dolphin /mnt/usb > /dev/null 2>&1
else
echo 'Desmontando memoria'
killall dolphin
umount /mnt/usb
fi
Si necesitamos formatear el dispositivo USB (no debe estar montado)
Then we clean the drive (remove previous partition):
# dd if=/dev/zero of=/dev/da0 bs=1m
Then we will create the slice:
# fdisk -i da0
Do you want to change our idea of what BIOS thinks ? [n] Press Enter
Do you want to change it?[n] Press Enter
Do you want to change it?[n] Press Enter
Do you want to change it?[n] Press Enter
Do you want to change it?[n] Press Enter
Do you want to change the active partition? [n] Press Enter
Should we write new partition table? [n] Press y
Then we will create the FAT32 file system:
# newfs_msdos -F32 /dev/da0s1
2014/06/20
LG Nexus 5 LG-D820 y LG-D821 Factory Images
En este tutorial se enseƱa a flashear nuestro equipo LG Nexus 5, para el modelo LG-D820 que se comercializa para USA y para el modelo LG-D821 que se comercializa para Europa, con las imagenes de fabrica que proporciona Google.
Se pueden consultar las ultimas imagenes de fabrica en este lugar
https://developers.google.com/android/nexus/images
El proceso de flasheo no es complicado, pero requiere de unos conocimientos minimos para hacerlo, si usted no sabe que es un Terminal o si no tiene la paciencia para seguir este tutorial paso a paso, es mejor que pase de el y espere que la actualizacion le llegue mediante OTA (Over-The-Air) automaticamente en unas semanas.
Flashear un Nexus 5 es relativamente seguro, pero nada en la vida sera 100% seguro, si usted sigue este manual es bajo su propio riesgo entendiendo que existe un minimo de peligro de daƱar su querido Nexus y puede tener que enviarlo al centro de servicio si algo sale mal.
Este proceso borrara todo el contenido de su Nexus 5, por favor haga una copia del contenido importante primero (fotos, contactos, etc.).
Para nuestro tutorial usaremos un equipo de Apple MAC con OS X, las imagenes de fabrica tambien se pueden flashear en computadores con Windows, pero yo prefiero hacerlo en un MAC ya que es mas facil al no tener que descargar drivers y otras cosas.
En este tutorial se uso la ultima version de la imagen de fabrica de Android 4.4.4, pero tambien se puede usar para versiones mas nuevas ajustando las rutas de descarga y los nombres de directorios.
Todo el proceso se hara, como explico usando un MAC, mediante el Terminal, mi intencion es que usando el terminal usted simplemente debe copiar los comandos y pegarlos en el Terminal de su computador y dar enter, pero recuerde que si esta intentando usar este manual con una version superior de Android a la 4.4.4, debe actualizar los links y los nombres de los directorios.
Requerimientos:
* Un computador Apple con OS X.
* Conexion a Internet.
* Un Nexus 5 de cualquiera de los dos modelos existentes (LG-D820 o LG-D821).
* El cable original USB de su equipo o uno compatible.
Actualizado (2014/11/12) para Android 5.0 (LRX21O)
Opcion 1. El proceso automatizado mediante un script:
Para hacer el proceso de una forma mas facil, he creado un script que ejecuta los comandos paso a paso, pero esta en desarrollo en estos momentos, aqui lo puede descargar desde Google Drive -> hammerhead.sh, para usarlo lo debe descargar al escritorio de su computador, luego se va al Terminal que se encuentra en Finder / Applications / Utilities / Terminal.
Debe ejecutar el script asi (ajuste el comando al nombre del script):
$ chmod +x ~/Desktop/hammerhead.sh
$ ~/Desktop/hammerhead.sh
y seguir las instrucciones del script.
Finder / Applications / Utilities / Terminal
1) Entrar al directorio
$ cd ~/Desktop
2) Descargar el archivo de imagen
$ md5 ~/Desktop/hammerhead.tgz
4) Verificar el sha-1 del archivo (comparelo con el de la web)
$ openssl sha1 ~/Desktop/hammerhead.tgz
5) Descomprimir el archivo
$ tar -xvzf ~/Desktop/hammerhead.tgz
6) Cambiar el nombre del directorio
Para Android 5.0 (LRX21O) use
$ sed -i '' 's/fastboot/~\/Desktop\/hammerhead\/fastboot/g' ~/Desktop/hammerhead/flash-all.sh
8) Descargar el fastboot que esta en el ADT Bundle
$ curl -o adt-bundle-mac-x86_64.zip https://dl.google.com/android/adt/adt-bundle-mac-x86_64-20140702.zip
9) Descomprimir el adt-bundle-mac-x86_64.zip
$ unzip adt-bundle-mac-x86_64.zip
10) Copiar el adb al directorio hammerhead
$ cp ~/Desktop/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb ~/Desktop/hammerhead
11) Darle permisos de ejecucion al adb
$ chmod +x ~/Desktop/hammerhead/adb
12) Copiar fastboot al directorio hammerhead
$ cp ~/Desktop/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/fastboot ~/Desktop/hammerhead
13) Darle permisos de ejecucion al fastboot
$ chmod +x ~/Desktop/hammerhead/fastboot
14) Conectar el Nexus 5 al Mac con el cable original USB o uno compatible
15) Reiniciar el Nexus 5 en "FASTBOOT MODE"
$ ~/Desktop/hammerhead/adb reboot bootloader
Nota:
Tambien se puede hacer manualmente al encender el Nexus 5 manteniendo presionadas las teclas Volumen abajo + Volumen arriba + boton encender simultaneamente.
Veremos en rojo el titulo
FASTBOOT MODE
...
LOCK STATE - locked <- en color negro!
16) Desbloquear el bootloader
$ ~/Desktop/hammerhead/fastboot oem unlock
En el terminal veremos algo como esto:
...
OKAY [101.578s]
finished. total time: 101.578s
Veremos un titulo Unlock bootloader?
Para confirmar
Volumen arriba + boton encender
Luego de unos 10 segundos, veremos
LOCK STATE - unlocked <- en color rojo!
17) Entrar al directorio hamerhead
$ cd ~/Desktop/hammerhead
18) Ahora iniciamos la instalacion de la imagen de fabrica
$ ~/Desktop/hammerhead/flash-all.sh
En el terminal veremos algo como esto:
sending 'bootloader' (2508 KB)...
OKAY [ 0.187s]
writing 'bootloader'...
OKAY [ 0.474s]
finished. total time: 0.661s
rebooting into bootloader...
OKAY [ 0.099s]
finished. total time: 0.099s
sending 'radio' (45409 KB)...
OKAY [ 1.539s]
writing 'radio'...
OKAY [ 3.112s]
finished. total time: 4.651s
rebooting into bootloader...
OKAY [ 0.092s]
finished. total time: 0.092s
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
--------------------------------------------
Bootloader Version...: HHZ11k
Baseband Version.....: M8974A-2.0.50.1.16
Serial Number........: 06a9bccg002be57a
--------------------------------------------
checking product...
OKAY [ 0.100s]
checking version-bootloader...
OKAY [ 0.100s]
checking version-baseband...
OKAY [ 0.100s]
sending 'boot' (8700 KB)...
OKAY [ 0.570s]
writing 'boot'...
OKAY [ 0.749s]
sending 'recovery' (9284 KB)...
OKAY [ 0.661s]
writing 'recovery'...
OKAY [ 0.779s]
erasing 'system'...
OKAY [ 1.292s]
sending 'system' (721400 KB)...
OKAY [ 22.793s]
writing 'system'...
OKAY [ 49.290s]
erasing 'userdata'...
OKAY [ 17.289s]
formatting 'userdata' partition...
Creating filesystem with parameters:
Size: 29236371456
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 32768
Label:
Blocks: 7137786
Block groups: 218
Reserved block group size: 1024
Created filesystem with 11/1785856 inodes and 156120/7137786 blocks
sending 'userdata' (139109 KB)...
writing 'userdata'...
OKAY [ 15.596s]
erasing 'cache'...
OKAY [ 0.638s]
formatting 'cache' partition...
Creating filesystem with parameters:
Size: 734003200
Block size: 4096
Blocks per group: 32768
Inodes per group: 7472
Inode size: 256
Journal blocks: 2800
Label:
Blocks: 179200
Block groups: 6
Reserved block group size: 47
Created filesystem with 11/44832 inodes and 5813/179200 blocks
sending 'cache' (13348 KB)...
writing 'cache'...
OKAY [ 2.196s]
rebooting...
finished. total time: 112.681s
$
Luego el Nexus 5 se reiniciara y veremos una barra azul de progreso
El equipo se reiniciara y ya nos mostrara la ventana para poner el idioma y comenzar la configuracion de nuestra cuenta de Google, pero no continuaremos ya que hay que bloquear nuevamente el bootloader.
19) Reiniciar el Nexus 5 en "FASTBOOT MODE"
$ ~/hammerhead/adb reboot bootloader
Veremos en rojo el titulo
FASTBOOT MODE
...
LOCK STATE - unlocked <- en color rojo!
20) Bloquear el bootloader
$ ~/Desktop/hammerhead/fastboot oem lock
En el terminal veremos algo como esto:
...
OKAY [ 0.040s]
finished. total time: 0.040s
Veremos en rojo el texto
FASTBOOT MODE
...
LOCK STATE - locked <- en color negro!
21) Reiniciamos normalmente el Nexus 5
$ ~/hammerhead/adb reboot
Ya podemos desconectar el Nexus 5 del computador y ya si configurar nuestra cuenta de Google.
2014/03/20
Wireshark
Instalar el software Wireshark para hacer pruebas de monitoreo de trafico.
Requerimientos:
* FreeBSD instalado
* The X Window System instalado
* KDE instalado
* Conexion a Internet
* Leer este tutorial
Manuales utilizados:
https://forums.freebsd.org/viewtopic.php?&t=20109
http://watchingthecloud.blogspot.com/2010/06/how-to-see-connections-in-wireshark.html
http://wiki.wireshark.org/DisplayFilters
El proceso:
Agregar nuestro usuario no root al grupo wheel
# edit /etc/group
la linea original
wheel:*:0:root
queda asi
wheel:*:0:root, jdoe
Ahora debemos ajustar los permisos de /dev/bpf para que los usurios del grupo wheel puedan acceder
# edit /etc/devfs.conf
Al final agregamos las lineas
# Wireshark
own /dev/bpf* root:wheel
perm /dev/bpf* 0640
Reiniciamos devfs
# /etc/rc.d/devfs restart
Instalamos el port de wireshark
# cd /usr/ports/net/wireshark
# make install clean
...
Installing wireshark-1.10.6... done
===> Cleaning for libsmi-0.4.8
===> Cleaning for adns-1.4_1
===> Cleaning for GeoIP-1.4.8_3
===> Cleaning for wireshark-1.10.6
Al terminar la instalacion, ya podemos iniciar wireshark desde el usuario jdoe y veremos las tarjetas en las que podemos hacer capturas.
Si luego de usarlo, queremos desinstalarlo, ejecutamos
# pkg delete libsmi-0.4.8 adns-1.4_1 GeoIP-1.4.8_3 wireshark-1.10.6
Para saber como se usa, es bueno ver el siguiente link
http://www.wireshark.org/docs
2014/02/19
SFTP
Configurar el servicio SFTP para transferencias y que el usuario este enjaulado.
Requerimientos:
* FreeBSD instalado
* Conexion a Internet
* Leer este tutorial
Manuales utilizados:
Chroot sftp users using ssh
El proceso:
# edit /etc/ssh/sshd_config
Agragar al final las lineas:
Match group chroot
ChrootDirectory %u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
Reiniciar (restart o reload) sshd
# /etc/rc.d/sshd reload
Agragar el nuevo grupo llamado chroot
# pw addgroup chroot
Nota:
Para eliminar un grupo creado, usar: # pw groupdel nombregrupo
Agregar el nuevo usuario con el que se conectaran
# adduser
Username: sftpuser
Full name: SFTP User
Uid (Leave empty for default):
Login group [sftpuser]: chroot <- Atencion a este parametro!
Login group is chroot. Invite sftpuser into other groups? []:
Login class [default]:
Shell (sh csh tcsh nologin) [sh]:
Home directory [/home/sftpuser]: /home/sftpuser
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username : sftpuser
Password : *****
Full Name : SFTP User
Uid : 1170
Class :
Groups : chroot
Home : /home/sftpuser
Home Mode :
Shell : /bin/sh
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added (sftpuser) to the user database.
Add another user? (yes/no): no
Goodbye!
Ahora le ajustamos los permisos al home del usuario
# chown -R root:chroot /home/sftpuser
Crear un directorio llamado pub dentro para que puedan crear archivos
# mkdir /home/sftpuser/pub
Ajustarle los permisos al directorio pub
# chmod -R 0777 /home/sftpuser/pub
Los archivos se deben transferir al directorio pub
2014/02/06
ISC BIND (DNS)
Instalar ISC BIND.
Requerimientos:
* FreeBSD instalado
* Conexion a Internet
* Leer este tutorial
El proceso:
Actualizar el arbol de ports
# portsnap update
Instalar el port de bind
# cd /usr/ports/dns/bind99
# make install clean
bind99-9.9.5
(dejo las opciones por defecto)
...
Installing bind99-9.9.5... done
Hacer que inicie con el equipo
# echo '# ISC BIND' >> /etc/rc.conf
# echo 'named_enable="YES"' >> /etc/rc.conf
Activar la tarjeta de red que va a nuestra LAN con la IP 192.168.1.1/24
# edit /etc/rc.conf
Agregamos la linea con los datos de nuestra segunda tarjeta de red
#Segunda tarjeta de red que va hacia la LAN
ifconfig_em1="inet 192.168.1.1 netmask 255.255.255.0"
Levantamos manualmente la segunda tarjeta sin reiniciar
# ifconfig em1 inet 192.168.1.1 netmask 255.255.255.0 up
Editar el archivo de configuracion de bind para crear nuestras zonas
# edit /usr/local/etc/namedb/named.conf
Ajustamos las lineas originales
...
listen-on { 127.0.0.1; };
...
forwarders {
127.0.0.1;
};
...
zone "example.com" { type master; file "/etc/namedb/master/empty.db"; };
...
por
...
listen-on { 127.0.0.1; 192.168.1.1; };
...
forwarders {
8.8.8.8;
8.8.4.4;
};
...
//zone "example.com" { type master; file "/etc/namedb/master/empty.db"; };
...
Note que:
1) En listen-on se agrega la IP interna para que bind responda consultas que le hagan.
2) En forwarders quitamos la IP local y agregamos las de los DNS de Google.
3) Con doble slash (//) comentamos la linea zone "example.com"...
Al final del archivo agregamos nuestras zonas "zona" y "zona inversa"
...
zone "example.com" {
type master;
allow-update { none; };
allow-transfer { localhost; 192.168.1.2; };
file "/usr/local/etc/namedb/master/example.com";
};
zone "1.168.192.in-addr.arpa" {
type master;
allow-update { none; };
allow-transfer { localhost; 192.168.1.2; };
file "/usr/local/etc/namedb/master/1.168.192.in-addr.arpa";
};
Creamos el archivo de nuestra "zona"
# edit /usr/local/etc/namedb/master/example.com
$TTL 3600 ; 1 hour default TTL
example.com. IN SOA freebsd.example.com. admin.example.com. (
2013021701 ; Serial
10800 ; Refresh (3 hours)
3600 ; Retry (1 hour)
604800 ; Expire (1 week)
300 ; Negative Response TTL (5 minutes)
)
; DNS Servers
IN NS freebsd.example.com.
; MX Records
;IN MX 10 mx.example.com.
;IN MX 20 mail.example.com.
IN A 192.168.1.1
; Machine Names
localhost IN A 127.0.0.1
freebsd IN A 192.168.1.1
; Aliases
Creamos el archivo de nuestra "zona inversa"
# edit /usr/local/etc/namedb/master/1.168.192.in-addr.arpa
$TTL 3600 ; 1 hour default TTL
1.168.192.in-addr.arpa. IN SOA freebsd.example.com. admin.example.com. (
2013021701 ; Serial
10800 ; Refresh (3 hours)
3600 ; Retry (1 hour)
604800 ; Expire (1 week)
300 ; Negative Response TTL (5 minutes)
)
; DNS Servers
IN NS freebsd.example.com.
; Machine IPs
1 IN PTR freebsd.example.com.
Iniciamos bind
# /usr/local/etc/rc.d/named start
Hacer que nuestro FreeBSD use el bind
# edit /etc/resolv.conf
Comentamos las lineas "nameserver" y agregamos a bind, queda asi
search example.com
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
#nameserver 8.8.8.8
#nameserver 8.8.4.4
nameserver 127.0.0.1
Verificamos que bind esta funcionando
Prueba a un host local
# dig @192.168.1.1 freebsd.example.com
; <<>> DiG 9.9.5 <<>> @192.168.1.1 freebsd.example.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36043
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;freebsd.example.com. IN A
;; ANSWER SECTION:
freebsd.example.com. 3600 IN A 192.168.16.1
;; AUTHORITY SECTION:
freebsd.example.com. 3600 IN NS ns1.freebsd.example.com.
freebsd.example.com. 3600 IN NS ns2.freebsd.example.com.
;; ADDITIONAL SECTION:
;; Query time: 0 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Thu Feb 06 13:40:35 COT 2014
;; MSG SIZE rcvd: 118
Prueba a un host remoto
# dig @192.168.1.1 google.com
; <<>> DiG 9.9.5 <<>> @192.168.1.1 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48596
;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 4, ADDITIONAL: 5
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 300 IN A 190.248.35.30
google.com. 300 IN A 190.248.35.45
google.com. 300 IN A 190.248.35.35
google.com. 300 IN A 190.248.35.34
google.com. 300 IN A 190.248.35.24
google.com. 300 IN A 190.248.35.49
google.com. 300 IN A 190.248.35.54
google.com. 300 IN A 190.248.35.40
google.com. 300 IN A 190.248.35.25
google.com. 300 IN A 190.248.35.50
google.com. 300 IN A 190.248.35.59
google.com. 300 IN A 190.248.35.20
google.com. 300 IN A 190.248.35.55
google.com. 300 IN A 190.248.35.44
google.com. 300 IN A 190.248.35.39
google.com. 300 IN A 190.248.35.29
;; AUTHORITY SECTION:
google.com. 172742 IN NS ns4.google.com.
google.com. 172742 IN NS ns1.google.com.
google.com. 172742 IN NS ns3.google.com.
google.com. 172742 IN NS ns2.google.com.
;; ADDITIONAL SECTION:
ns1.google.com. 172742 IN A 216.239.32.10
ns2.google.com. 172742 IN A 216.239.34.10
ns3.google.com. 172742 IN A 216.239.36.10
ns4.google.com. 172742 IN A 216.239.38.10
;; Query time: 59 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Thu Feb 06 13:34:11 COT 2014
;; MSG SIZE rcvd: 431
---------------------------------------------------------------------------------------------------------
Para un bind (slave) que funcione como respaldo del primer bind (master)...
Todo se hace de forma muy similar, pero hay algunos cambios
En named.conf (slave), las zonas al final del archivo quedan asi (vea que en lugar de la carpeta master, quedan en slave) y con la linea masters se especifica la IP del primer bind (master)
...
zone "example.com" {
type slave;
file "/usr/local/etc/namedb/slave/example.com";
masters { 192.168.1.1; };
};
zone "1.168.192.in-addr.arpa" {
type slave;
file "/usr/local/etc/namedb/slave/1.168.192.in-addr.arpa";
masters { 192.168.1.1; };
};
Los archivos "zona" y "zona inversa" no hay que crearlos ya que se importan automaticamente del primer bind (master).
Luego de iniciar bind (slave), los archivos seran transferidos desde el primer bind (master) como por arte de magia
# ls /usr/local/etc/namedb/slave
1.168.192.in-addr.arpa
example.com
---------------------------------------------------------------------------------------------------------
KDE
Instalar el escritorio KDE4.
Requerimientos:
* FreeBSD instalado
* The X Window System instalado
* Conexion a Internet
* Leer este tutorial
El proceso:
Actualizar el arbol de ports
# portsnap update
Agregar los parametros recomendados en /etc/make.conf
# edit /etc/make.conf
Agregamos las siguientes lineas
# FreeBSD versions earlier than 10.X require this line
# http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html
#
WITH_PKGNG=yes
Instalar el meta-port kde4
# cd /usr/ports/x11/kde4
# make config-recursive
kde 4.10.5_1
[ ] KDEACCESSIBILITY Accessibility applications
[ ] KDEADMIN Administration utilities
[ ] KDEARTWORK Additional screensavers and wallpapers
[ ] KDEBINDINGS Bindings for programming languages
[ ] KDEEDU Entertaining, educational programs
[ ] KDEGAMES Collection of games
[ ] KDEGRAPHICS Graphics utilities
[ ] KDEMULTIMEDIA Multimedia applications
[ ] KDENETWORK Network-related programs
[ ] KDEPLASMA Extra plasmoids and plugins for Plasma
[ ] KDESDK Software development kit
[ ] KDETOYS Miscellaneous small applications
[ ] KDEUTILS Set of generic utilities
[ ] KDEWEBDEV Web development environment
───────────────── PIM ─────────────────
( ) KDEPIM Personal information management
( ) KDEPIM44 KDE-Pim 4.4 (legacy version)
Yo desactivo todo ya que solo quiero KDE4 sin adicionales (EDU, GAMES, etc.), pero se pueden instalar si los desea dejando todo por defecto.
Los ports "KDEACCESSIBILITY", "KDEADMIN", etc., los puedo dejar por defecto ya que en el meta-port kde4 los desactive y no se instalaran (si se desea instalar EDU, GAMES, etc., tambien se dejan por defecto).
Los demas ports necesarios para kde4 tambien se dejan las opciones por defecto.
Nota:
Si tengo problemas con los cambios al meta-port kde4, puedo borrar los ajustes que hice para dejarlo como estaba por defecto e iniciar los ajustes nuevamente con el comando # rm -rf /var/db/ports/*
# make install clean
KDE requiere montar /proc para hacerlo editamos /etc/fstab
# edit /etc/fstab
Agregamos las siguientes lineas
# KDE requires the /proc mounted
proc /proc procfs rw 0 0
Montamos manualmente para no tener que reiniciar
# mount -a
Crear el archivo que iniciara kde4 en el home del usuario, que en nuestro ejemplo se llama John Doe y su home es john
# echo '# KDE' > /home/john/.xinitrc
# echo 'exec /usr/local/bin/startkde' >> /home/john/.xinitrc
# echo 'setxkbmap -option "terminate:ctrl_alt_bksp"' >> /home/john/.xinitrc
# echo '# UTF-8' >> /home/john/.xinitrc
# echo 'export LC_ALL=en_US.UTF-8' >> /home/john/.xinitrc
# echo 'export LANGUAGE=en_US.UTF-8' >> /home/john/.xinitrc
# echo 'export LANG=en_US.UTF-8' >> /home/john/.xinitrc
Para iniciar kde4 desde el usuario John Doe, usamos
$ startx
The X Window System
Instalar The X Window System en FreeBSD.
Requerimientos:
* FreeBSD instalado
* Conexion a Internet
* Leer este tutorial
El proceso:
Actualizar el arbol de ports
# portsnap update
Agregar los parametros recomendados en /etc/make.conf
# edit /etc/make.conf
Agregamos las siguientes lineas
# Installing KMS Ports
# https://wiki.freebsd.org/Graphics#Ports
#
WITH_NEW_XORG=yes
WITH_GALLIUM=yes # Needed for Radeon cards, but doesn't harm with Intel devices.
#
# FreeBSD versions earlier than 10.X require this line
# http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html
#
WITH_PKGNG=yes
Instalar el port xorg
# cd /usr/ports/x11/xorg
# make config-recursive
xorg-apps 7.7
(dejo todo como esta por defecto)
xorg-drivers 7.7
[X] MOUSE Install mouse input driver
[X] KEYBOARD Install keyboard input driver
desactivo todo y solo dejo estos tres activados
python27-2.7.6_1 (todo por defecto)
libdrm-2.4.17_1 (todo por defecto)
xterm-300 (todo por defecto)
pixman-0.30.2 (tod por defecto)
xf86-video-radeonhd-1.3.0_5 (tod por defecto)
libxml2-2.8.0_3 (todo por defecto)
m4-1.4.17,1 (todo por defecto)
perl5-5.16.3_4 (todo por defecto)
png-1.5.17 (todo por defecto)
freetype2-2.5.0.1 (todo por defecto)
dejavu-2.34 (todo por defecto)
xorg-server-1.7.7_11,1 (todo por defecto)
libcheck-0.9.11 (todo por defecto)
libxslt-1.1.28_1 (todo por defecto)
hal-0.5.14_22 (todo por defecto)
xkeyboard-config-2.9_1 (todo por defecto)
policykit-0.9_6 (todo por defecto)
docbook-xsl-1.76.1_1 (todo por defecto)
glib-2.36.3_1 (todo por defecto)
pcre-8.33 (todo por defecto)
polkit-0.105_1 (todo por defecto)
unzip-6.0_1 (todo por defecto)
xmlcatmgr-2.2 (todo por defecto)
docbook-1.4_1 (todo por defecto)
dbus-1.6.12 (todo por defecto)
libffi-3.0.13 (todo por defecto)
docbook-5.0_1 (todo por defecto)
cairo-1.10.2_6,2 (todo por defecto)
# make install clean
Agregar estas lineas para cargar al inicio
# echo '# X11 Configuration' >> /etc/rc.conf
# echo 'hald_enable="YES"' >> /etc/rc.conf
# echo 'dbus_enable="YES"' >> /etc/rc.conf
Iniciarlo complementos (start|stop|restart)
# /usr/local/etc/rc.d/dbus start
# /usr/local/etc/rc.d/hald start
Crear el archivo xorg.conf.new basico
# rehash
# Xorg -configure
Editar el archivo con los parametros para el monitor
# edit /root/xorg.conf.new
En mi caso tengo este monitor
http://support.dell.com/support/edocs/systems/1907FP/en/about.htm#Specifications
En la seccion "Monitor" le agregamos HorizSync, VertRefresh y Option "DPMS"
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
HorizSync 30-81
VertRefresh 56-76
Option "DPMS"
EndSection
En la seccion "Screen" solo dejamos Depth 24 y Modes "1280x1024"
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1280x1024"
EndSubSection
EndSection
Probamos nuestro archivo para ver si funciona bien
# Xorg -config /root/xorg.conf.new -retro
Esto inicia las X, para pararlo
Ctrl+Alt+F1 y usamos Ctrl+C
Nota:
En mi caso con una tarjeta Nvidia, no carga las X, pero luego con el driver de nvidia todo funciona bien.
Copiar el archivo al lugar correcto con el nombre final
# cp /root/xorg.conf.new /etc/X11/xorg.conf
Instalar el driver de Nvidia
# cd /usr/ports/x11/nvidia-driver
# make config-recursive
nvidia-driver-319.32
[ ] ACPI_PM ACPI_PM Power Management support
[X] DOCS Build and/or install documentation
[ ] LINUX Linux compatibility support
[ ] WBINVD Flush CPU caches directly with WBINVD
<OK>
# make install clean
Cargar manualmente el modulo
# kldload nvidia
Agregar estas lineas para cargar al inicio
# echo '# NVIDIA Driver' >> /boot/loader.conf
# echo 'nvidia_load="YES"' >> /boot/loader.conf
Editar el archivo para usar el driver nvidia en lugar de nv
# edit /etc/X11/xorg.conf
cambiar la linea original
Driver "nv"
por
Driver "nvidia"
Instalar el port mesa-demos para poder usar glxgears y glxinfo
# cd /usr/ports/graphics/mesa-demos
# make install clean
Otros ports relacionados con NVIDIA
x11/nvidia-settings
x11/nvidia-xconfig
2014/01/23
FreeBSD 10.0
Instalar FreeBSD 10.0-RELEASE AMD64
Requerimientos:
* Conexion a Internet
* Disco de instalacion de FreeBSD
* Leer este tutorial
Tutoriales:
Iniciar el equipo con el disco de FreeBSD
FreeBSD Installer
Welcome
Welcome to FreeBSD! Would you
like to begin an installation
or use the live CD?
<Install>
FreeBSD Installer
--------------------------------------------------------------------------------------------------------------------
Keymap Selection
The system console driver for FreeBSD defaults to standard "US"
keyboard map. Other keymaps can be chosen below.
>>> Continue wiht default keymap <- Cuando mi teclado es en English
O me desplazo para abajo hasta el idioma correcto
( ) Latin American
( ) Spanish ISO-8859-1
Luego de estar en el idioma correcto (Latin American o Spanish ISO-8859-1)
<Select>
>>> Continue wiht spanish.kbd/latinamerican.kbd keymap
<Select>
Set Hostname
Please choose a hostname for this machine.
If you are running on managed network, please
ask your network administrator for an appropriate
name.
freebsd.example.com
<OK>
Distribution Select
Choose optional system components to
install:
[ * ] doc Additional documentation
[ ] games Games (fortune, etc.)
[ ] lib32 32-bit compatibility libraries
[ * ] ports Ports tree
[ * ] src System source code
<OK>
Partitioning
How would you like topartition your disk?
<Manuall>
<OK>
Partition Editor
Create partitions for FreeBSD. No changes will be
made until you select Finish.
ada0 298 GB (none)
GPT GUID Partition Table
<OK>
<OK>
<Create>
Type: freebsd-boot
Size: 512K
Mountpoint:
Label:
<OK>
<Create>
Type: freebsd-ufs
Size: 16GB
Mountpoint: /
Label: exrootfs
<OK>
<Create>
Type: freebsd-swap
Size: 32GB
Mountpoint:
Label: exswap
<OK>
<Create>
Type: freebsd-ufs
Size: 64GB
Mountpoint: /var
Label: exvarfs
<OK>
<Create>
Type: freebsd-ufs
Size: 16GB
Mountpoint: /tmp
Label: extmpfs
<OK>
<Create>
Type: freebsd-ufs
Size: XXGB <- lo que quede disponible
Mountpoint: /usr
Label: exusrfs
<OK>
ada0 298 GB GPT
ada0p1 512 kb freebsd-boot
ada0p2 16.0 GB freebsd-ufs /
ada0p3 32.0 GB freebsd-swap none
ada0p4 64.0 GB freebsd-ufs /var
ada0p5 16.0 GB freebsd-ufs /tmp
ada0p6 XX.0 GB freebsd-ufs /usr
<Finish>
Confirmation
Your changes will now written to disk. If you
have chosen to overwrite existing data, it will
be PERMANENTLY ERASED. Are you sure you want to
commit your changes?
<Commit>
(inicia particionado e instalacion)
FreeBSD Installer
--------------------------------------------------------------------------------------------------------------------
Please select a password for the system management account (root):
Changing local password for root
New Password: ********
Retype New Password: ********
Network Configuration
Please select a network interface to configure:
em0 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
em1 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
em2 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
em3 Intel(R) PRO/1000 Legacy Network Connection 1.0.3
<OK>
Network Configuration
Would you like to
configure IPv4 for this
interface?
<Yes>
Network Configuration
Would you like to use
DHCP to configure this
interface?
<No>
Network Configuration
Static Network Interface Configuration
IP Address 192.168.0.2
Subnet Mask 255.255.255.0
Default Router 192.168.0.1
<OK>
Network Configuration
Would you like to
configure IPv6 for this
interface?
<Yes>
Network Configuration
Would you like to try
stateless address
autoconfiguration
(SLAAC)?
<Yes>
Network Configuration
Resolver Configuration
Search example.com
IPv6 DNS #1 2001:4860:4860::8888
IPv6 DNS #2 2001:4860:4860::8844
IPv4 DNS #1 8.8.8.8
IPv4 DNS #2 8.8.4.4
<OK>
Nota:
En nuestro caso estamos usando los DNS publicos de Google (IPv4 8.8.8.8 8.8.4.4 IPv6 2001:4860:4860::8888 2001:4860:4860::8844), mas informacion aqui https://developers.google.com/speed/public-dns/
Select local or UTC (Greenwich Mean Time) clock
Is this machine´s CMOS clock set to UTC? If it is set to local time,
or you don´t know, please choose NO here!
<No>
Time Zone Selector
Select a region
2 America -- North and South
Countries in America -- North and South
14 Colombia
<OK>
Does the abbreviation `COT´ look reasonable?
<Yes>
System Configuration
Choose the services you would like to be started at boot:
[*] sshd Secure shell daemon
[ ] moused PS/2 mouse pointer on console
[ ] ntpd Synchronize system and network time
[ ] powerd Adjust CPU frequency dynamically
[*] dumpdev Enable kernel crash dumps to /var/crash
<OK>
Add User Accounts
Would you like to add
users to the installed
system now?
<Yes>
FreeBSD Installer
==================
Add Users
Username: john
Full name: John Doe
Uid (Leave empty for default):
Login group [john]:
Login group is john. Invite john into other groups? []:
Shell (sh csh tcsh nologin) [sh]:
Home directory [/home/john]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a randon password? (yes/no) [no]:
Enter password: ********
Enter password again: ********
Lock out the account after creation? [no]:
Username : john
Password : ********
Full Name : John Doe
Uid : 1001
Class :
Groups : john
Home : /home/john
Home Mode :
Shell : /bin/sh
Locked : no
OK? (yes/no) : yes
adduser: INFO : Successfully added (john) to the user database.
Add another user? (yes/no): no
Goodbye!
Final Configuration
Setup of your FreeBSD system is nearly complete. You can now
modify your configuration choices. After this screen, you will
have an opportunity to make more complex changes using a shell
Exit Apply configuration and exit installer
<OK>
Manual Configuration
The installation is now finished.
Before exiting the installer, would
you like to open a shell in the new
system to make any final manual
modification?
<No>
Complete
Installation of FreeBSD
complete! Would you like
to reboot into the
installed system now?
<Reboot>
(retirar el CD/DVD/USB en el reinicio para iniciar desde el disco duro)
Aplicar los ultimos parches
# freebsd-update fetch
# freebsd-update install
Actualizar el arbol de ports
# portsnap fetch extract
# portsnap fetch update
Finalmente reiniciamos
# reboot
Eso es todo, al iniciar tenemos nuestro FreeBSD funcionando!
Es buen momento para hacer que FreeBSD este con archivos actualizados, para esto agregamos en /etc/crontab las lineas asi:
# echo '# Actualizaciones para FreeBSD' >> /etc/crontab
# echo '00 06 * * * root /usr/sbin/freebsd-update cron' >> /etc/crontab
# echo '# Actualizaciones arbol de ports' >> /etc/crontab
# echo '00 06 * * * root /usr/sbin/portsnap -I cron update' >> /etc/crontab
Para sincronizar manualmente nuestro arbol de ports
# portsnap update
Activamos el auto chequeo de los discos en caso que no se apague bien o por algun bloqueo
# echo '# Verificar con FSCK' >> /etc/rc.conf
# echo 'fsck_y_enable="YES"' >> /etc/rc.conf
# echo 'background_fsck="NO"' >> /etc/rc.conf
# echo '#background_fsck_delay="60"' >> /etc/rc.conf
Si luego queremos ajustar parametros de la instalacion:
# edit /etc/rc.conf
hostname="freebsd.example.com"
ifconfig_em0=" inet 192.168.0.2 netmask 255.255.255.0"
defaultrouter="192.168.0.1"
ifconfig_em0_ipv6="inet6 accept_rtadv"
ssh_ennable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
# Ajustar el idioma del teclado (solo activar una, si ninguna esta activa queda en English)
#keymap="spanish.iso.kbd"
keymap="latinamerican.kbd"
# edit /etc/resolv.conf
search example.com
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
nameserver 8.8.8.8
nameserver 8.8.4.4
# edit /etc/hosts
::1 localhost localhost.my.domain
127.0.0.1 localhost localhost.my.domain
Para apagar nuestro FreeBSD instalado, usamos el comando:
# shutdown -h now
(con las nuevas boards puede apretar el boton de power e inicia el apagado)
Para reiniciarlo
# shutdown -r now
Parametros recomendados para /etc/make.conf
# edit /etc/make.conf
Agregamos las siguientes lineas
# CUPS-Related Ports
# https://wiki.freebsd.org/Ports/Options/OptionsNG#What_users_need_to_know
# http://lists.freebsd.org/pipermail/freebsd-ports/2013-June/084148.html
#
OPTIONS_SET=CUPS
#
# Qt 4 can be built with optional supporin for:
# - Common UNIX Printing System (CUPS)
# - Network Audio System (NAS)
# - Qt style that renders using GTK (QGTKSTYLE)
#
QT4_OPTIONS= CUPS NAS QGTKSTYLE
#
# Installing KMS Ports
# https://wiki.freebsd.org/Graphics#Ports
#
WITH_NEW_XORG=yes
#
# FreeBSD versions earlier than 10.X require this line
# http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/pkgng-intro.html
#
WITH_PKGNG=yes
#
# Depurar errores en los ports
#
#CMAKE_VERBOSE=yes
#MAKE_JOBS_UNSAFE=yes
Instalar nuestro primer port llamado portmaster (en FreeBSD 10.0 ya viene instalado, pero lo dejare de ejemplo)
# cd /usr/ports/ports-mgmt/portmaster
# make install clean
Limpiar los fuentes descargados en /usr/ports/distfiles de ports que ya no tenemos instalados
# portmaster -y --clean-distfiles
Otros comandos utiles
# make -C /usr/ports/ports-mgmt/portmaster config
# cd /usr/ports/ports-mgmt/portmaster && make showconfig
Si queremos eliminar todos los ports instalados
# rm -rf /usr/local/* /var/db/pkg /compat/linux
Si queremos eliminar todos los cambios que hicimos en un port
# rm /var/db/ports/nombreport/options
Si queremos eliminar todos los cambios que hicimos en todos los ports
# rm -rf /var/db/ports/*
Quien es John Doe? http://en.wikipedia.org/wiki/John_Doe
Para hacer la instalacion en un RAID1 http://www.unix.ck.ua/content/sozdaem-programmnyi-raid1-freebsd-90
Nota:
FreeBSD envia automaticamente reportes de estado al usuario root y solo los vemos si iniciamos localmente con este usuario, pero podemos hacer que estos reportes sean enviados a una cuenta en otro lugar, por ejemplo a nuestra cuenta en Gmail, para hacer esto debemos:
# edit /etc/mail/aliases
Buscamos una linea que dice
# root: me@my.domain
Y luego de esa creamos una nueva con nuestro mail
root: micorreo@gmail.com
Guardamos los cambios en el editor y ejecutamos el comando
# cd /etc/mail && make
Si root tiene un monton de correos, los podemos eliminar con
# cat /dev/null > /var/mail/root
FreeBSD nos permite conectar por SSH a nuestro servidor, pero por seguridad no se puede hacer con el usuario root, entonces primero nos conectamos con el usuario john y luego podemos usar el comando su para subir a root, pero para que john pueda subir, hay que darle permisos a este usuario, para esto
# edit /etc/group
y la linea original
wheel:*:0:root
la dejamos asi
wheel:*:0:root, john
Guardamos cambios y ya podemos conectarnos, ejemplo desde otro equipo con FreeBSD desde el terminal
$ ssh john@IPMISERVIDOR
Password: ******** <- la clave del usuario john
$
Para subir a root escribimos su
$ su
Password: ******** <- la clave del usuario root
freebsd #
En caso de tener un bloqueo en el equipo, podemos usar el siguiente comando:
# kgdb /boot/kernel/kernel.symbols /var/crash/vmcore.0
(kgdb) backtrace <- luego escribimos esto y damos enter
Activar UTF-8 "Alternately, the superuser" (si tenemos acceso a root)
Ver las localizaciones disponibles
$ locale -a | grep '\.UTF-8$'
# edit /etc/login.conf
Modificar esta seccion de modo que quede asi:
default:\
:passwd_format=sha512:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K,LC_COLLATE=C:\
:path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\
:nologin=/var/run/nologin:\
:cputime=unlimited:\
:datasize=unlimited:\
:stacksize=unlimited:\
:memorylocked=64K:\
:memoryuse=unlimited:\
:filesize=unlimited:\
:coredumpsize=unlimited:\
:openfiles=unlimited:\
:maxproc=unlimited:\
:sbsize=unlimited:\
:vmemoryuse=unlimited:\
:swapuse=unlimited:\
:pseudoterminals=unlimited:\
:priority=0:\
:ignoretime@:\
:umask=022:\
:charset=UTF-8:\
:lang=en_US.UTF-8:
Mire con atencion, las partes en rojo es lo que debemos agregar (,LC_COLLATE=C, \, :charset=UTF-8:\ y :lang=en_US.UTF-8:)
Aplicar los cambios
# cap_mkdb /etc/login.conf
Verificar, cerrar la sesion del usuario, entrar de nuevo y verificar con este comando
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=
Ajustar el volumen de salida de FreeBSD
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/sound-setup.html
$ mixer -s vol 100
Para dejarlo permanentemente al 100 a nivel de driver
# echo '# Setting Default Values for Mixer Channels' >> /boot/device.hints
# echo 'hint.pcm.0.vol="100"' >> /boot/device.hints
loader_logo="beastie"
En recientes versiones de FreeBSD, luego de la instalacion, podemos configurar parametros mediante el comando
# bsdconfig

