Si tu donnes un poisson à un homme, il mangera un jour... Si tu lui apprends à pêcher, il mangera toujours !
Affichage des articles dont le libellé est debian. Afficher tous les articles
Affichage des articles dont le libellé est debian. Afficher tous les articles
jeudi 15 septembre 2022
lundi 17 juillet 2017
LAMP Jessie / Letsencrypt
echo 'deb http://http.debian.net/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-backports.list
apt-get update
apt-get install python-certbot-apache -t jessie-backports
certbot --apache
# A la mano
certbot --apache
certonly
# Renew (90j)
certbot renew --dry-run
certbot renew
apt-get update
apt-get install python-certbot-apache -t jessie-backports
certbot --apache
# A la mano
certbot --apache
certonly
# Renew (90j)
certbot renew --dry-run
certbot renew
mardi 21 avril 2015
NAS sous Debian
# Install Raspi/NAS
# Source : http://benoit.vianin.com/249-un-nas-avec-un-raspberry-pi
# MAJ
apt-get update
apt-get upgrade
apt-get install openssh-server
# Install Samba V3
apt-get install samba samba-common-bin
[global]
security=user
guest ok=no
encrypt passwords=true
[maison]
path=/srv/maison
force create mode=0770
force directory mode=0770
write list=@maison
mkdir /srv/maison
addgroup maison
chown root.maison /srv/maison
chmod 770 /srv/maison
/etc/init.d/smb restart
adduser --disabled-login --no-create-home --ingroup maison utilisateur1
smbpasswd -a utilisateur1
Connexion a un partage depuis un client Windows :
net use h: \\192.168.1.75\maison
# Install Smartmontools (monitoring SMART des disques USB)
voir --> http://www.smartmontools.org/wiki/USB
# Source : http://benoit.vianin.com/249-un-nas-avec-un-raspberry-pi
# MAJ
apt-get update
apt-get upgrade
apt-get install openssh-server
# Install Samba V3
apt-get install samba samba-common-bin
[global]
security=user
guest ok=no
encrypt passwords=true
[maison]
path=/srv/maison
force create mode=0770
force directory mode=0770
write list=@maison
mkdir /srv/maison
addgroup maison
chown root.maison /srv/maison
chmod 770 /srv/maison
/etc/init.d/smb restart
adduser --disabled-login --no-create-home --ingroup maison utilisateur1
smbpasswd -a utilisateur1
Connexion a un partage depuis un client Windows :
net use h: \\192.168.1.75\maison
# Install Smartmontools (monitoring SMART des disques USB)
voir --> http://www.smartmontools.org/wiki/USB
mercredi 12 juin 2013
Debian sur Alix
Installer une debian Squeeze sur un boitier Alix :
Partitioning and formatting the flash card
Create a single partition on the flash card and put an ext2 filesystem on it. Don’t forget to erase any existing partitions first. Afterwards, mount the newly create filesystem. Note that we are using an Ext2 filesystem. Using a journaled filesystem such as Ext3 is not a good idea, as this creates extra wear on your flash card.
fdisk /dev/sdb
mkfs.ext2 /dev/sdb1
mkdir /mnt/cf
mount /dev/sdb1 /mnt/cf
Loading a basic debian system on the CF
debootstrap --arch i386 squeeze /mnt/cf http://ftp.debian.org/debian
Mount special filesystems and chroot
mount -t proc none /mnt/cf/proc
mount -t sysfs none /mnt/cf/sys
mount -o bind /dev /mnt/cf/dev/
LC_ALL=C chroot /mnt/cf /bin/bash
mount devpts /dev/pts -t devpts
Filesystems
In order to minimize wear on the flash card, noatime was added to the mount options. This prevents the filesystem from updating access times. The tmpfs memory filesystem was used for some of the folders, basically for the same reason (minimize wear). The CF will be /dev/sda once installed in the Alix. Edit the file /etc/fstab :
proc /proc proc noatime,defaults 0 0
/dev/sda1 / ext2 noatime,defaults 0 1
tmpfs /tmp tmpfs noatime,defaults 0 0
tmpfs /var/tmp tmpfs noatime,defaults 0 0
tmpfs /var/run tmpfs noatime,defaults 0 0
tmpfs /var/log tmpfs noatime,defaults 0 0
tmpfs /var/lock tmpfs noatime,defaults 0 0
Network configuration
Edit the file /etc/network/interfaces. The example below will configure one of the network interfaces with IP address 192.168.1.250. Feel free to edit these values for your specific situation.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.250
netmask 255.255.255.0
Serial console
Disable TTYs and put a getty on the serial console. Edit the file /etc/inittab :
#1:2345:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
T0:23:respawn:/sbin/getty -L ttyS0 19200 vt100
Grub: preparations
Install the grub package on the CF and create the file menu.lst, which will be used later on. Don’t configure grub at this stage.
apt-get install grub
cp /usr/lib/grub/i386-pc/* /boot/grub
Create /boot/grub/menu.lst (flash card will be sda on Alix):
default 0
timeout 5
serial --unit=0 --speed=19200 --word=8 --parity=no --stop=1
terminal --timeout=5 serial console
title Debian
root (hd0,0)
kernel /vmlinuz root=/dev/sda1 ro console=ttyS0,19200n8
initrd /boot/initrd.img
Install the kernel
We will install a 486 kernel, as this seems to be the best option for the CPU present in the Alix. More information about this can be found via the links at the bottom of this post.
apt-get install linux-image-486
Final customizations
Change the root password:
passwd root
Install the SSH server daemon. You can skip this skip if console access via serial connection is sufficient.
apt-get install openssh-server
Disable udev network interface rules:
rm /etc/udev/rules.d/70-persistent-net.rules
chmod 444 /lib/udev/write_net_rules
Configure the locale to en_US.UTF-8:
apt-get install locales
dpkg-reconfigure locales
Create the file setlocale.sh in /etc/profile.d, with the following contents:
#!/bin/bash
export LC_ALL=en_US.UTF-8
Final steps before booting the Alix
umount /dev/pts
Exit the chroot & umount special filesystems:
exit
umount /mnt/cf/proc
umount /mnt/cf/sys
umount /mnt/cf/dev/
Install grub in the MBR & umount the flash card:
grub-install --no-floppy --root-directory=/mnt/cf /dev/sdb
umount /mnt/cf
Login with the root user and the password you picked in one of the previous steps. Next, edit the file /etc/default/grub :
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,19200n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1"
Now run:
update-grub
It's done !
-- Voir aussi --
Partitioning and formatting the flash card
Create a single partition on the flash card and put an ext2 filesystem on it. Don’t forget to erase any existing partitions first. Afterwards, mount the newly create filesystem. Note that we are using an Ext2 filesystem. Using a journaled filesystem such as Ext3 is not a good idea, as this creates extra wear on your flash card.
fdisk /dev/sdb
mkfs.ext2 /dev/sdb1
mkdir /mnt/cf
mount /dev/sdb1 /mnt/cf
Loading a basic debian system on the CF
debootstrap --arch i386 squeeze /mnt/cf http://ftp.debian.org/debian
Mount special filesystems and chroot
mount -t proc none /mnt/cf/proc
mount -t sysfs none /mnt/cf/sys
mount -o bind /dev /mnt/cf/dev/
LC_ALL=C chroot /mnt/cf /bin/bash
mount devpts /dev/pts -t devpts
Filesystems
In order to minimize wear on the flash card, noatime was added to the mount options. This prevents the filesystem from updating access times. The tmpfs memory filesystem was used for some of the folders, basically for the same reason (minimize wear). The CF will be /dev/sda once installed in the Alix. Edit the file /etc/fstab :
proc /proc proc noatime,defaults 0 0
/dev/sda1 / ext2 noatime,defaults 0 1
tmpfs /tmp tmpfs noatime,defaults 0 0
tmpfs /var/tmp tmpfs noatime,defaults 0 0
tmpfs /var/run tmpfs noatime,defaults 0 0
tmpfs /var/log tmpfs noatime,defaults 0 0
tmpfs /var/lock tmpfs noatime,defaults 0 0
Network configuration
Edit the file /etc/network/interfaces. The example below will configure one of the network interfaces with IP address 192.168.1.250. Feel free to edit these values for your specific situation.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.250
netmask 255.255.255.0
Serial console
Disable TTYs and put a getty on the serial console. Edit the file /etc/inittab :
#1:2345:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
T0:23:respawn:/sbin/getty -L ttyS0 19200 vt100
Grub: preparations
Install the grub package on the CF and create the file menu.lst, which will be used later on. Don’t configure grub at this stage.
apt-get install grub
cp /usr/lib/grub/i386-pc/* /boot/grub
Create /boot/grub/menu.lst (flash card will be sda on Alix):
default 0
timeout 5
serial --unit=0 --speed=19200 --word=8 --parity=no --stop=1
terminal --timeout=5 serial console
title Debian
root (hd0,0)
kernel /vmlinuz root=/dev/sda1 ro console=ttyS0,19200n8
initrd /boot/initrd.img
Install the kernel
We will install a 486 kernel, as this seems to be the best option for the CPU present in the Alix. More information about this can be found via the links at the bottom of this post.
apt-get install linux-image-486
Final customizations
Change the root password:
passwd root
Install the SSH server daemon. You can skip this skip if console access via serial connection is sufficient.
apt-get install openssh-server
Disable udev network interface rules:
rm /etc/udev/rules.d/70-persistent-net.rules
chmod 444 /lib/udev/write_net_rules
Configure the locale to en_US.UTF-8:
apt-get install locales
dpkg-reconfigure locales
Create the file setlocale.sh in /etc/profile.d, with the following contents:
#!/bin/bash
export LC_ALL=en_US.UTF-8
Final steps before booting the Alix
umount /dev/pts
Exit the chroot & umount special filesystems:
exit
umount /mnt/cf/proc
umount /mnt/cf/sys
umount /mnt/cf/dev/
Install grub in the MBR & umount the flash card:
grub-install --no-floppy --root-directory=/mnt/cf /dev/sdb
umount /mnt/cf
Login with the root user and the password you picked in one of the previous steps. Next, edit the file /etc/default/grub :
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,19200n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1"
Now run:
update-grub
It's done !
-- Voir aussi --
mercredi 20 mai 2009
jeudi 14 mai 2009
Site dédié à l'administration Debian
Un peu comme ce blog-mémo mais en plus costaud :
http://www.debian-administration.org
Pleins de tips et tutos pour Debian et Debian-like :)
http://www.debian-administration.org
Pleins de tips et tutos pour Debian et Debian-like :)
mardi 12 mai 2009
Création d'un paquet Debian -- test.deb
Commencer par créer un script qui ne fait pas grand chose (!) :
Exemple "test.sh" :
[...]
#!/bin/bash
echo "Entrer un nom [eg - foo] : "
read nom
echo $nom > ./test
[...]
Ensuite créer l'architecture du paquet "test" :
/home/<vous>/test/
/home/<vous>/test/DEBIAN/
/home/<vous>/test/DEBIAN/control (fichier décrivant les informations
relatives à notre paquet)
/home/<vous>/test/DEBIAN/postinst (script exécuté après l'installation
du paquet)
/home/<vous>/test/DEBIAN/postrm (script exécuté après la désinstallation
du paquet)
/home/<vous>/test/DEBIAN/prerm (script exécuté avant la désinstallation
du paquet)
/home/<vous>/test/usr/
/home/<vous>/test/usr/bin/
/home/<vous>/test/usr/bin/test.sh (notre script, exposé ci-dessus)
/home/<vous>/test/usr/share/
/home/<vous>/test/usr/share/doc/
/home/<vous>/test/usr/share/doc/README (informations relatives à
l'utilisation de test.sh)
/home/<vous>/test/usr/share/doc/copyright
/home/<vous>/test/usr/share/doc/changelog (changements apportés par
rapport à la dernière version)
/home/<vous>/test/usr/share/doc/changelog.Debian (idem, mais seulement
pour le paquet Debian
Note : Les fichiers post* et pre* doivent contenir le "shebang" càd
"#!/bin/bash" au minimum et être en 755
Note2 : De la même manière il est possible d'ajouter des fichiers où
l'on souhaite en respectant l'arborescence du système, eg: /var/www en
sus de /usr/bin, etc...
Renseigner le fichier "control" comme suit :
Package: test
Version: 1.0
Section: base
Priority: optional
Architecture: all
Depends: bash
Maintainer: Mr X <MrX@fun.com>
Description: Que fait mon script test.sh
Note3 : Il est possible de modifier les dépendances de paquet, en
modifiant la ligne "Depends: bash", avec par exemple :
Depends: bash, some_package >= 1.2, some_other_package >= 2 (le
séparateur étant une virgule)
Il ne reste plus qu'à générer le paquet :
# chmod 755 /home/<vous>/test/DEBIAN/post* /home/<vous>/test/DEBIAN/pre*
# cd ~<vous>
# dpkg-deb --build test.deb
Et voilà un beau paquet Debian tout neuf (mais vraiment minimaliste !)
Il ne reste plus qu'à l'installer avec la commande :
# dpkg -i test.deb
Et enlever avec les commandes :
# dkpg --remove test && dpkg --purge test
Exemple "test.sh" :
[...]
#!/bin/bash
echo "Entrer un nom [eg - foo] : "
read nom
echo $nom > ./test
[...]
Ensuite créer l'architecture du paquet "test" :
/home/<vous>/test/
/home/<vous>/test/DEBIAN/
/home/<vous>/test/DEBIAN/control (fichier décrivant les informations
relatives à notre paquet)
/home/<vous>/test/DEBIAN/postinst (script exécuté après l'installation
du paquet)
/home/<vous>/test/DEBIAN/postrm (script exécuté après la désinstallation
du paquet)
/home/<vous>/test/DEBIAN/prerm (script exécuté avant la désinstallation
du paquet)
/home/<vous>/test/usr/
/home/<vous>/test/usr/bin/
/home/<vous>/test/usr/bin/test.sh (notre script, exposé ci-dessus)
/home/<vous>/test/usr/share/
/home/<vous>/test/usr/share/doc/
/home/<vous>/test/usr/share/doc/README (informations relatives à
l'utilisation de test.sh)
/home/<vous>/test/usr/share/doc/copyright
/home/<vous>/test/usr/share/doc/changelog (changements apportés par
rapport à la dernière version)
/home/<vous>/test/usr/share/doc/changelog.Debian (idem, mais seulement
pour le paquet Debian
Note : Les fichiers post* et pre* doivent contenir le "shebang" càd
"#!/bin/bash" au minimum et être en 755
Note2 : De la même manière il est possible d'ajouter des fichiers où
l'on souhaite en respectant l'arborescence du système, eg: /var/www en
sus de /usr/bin, etc...
Renseigner le fichier "control" comme suit :
Package: test
Version: 1.0
Section: base
Priority: optional
Architecture: all
Depends: bash
Maintainer: Mr X <MrX@fun.com>
Description: Que fait mon script test.sh
Note3 : Il est possible de modifier les dépendances de paquet, en
modifiant la ligne "Depends: bash", avec par exemple :
Depends: bash, some_package >= 1.2, some_other_package >= 2 (le
séparateur étant une virgule)
Il ne reste plus qu'à générer le paquet :
# chmod 755 /home/<vous>/test/DEBIAN/post* /home/<vous>/test/DEBIAN/pre*
# cd ~<vous>
# dpkg-deb --build test.deb
Et voilà un beau paquet Debian tout neuf (mais vraiment minimaliste !)
Il ne reste plus qu'à l'installer avec la commande :
# dpkg -i test.deb
Et enlever avec les commandes :
# dkpg --remove test && dpkg --purge test
mardi 23 décembre 2008
vendredi 17 octobre 2008
Figer un paquet (debian-like)
Demander à figer un paquet :
# echo "nom_du_paquet hold" | dpkg --set-selections
Marquer un paquet pour installation :
# echo "nom_du_paquet install" | dpkg --set-selections
Voir le statut des paquets :
# dpkg --get-selections
# echo "nom_du_paquet hold" | dpkg --set-selections
Marquer un paquet pour installation :
# echo "nom_du_paquet install" | dpkg --set-selections
Voir le statut des paquets :
# dpkg --get-selections
lundi 6 octobre 2008
Vnc Server on display :0 (debian way)
1. Install the "vnc4server" package (universe). This will provide
"/usr/lib/xorg/modules/extensions/libvnc.so" (The vnc.so module for VNC
4.1.2 was changed from vnc.so to libvnc.so.)
2. Add "vnc" to the Module section in /etc/X11/xorg.conf
Section "Module"
...
Load "vnc"
EndSection
3.a.If your VNC server is running in a secure environment, you can
disable authentication with the following configuration:
Section "Screen"
...
Option "SecurityTypes" "None"
EndSection
3.b. If your VNC server is NOT running in a secure environment, you will
need to set a VNC password using the vncpasswd program:
# vncpasswd
Password:
Verify:
Then tell the VNC module where the password is stored in xorg.conf:
Section "Screen"
...
Option "SecurityTypes" "VncAuth"
Option "UserPasswdVerifier" "VncAuth"
Option "PasswordFile" "/root/.vnc/passwd"
EndSection
4. Logout and restart X (Ctrl-Alt Backspace)
"/usr/lib/xorg/modules/extensions/libvnc.so" (The vnc.so module for VNC
4.1.2 was changed from vnc.so to libvnc.so.)
2. Add "vnc" to the Module section in /etc/X11/xorg.conf
Section "Module"
...
Load "vnc"
EndSection
3.a.If your VNC server is running in a secure environment, you can
disable authentication with the following configuration:
Section "Screen"
...
Option "SecurityTypes" "None"
EndSection
3.b. If your VNC server is NOT running in a secure environment, you will
need to set a VNC password using the vncpasswd program:
# vncpasswd
Password:
Verify:
Then tell the VNC module where the password is stored in xorg.conf:
Section "Screen"
...
Option "SecurityTypes" "VncAuth"
Option "UserPasswdVerifier" "VncAuth"
Option "PasswordFile" "/root/.vnc/passwd"
EndSection
4. Logout and restart X (Ctrl-Alt Backspace)
mercredi 13 août 2008
Installation d'une Debian GNU/Linux Etch sur un Soekris net4501 (méthode Debootstrap)
Ingrédients :
- Avoir une Compact Flash (CF) de 1Go (ou plus, ça marche avec une
512... mais bon soyons fous au prix d'une CF aujourd'hui...!)
- Un lecteur de carte/USB (!)
- Une machine Debian GNU/Linux (Etch ou autre) opérationnelle, avec une
connexion internet
- Un serveur DHCP
- Un câble Null-Modem 9 broches (si vous voulez vous amuser avec Minicom)
- Un Soekris net4501
- De la patience...
** Sur la machine qui va servir à installer le système minimum faire : **
Connecter la CF sur votre lecteur de carte
dmesg (pour voir le nom de votre CF reconnu dans le système)
fdisk /dev/sdX (probablement, où X = une lettre)
mkfs.ext3 /dev/sdX
Créer 2 partitions principales :
--
Swap --> 128 Mo (ID 82) (tune2fs -c 0 /dev/sdX, recommandé pour une CF)
Ext3 --> le reste (ID 83)
--
apt-get install minicom (équivalent HyperTerminal, pour les windowziens :-)
apt-get install debootstrap
mount -t ext3 /dev/sdXY /mnt/CF
debootstrap --arch i386 etch /mnt/CF/ ftp://ftp.de.debian.org/debian/
(boire un café !)
mount -t proc proc1 /mnt/CF/proc
mount -o bind /dev /mnt/CF/dev
chroot /mnt/CF
apt-get install locales console-data console-common
dpkg-reconfigure locales console-data
apt-get install initrd-tools
apt-get install linux-image-2.6.24[...]486 (ou installer un autre kernel)
apt-get install pciutils bzip2 sysfsutils dhcp3-client resolvconf
openssh-server openntpd ntpdate [...vous pouvez ajouter d'autres paquets...]
Modif "/etc/hosts" à
--
127.0.0.1 localhost
--
Modif "/etc/hostname" à
--
net4501 # (par exemple)
--
Modif "/etc/network/interfaces" à
--
auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0
auto eth0
iface eth0 inet dhcp
--
Modif "/etc/fstab" à
proc /proc proc defaults 0 0
/dev/hda1 none swap sw 0 0
/dev/hda2 / ext3 defaults,errors=remount-ro 0 1
--
!! Il est à noter que le Soekris verra vos partitions en /dev/hdXY... Et
plus en /dev/sdXY puisque normalement il n'y aura que le lecteur CF sur
votre système !!
--
passwd (pour fixer le mot de passe root)
apt-get install grub
--
Lancer grub
> root (hd1,1) !! remplacer par les informations correctes dans votre
système, il s'agit là de la partition bootable de votre soekris !!
> setup (hd1)
> quit
--
Eventuellement faire un "update-grub" pour créer "menu.lst" s'il n'est pas créé avec la commande précédente
--
Modif "/boot/grub/menu.lst" à
--
# Activer la console série, unit 0 est /dev/ttyS0, unit 1 est
/dev/ttyS1..., ajouter ces 2 lignes au début du fichier
[...]
serial --unit=0 --speed=19200 --word=8 --parity=no --stop=1
terminal --timeout=5 serial console
[...]
# Modifier les paramètres de boot du kernel en conséquence :
kernel /boot/vmlinuz-2.6.24[..]486 root=/dev/hda1 ro console=tty0
console=ttyS0,19200n8
[...]
--
Mettre la CF dans votre Soekris, puis le démarrer
Lancer minicom et configurer votre connexion série comme il faut, la
vitesse de connexion sur un soekris net4501 est de 19200 8N1 (voir
Remarques)
Normalement tout se passe bien et cela démarre :)
Au démarrage, cela va se bloquer sur "crond", mais en fait non.
Connectez vous en SSH (après avoir récupéré l'adresse IP de votre
Soekris dans les logs de votre serveur DHCP) --> ssh
root@<adresse_IP_du_Soekris>
Une fois connecté, pour avoir la console au démarage :
Modif fichier "/etc/inittab" à
--
[...]
T0:23:respawn:/sbin/getty -L ttyS0 19200 vt100 (il suffit en général de
décommenter la ligne qui est déjà configurée)
[...]
--
Normalement maintenant au boot vous devriez voir apparaitre le prompt de
login !
** Sur le Soekris net4501 (en SSH ou console) **
hwclock --set --date="<mois>/<jour>/<année_2_digits>
<heure>:<minute>:<seconde>" (le Soekris étant surement réglé sur
1980...ce qui pose des problèmes à la commande "apt-get" dans beaucoup
de cas...)
tzconfig
... A vous de jouer, la route est longue mais la voie est libre !
*************** Remarques ***************
Minicom :
--
Erreur --> appuyer sur une touche pour continuer (en boucle)
--
1/ Faire Ctrl-A, puis Z, puis O, puis "configuration du port série",
puis lettre F (contrôle d'erreur matériel), mettre à "NON"
2/ Grub (Stage 2 ce lance), mais le clavier est inaccessible...
3/ (Re)Faire Ctrl-A, puis Z, puis O, puis "configuration du port série",
puis lettre F (contrôle d'erreur matériel), mettre à "OUI"
4/ Le clavier est de nouveau accessible ! Booter en appuyant sur
entrée.
*************** MAJ ***************
- Il faut mieux utiliser PuTTY qui donne de meilleurs résultats que Minicom ^^
- Avoir une Compact Flash (CF) de 1Go (ou plus, ça marche avec une
512... mais bon soyons fous au prix d'une CF aujourd'hui...!)
- Un lecteur de carte/USB (!)
- Une machine Debian GNU/Linux (Etch ou autre) opérationnelle, avec une
connexion internet
- Un serveur DHCP
- Un câble Null-Modem 9 broches (si vous voulez vous amuser avec Minicom)
- Un Soekris net4501
- De la patience...
** Sur la machine qui va servir à installer le système minimum faire : **
Connecter la CF sur votre lecteur de carte
dmesg (pour voir le nom de votre CF reconnu dans le système)
fdisk /dev/sdX (probablement, où X = une lettre)
mkfs.ext3 /dev/sdX
Créer 2 partitions principales :
--
Swap --> 128 Mo (ID 82) (tune2fs -c 0 /dev/sdX, recommandé pour une CF)
Ext3 --> le reste (ID 83)
--
apt-get install minicom (équivalent HyperTerminal, pour les windowziens :-)
apt-get install debootstrap
mount -t ext3 /dev/sdXY /mnt/CF
debootstrap --arch i386 etch /mnt/CF/ ftp://ftp.de.debian.org/debian/
(boire un café !)
mount -t proc proc1 /mnt/CF/proc
mount -o bind /dev /mnt/CF/dev
chroot /mnt/CF
apt-get install locales console-data console-common
dpkg-reconfigure locales console-data
apt-get install initrd-tools
apt-get install linux-image-2.6.24[...]486 (ou installer un autre kernel)
apt-get install pciutils bzip2 sysfsutils dhcp3-client resolvconf
openssh-server openntpd ntpdate [...vous pouvez ajouter d'autres paquets...]
Modif "/etc/hosts" à
--
127.0.0.1 localhost
--
Modif "/etc/hostname" à
--
net4501 # (par exemple)
--
Modif "/etc/network/interfaces" à
--
auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0
auto eth0
iface eth0 inet dhcp
--
Modif "/etc/fstab" à
proc /proc proc defaults 0 0
/dev/hda1 none swap sw 0 0
/dev/hda2 / ext3 defaults,errors=remount-ro 0 1
--
!! Il est à noter que le Soekris verra vos partitions en /dev/hdXY... Et
plus en /dev/sdXY puisque normalement il n'y aura que le lecteur CF sur
votre système !!
--
passwd (pour fixer le mot de passe root)
apt-get install grub
--
Lancer grub
> root (hd1,1) !! remplacer par les informations correctes dans votre
système, il s'agit là de la partition bootable de votre soekris !!
> setup (hd1)
> quit
--
Eventuellement faire un "update-grub" pour créer "menu.lst" s'il n'est pas créé avec la commande précédente
--
Modif "/boot/grub/menu.lst" à
--
# Activer la console série, unit 0 est /dev/ttyS0, unit 1 est
/dev/ttyS1..., ajouter ces 2 lignes au début du fichier
[...]
serial --unit=0 --speed=19200 --word=8 --parity=no --stop=1
terminal --timeout=5 serial console
[...]
# Modifier les paramètres de boot du kernel en conséquence :
kernel /boot/vmlinuz-2.6.24[..]486 root=/dev/hda1 ro console=tty0
console=ttyS0,19200n8
[...]
--
Mettre la CF dans votre Soekris, puis le démarrer
Lancer minicom et configurer votre connexion série comme il faut, la
vitesse de connexion sur un soekris net4501 est de 19200 8N1 (voir
Remarques)
Normalement tout se passe bien et cela démarre :)
Au démarrage, cela va se bloquer sur "crond", mais en fait non.
Connectez vous en SSH (après avoir récupéré l'adresse IP de votre
Soekris dans les logs de votre serveur DHCP) --> ssh
root@<adresse_IP_du_Soekris>
Une fois connecté, pour avoir la console au démarage :
Modif fichier "/etc/inittab" à
--
[...]
T0:23:respawn:/sbin/getty -L ttyS0 19200 vt100 (il suffit en général de
décommenter la ligne qui est déjà configurée)
[...]
--
Normalement maintenant au boot vous devriez voir apparaitre le prompt de
login !
** Sur le Soekris net4501 (en SSH ou console) **
hwclock --set --date="<mois>/<jour>/<année_2_digits>
<heure>:<minute>:<seconde>" (le Soekris étant surement réglé sur
1980...ce qui pose des problèmes à la commande "apt-get" dans beaucoup
de cas...)
tzconfig
... A vous de jouer, la route est longue mais la voie est libre !
*************** Remarques ***************
Minicom :
--
Erreur --> appuyer sur une touche pour continuer (en boucle)
--
1/ Faire Ctrl-A, puis Z, puis O, puis "configuration du port série",
puis lettre F (contrôle d'erreur matériel), mettre à "NON"
2/ Grub (Stage 2 ce lance), mais le clavier est inaccessible...
3/ (Re)Faire Ctrl-A, puis Z, puis O, puis "configuration du port série",
puis lettre F (contrôle d'erreur matériel), mettre à "OUI"
4/ Le clavier est de nouveau accessible ! Booter en appuyant sur
entrée.
*************** MAJ ***************
- Il faut mieux utiliser PuTTY qui donne de meilleurs résultats que Minicom ^^
Inscription à :
Articles (Atom)