Installing Trisquel on a Server
The how-to 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, which 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 how-to 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 -zYou 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 diskNotes:
- 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/sda4This is just a example layout, you can use the one that fits your needs.
Mount the disk
Create a mountpoint:sudo mkdir /targetNow 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 debootstrapSome 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
Configure the base system
You will need to configure your installation, and the first step is to fill the /target/etc/apt/sources.list file. You can just copy the file from the Live CD or use this contents:
# 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 extrasThe backports repo is not recommended in a server. You can replace archive.trisquel.info with the mirror of your choice.
You must now setup the server network, by editing the /target/etc/network/interfaces file:
gedit /target/etc/network/interfacesNow enter into the chroot:
sudo chroot /targetYou should now be able to update your apt lists and install packages. This is a list of recommended commands to run:
# 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 mount 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
Install the boot loader
sudo grub-install --no-floppy --root-directory=/mnt/target /dev/sda
Edit the fstab
You need to edit the /target/etc/fstab file according to the disk layout you made. This is the fstab file that matches our suggested selections:
#<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 2You can now reboot and login into your new Trisquel server!
What to do next?
Your new server is an empty shell. You will need to install whatever you need in your box. Here you have some suggestions:Install a Xen environment
This is an easy one, you just need to add a package:aptitude install trisquel-server-xen
Build a GLAMP server
To serve web pages, the most common web server is apache. If you don't need php or a database, just type this:
aptitude install apache2To get a complete GLAMP (GNU/Linux Apache MySQL PHP) server, use this:
aptitude install apache2 mysql-server phpmyadmin php5 php5-mysqlThat will install all the needed dependencies, and will also allow you to manage your database by login into http://localhost/phpmyadmin