2016/04/26

FreeBSD 10.3 RELEASE AMD64

Introduccion:

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