Revisión de Instalando Trisquel en un Servidor de Mar, 12/14/2010 - 07:56

La revisión le permite rastrear las diferencias que hay entre distintas versiones de una entrada.

The howto below is mostly outdated with the new netinstall method. The current recommended method is just using the text mode installer included in the LTS editions, and selecting the linux-image-server kernel image.

The 2.x robur LTS version of Trisquel is a very good choice for a server: it has a 64 bit version -needed for 4GB+ RAM, and recommended for virtualization-, a server-optimized linux-libre kernel, and a Xen linux-libre kernel as well.

We are working in a netinst image, wich will allow you to install a server using a small and handy iso image with a full featured installer which downloads the needed packages from the desired Trisquel mirror. In the meantime, you can use this howto to manually install a clean server environment.

You will need...

  • A Trisquel 2.x CD. Any of them should should do, we recommend you to use a i386 image to build a 32 bit server and a amd64 to build a 64 bit one.
  • A server with compatible hardware. You can use almost any x86/x86_64 server, but take care not to buy parts with no free drivers, as they will not work.
  • Some skills about managing a Debian based server. If you are a newbie, install the edu edition with the included installer and use it as a server -with the desktop environment-.

Starting

Start a Live CD session in your server -we recommend to start in in English-. Open a terminal. All the commands listed below will be run in that terminal.

Partition and format your disk

You can partition a disk in a lot of ways and using different hardware configurations. For the purposes of this howto, we will assume that you are installing Trisquel in a single and empty SATA/SCSI disk with no RAID.

NOTE: We will refer to the disk as /dev/sda

Start the partition manager cfdisk. If you like to start with an empty layout, use this command:

sudo cfdisk -z
You can partition your disk using the layout of your choice, but we recommend this one:
DEVICE     MOUNTPOINT   FILESYSTEM    SIZE
/dev/sda1  /            ext3          5GB
/dev/sda2  swap         swap          1.5 times the memory size
/dev/sda3  /tmp         XFS           1GB
/dev/sda4  /home        XFS           the rest of the disk
Notes:
  • The swap is optional, it will be needed if you want to have suspend-to-disk support.
  • Never use XFS for the partition containing /boot
  • Having /tmp in a partition will keep the server from crashing by fullness.

So, use cfdisk to break the disk into that pieces, and save. Now to format the partitions, use this commands:

sudo mkswap /dev/sda2
sudo mkfs.ext3 /dev/sda1
sudo mkfs.xfs /dev/sda3
sudo mkfs.xfs /dev/sda4
This is just a example layout, you can use the one that fits your needs.

Mount the disk

Create a mountpoint:
sudo mkdir /target
Now mount the root (/) partition into /target
sudo mount /dev/sda1 /target

Install the base system

You will use debootstrap to download and install a trisquel base environment. You will need to update the Live CD apt lists and install it first:

sudo aptitude update
sudo aptitude install debootstrap
Some usefull parameters that you can give to debootstrap are the arch (it will use the same as the Live CD if you don't give it one), and the mirror (it defaults to archive.trisquel.info, located in Spain):
sudo debootstrap --arch=amd64 trisquel /target http://mirror
# or just:
sudo debootstrap trisquel /target

Configurar el sistema base

Usted tendrá que configurar su instalación, y el primer paso es llenar el archivo /target/etc/apt/sources.list. Usted puede copiar el archivo desde el CD Live CD o utilizar este contenido:

# Trisquel repositories for supported software and updates
deb http://archive.trisquel.info/trisquel robur main extras
deb-src http://archive.trisquel.info/trisquel robur main extras
deb http://archive.trisquel.info/trisquel robur-updates main extras
deb-src http://archive.trisquel.info/trisquel robur-updates main extras
deb http://archive.trisquel.info/trisquel robur-security main extras
deb-src http://archive.trisquel.info/trisquel robur-security main extras
El repositorio backports no está recomendado en un servidor. Puede reemplazar archive.trisquel.info con el espejo de su elección.

Usted debe configurar el servidor de red, editando el archivo /target/etc/network/interfaces :

gedit /target/etc/network/interfaces
Ahora entrar en el chroot:
sudo chroot /target
Ahora debería ser capaz de actualizar sus listas de apt e instalar paquetes. Esta es una lista de comandos recomendada para ejecutar:
# set the server hostname and hosts file
echo boxname > /etc/hostname
echo "127.0.0.1 localhost" > /etc/hosts
echo "127.0.0.1 boxname" > /etc/hosts

# set the root password
passwd

# mount /proc
mout none /proc -t proc

# configure the keyboard and timezone
dpkg-reconfigure console-setup
dpkg-reconfigure tzdata

# update the apt lists
aptitude update

# install the trisquel-base package
aptitude install trisquel-base

# install a linux-libre kernel image and boot loader package
aptitude install linux-image-server grub

# copy the grub files to /boot and run the grub config updater
cp /usr/lib/grub/* /boot/grub -a
update-grub

# If you prefer to have bash instead of dash as default shell, run this:
dpkg-reconfigure dash

# umount /proc
umount /proc

# exit the chroot
exit

Instale el gestor de arranque

sudo grub-install --no-floppy --root-directory=/mnt/target /dev/sda

Editando el fstab

Tienes que editar el archivo /target/etc/fstab de acuerdo con el diseño del disco que tiene. Este es el archivo fstab que coincide con nuestra selección de propuestas:

#<file system> <mount point>   0    1       2  3
 proc          /proc           proc      defaults        0       0
 /dev/sda2     swap            sw        defaults        0       0
 /dev/sda1     /               ext3      relatime        0       1
 /dev/sda3     /tmp            xfs       relatime        0       2
 /dev/sda4     /home           xfs       relatime        0       2
Ahora puede reiniciar el sistema y acceder a su nuevo servidor Trisquel!

¿Qué hacer ahora?

Su nuevo servidor es una shell vacía. Usted tendrá que instalar lo que necesite en su caja. Aquí tienes algunas sugerencias:

Instalar un entorno Xen

Esto es fácil, sólo tiene que añadir un paquete:

aptitude install trisquel-server-xen

Construir un servidor GLAMP

Para servidor de páginas web, el servidor web más común es apache. Si no necesitas php o una base de datos, sólo tienes que escribir esto:

aptitude install apache2
Para obtener un completo servidor GLAMP (GNU/Linux Apache MySQL PHP), utilice lo siguiente:
aptitude install apache2 mysql-server phpmyadmin
Que instala todas las dependencias necesarias, y también le permitirá gestionar su base de datos por accesos en http://localhost/phpmyadmin

Revisiones

12/14/2010 - 07:29
ovruni
01/21/2011 - 14:24
anonymous