Projet

Général

Profil

SrvSTG » Historique » Version 2

Ludovic Pouzenc, 07/12/2014 14:18

1 1 Ludovic Pouzenc
h1. Serveur stg.tetaneutral.net
2 1 Ludovic Pouzenc
3 1 Ludovic Pouzenc
h2. Caractéristiques
4 1 Ludovic Pouzenc
5 2 Ludovic Pouzenc
* Gigabyte Brix (CPU Celeron)
6 2 Ludovic Pouzenc
* Samsung SSD 840 EVO 120GB
7 1 Ludovic Pouzenc
* Debian 7 amd64
8 1 Ludovic Pouzenc
9 1 Ludovic Pouzenc
h2. Traces Install
10 1 Ludovic Pouzenc
11 1 Ludovic Pouzenc
A partir d'une clé USB bootable Debian 7 amd64
12 1 Ludovic Pouzenc
13 2 Ludovic Pouzenc
h3. Options d'installation
14 1 Ludovic Pouzenc
15 2 Ludovic Pouzenc
* hostname initial : stg2 (changé en stg par la suite)
16 1 Ludovic Pouzenc
* partman : partition par defaut sur tout le disque sda
17 1 Ludovic Pouzenc
* grub : par défaut, sur sda
18 1 Ludovic Pouzenc
* tasksel : decocher interface graphique et cocher serveur ssh
19 1 Ludovic Pouzenc
* popcon : non
20 1 Ludovic Pouzenc
21 1 Ludovic Pouzenc
h3. Premières configs
22 2 Ludovic Pouzenc
23 1 Ludovic Pouzenc
<pre>
24 2 Ludovic Pouzenc
# Dépendances requises
25 2 Ludovic Pouzenc
apt-get install sudo vlan conntrack ntp fail2ban
26 2 Ludovic Pouzenc
# Utilitaires
27 2 Ludovic Pouzenc
apt-get install rsync vim emacs23-nox iftop htop screen ntpdate powertop molly-guard sysstat strace tcpdump
28 2 Ludovic Pouzenc
29 2 Ludovic Pouzenc
update-alternatives --config editor
30 2 Ludovic Pouzenc
#-> choisir vim.basic
31 2 Ludovic Pouzenc
32 2 Ludovic Pouzenc
# Création de tous les users
33 2 Ludovic Pouzenc
adduser nicolas sudo
34 2 Ludovic Pouzenc
adduser ludovic
35 2 Ludovic Pouzenc
adduser ludovic sudo
36 2 Ludovic Pouzenc
# [...]
37 2 Ludovic Pouzenc
</pre>
38 2 Ludovic Pouzenc
39 2 Ludovic Pouzenc
* Modification du /root/.bashrc pour dé-commenter les alias et les couleurs
40 2 Ludovic Pouzenc
41 2 Ludovic Pouzenc
h3. Modification du partitionnement
42 2 Ludovic Pouzenc
43 2 Ludovic Pouzenc
* Une meilleure option était de faire directement le bon paramétrage avec l'assistant partman de l'installeur Debian
44 2 Ludovic Pouzenc
<pre>
45 2 Ludovic Pouzenc
root@stg2:~# smartctl -a /dev/sda
46 2 Ludovic Pouzenc
Device Model:     Samsung SSD 840 EVO 120GB
47 2 Ludovic Pouzenc
[...]
48 2 Ludovic Pouzenc
49 2 Ludovic Pouzenc
root@stg2:~# fdisk -l /dev/sda
50 2 Ludovic Pouzenc
51 2 Ludovic Pouzenc
Disque /dev/sda : 120.0 Go, 120034123776 octets
52 2 Ludovic Pouzenc
255 têtes, 63 secteurs/piste, 14593 cylindres, total 234441648 secteurs
53 2 Ludovic Pouzenc
Unités = secteurs de 1 * 512 = 512 octets
54 2 Ludovic Pouzenc
Taille de secteur (logique / physique) : 512 octets / 512 octets
55 2 Ludovic Pouzenc
taille d'E/S (minimale / optimale) : 512 octets / 512 octets
56 2 Ludovic Pouzenc
Identifiant de disque : 0x000b8647
57 2 Ludovic Pouzenc
58 2 Ludovic Pouzenc
Périphérique Amorce  Début        Fin      Blocs     Id  Système
59 2 Ludovic Pouzenc
/dev/sda1   *        2048    19531775     9764864   83  Linux
60 2 Ludovic Pouzenc
/dev/sda2        19533822   234440703   107453441    5  Étendue
61 2 Ludovic Pouzenc
/dev/sda5        19533824    28186623     4326400   82  partition d'échange Linux / Solaris
62 2 Ludovic Pouzenc
/dev/sda6        28188672   234440703   103126016   83  Linux
63 2 Ludovic Pouzenc
</pre>
64 2 Ludovic Pouzenc
65 2 Ludovic Pouzenc
* Sauver le contenu de /home
66 2 Ludovic Pouzenc
* Démonter /home (ne pas avoir son shell dedans...)
67 2 Ludovic Pouzenc
* Restaurer le contenu de /hoem dans /home (donc dans la partition racine)
68 2 Ludovic Pouzenc
* Détruire la partition correspondante. Idem pour le swap.
69 2 Ludovic Pouzenc
* Créer une partition primaire de la taille de l'espace restant pour /var
70 2 Ludovic Pouzenc
<pre>
71 2 Ludovic Pouzenc
root@stg2:~# fdisk -l /dev/sda
72 2 Ludovic Pouzenc
73 2 Ludovic Pouzenc
Disque /dev/sda : 120.0 Go, 120034123776 octets
74 2 Ludovic Pouzenc
255 têtes, 63 secteurs/piste, 14593 cylindres, total 234441648 secteurs
75 2 Ludovic Pouzenc
Unités = secteurs de 1 * 512 = 512 octets
76 2 Ludovic Pouzenc
Taille de secteur (logique / physique) : 512 octets / 512 octets
77 2 Ludovic Pouzenc
taille d'E/S (minimale / optimale) : 512 octets / 512 octets
78 2 Ludovic Pouzenc
Identifiant de disque : 0x000b8647
79 2 Ludovic Pouzenc
80 2 Ludovic Pouzenc
Périphérique Amorce  Début        Fin      Blocs     Id  Système
81 2 Ludovic Pouzenc
/dev/sda1   *        2048    19531775     9764864   83  Linux
82 2 Ludovic Pouzenc
/dev/sda2        19531776   234441647   107454936   83  Linux
83 2 Ludovic Pouzenc
</pre>
84 2 Ludovic Pouzenc
85 2 Ludovic Pouzenc
* Virer /home et swap dans le fstab
86 2 Ludovic Pouzenc
* Rebooter (pour prise en compte des partitions)
87 2 Ludovic Pouzenc
* Formatter /dev/sda2 en ext4
88 2 Ludovic Pouzenc
* Copier /var dedans
89 2 Ludovic Pouzenc
* Mettre à jour le fstab (sda2 -> var)
90 2 Ludovic Pouzenc
* Reboot
91 2 Ludovic Pouzenc
92 2 Ludovic Pouzenc
h3. Tuning SSD
93 2 Ludovic Pouzenc
94 2 Ludovic Pouzenc
* Options de montage ext4 dans fstab : errors=remount-ro,noatime,discard,commit=300
95 2 Ludovic Pouzenc
* Scheduler deadline de manière persistante
96 2 Ludovic Pouzenc
(confère le fichier /etc/udev/rules.d/60-ssd-scheduler.rules)
97 2 Ludovic Pouzenc
* Swapiness minimal (le OOM killer sera + sensible mais pas d'IO dans tous les sens)
98 2 Ludovic Pouzenc
(confère le fichier /etc/sysctl.d/ssd.conf)
99 2 Ludovic Pouzenc
100 2 Ludovic Pouzenc
h3. Autres paramètres kernel
101 2 Ludovic Pouzenc
102 2 Ludovic Pouzenc
* Éviter de logguer les messages "UDP bad checksum..." pendant les flood UDP
103 2 Ludovic Pouzenc
* Désactiver les ICMP source route
104 2 Ludovic Pouzenc
* Activer l'IP forward au boot (si des choses partent en vrac après le démarrage... on a au moins déjà ça d'actif)
105 2 Ludovic Pouzenc
(confère le fichier /etc/sysctl.d/router.conf)
106 2 Ludovic Pouzenc
(Laurent Guerby recommande plutôt de rassembler tout ce qui est réseau dans /root/tetaneutral.sh)
107 2 Ludovic Pouzenc
108 2 Ludovic Pouzenc
h3. Config réseau
109 2 Ludovic Pouzenc
110 2 Ludovic Pouzenc
* Le NUC n'a qu'une interface réseau, donc tout part sur la base de VLANs
111 2 Ludovic Pouzenc
(confère /etc/network/interfaces)
112 2 Ludovic Pouzenc
* Changer le /etc/hostname : stg
113 2 Ludovic Pouzenc
* Utiliser /etc/debian_chroot pour éviter les confusions des machines
114 2 Ludovic Pouzenc
* Mettre l'IP publique dans /etc/hosts (car sinon résolution de stg pourrie chez les adhérents)
115 2 Ludovic Pouzenc
<pre>
116 2 Ludovic Pouzenc
91.224.148.7    stg.tetaneutral.net     stg
117 2 Ludovic Pouzenc
</pre>
118 2 Ludovic Pouzenc
<pre>
119 2 Ludovic Pouzenc
(NUC)root@stg2:~# cp /etc/hosts /etc/hosts_system
120 2 Ludovic Pouzenc
* Vérifier que le FQDN fonctionne
121 2 Ludovic Pouzenc
(NUC)root@stg2:~# hostname
122 2 Ludovic Pouzenc
stg
123 2 Ludovic Pouzenc
(NUC)root@stg:~# hostname --fqdn
124 2 Ludovic Pouzenc
stg.tetaneutral.net
125 1 Ludovic Pouzenc
</pre>