Beruflich Dokumente
Kultur Dokumente
de la formation
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Prsentation du formateur
Quest ce que Linux
Le plan de formation
Prsentation de la formation
Outils ncessaires
Comment travailler
Les rfrences des ressources logicielles
Les liens utiles
LPIC1 / Comptia Linux+
alphorm.com
Prsentation du formateur
Nol Mac
alphorm@noelmace.com
Formateur consultant expert Unix et FOSS
Mes rfrences :
Mon profil Viadeo : http://fr.viadeo.com/fr/profile/noel.mace
Mon parcours : http://vizualize.me/noelmace
Mon site : http://noelmace.com
Contacts
Blogs
Base de connaissance
CV
Etc
alphorm.com
Un systme dexploitation
Libre et open source
Issu du projet GNU (1983)
Leader sur :
Les super-calculateurs
alphorm.com
Le plan de formation
Module 1 : Prsentation de Linux
donnes
Module 14 : Configuration e-mail
Module 15 : Scurit
graphique
Module 9 : Gestion des imprimantes et
impressions
Module 10 : Administration systme
alphorm.com
Certifications
LPIC1 :
http://www.lpi.org/linuxcertifications/programs/lpic-1
Comptia Linux+ :
http://certification.comptia.org/getCertified/certifi
cations/linux.aspx
alphorm.com
Prsentation de la formation
Oriente certification
Base sur le parcours officiel
alphorm.com
Outils ncessaires
Deux grandes familles de distribution Linux :
Debian (Ubuntu, Damn Small Linux, etc )
Red Hat (RHEL, Fedora, Centos, Mandriva, etc )
alphorm.com
OU
alphorm.com
Comment travailler
La pratique, toujours la pratique :
Utiliser Linux au quotidien
tre curieux !
Se documenter
Un trs grand nombre de ressources sont disponibles
Ce cours ne peu pas tout traiter
Lire le man !
Effectuer des recherches sur internet
alphorm.com
http://www.debian.org
Fedora :
http://fedoraproject.org/
Virtualbox :
https://www.virtualbox.org/
Virtualboxes :
http://virtualboxes.org/
alphorm.com
distributions :
Forums et irc :
forum ubuntu-fr
Ubuntu (en)
Ubuntu-fr
linuxforums.org (en)
Debian
Gentoo (en)
Fedora (en)
RedHat (en)
OpenSuse (en)
Archlinux (en)
Linux pas--pas
Examens dentrainement :
Linux Praxis
PenguinTutor
MC MCSE
alphorm.com
GO
LPIC1 / Comptia Linux+
alphorm.com
Introduction
Virtualbox
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Installation de virtualbox sous Windows
Rcupration de machines virtuelles
Configuration
Lancement de machine virtuelles
alphorm.com
Ce quon a couvert
Comment mettre en place les outils ncessaires pour ce cours
Grce la virtualisation
FIN
alphorm.com
Introduction
Installation de Debian
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Les diffrentes mthodes dinstallation
Etapes de linstallation
Paramtrage
alphorm.com
Ce quon a couvert
Comment installer Debian
FIN
alphorm.com
Prsentation de Linux
Quest ce que Linux ?
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Un peu dhistoire
Unix
GNU
Linux
Un systme htrogne
Linux est votre ami
alphorm.com
La naissance dUnix
New Kens System
1969
En assembleur
Inspir de Multics
1971 : rcriture en C
1975 : large distribution
alphorm.com
La Famille Unix
alphorm.com
alphorm.com
Linux, enfin
Bas sur Minix
alphorm.com
Un systme htrogne
alphorm.com
alphorm.com
Ce quon a couvert
Do vient Linux
Quest ce quune distribution
Les distributions majeures actuelles
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Pourquoi la ligne de commande ?
Quest ce quun shell ?
Les diffrents shells Unix
Accder au shell
alphorm.com
alphorm.com
Remplaable
Et personnalisable
Interactif ou scripting
alphorm.com
C shell
Plus proche de C
Korn Shell
AIX & HP/UX
Z Shell
Le plus innovant
Synthse de tout les autres
alphorm.com
Choisir un shell
Dbutant = Bash
alphorm.com
Accder au Shell
Dmarrage en mode texte
Shell accessible directement aprs authentification
Terminator
alphorm.com
Ce quon a couvert
Quest ce quun shell
Les principaux shells Unix existant
Comment accder une interface en ligne de commande
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Invite de commande
Syntaxe gnrale
alphorm.com
Ce quon a couvert
Quest ce que linvite de commande
Syntaxe gnrale des commandes Linux
Ecrire une premire commande
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
man
Aide interne des commandes
info
alphorm.com
man
Exemples :
$ man 1 pwd
$ man man
Rsultat :
[ ] : optionnel
< > : valeur
alphorm.com
Pages de manuel
1. Programmes excutables ou
commandes de linterprteur de
commandes (shell)
2. Appels systme (fonctions fournies
par le noyau)
3. Appels de bibliothque (fonctions
6. Jeux
7. Divers (y compris les macropaquets
(gnralement rserves au
superutilisateur)
9. Sous-programmes du noyau [hors
standard]
alphorm.com
Options possibles :
-help
--help
-h
alphorm.com
Info
Ensemble de pages hirarchises
Rparties en plusieurs niveaux ou nuds
rubriques
Liens
Marqus dun astrisque (*)
Exemples :
$ info
$ info cp
LPIC1 / Comptia Linux+
alphorm.com
Info : navigation
q
Quitter
espace
return
Tab
Entre
Suivre le lien
Nud prcdent
l (L min)
LPIC1 / Comptia Linux+
Ce quon a couvert
Comment utiliser laide intgre
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Quest ce quun variable ?
Dclarer une variable
Utiliser une variable
Porte d'une variable
Variables d'environnement
Variables de paramtres
alphorm.com
Exemple :
La variable "message" contenant la chaine de caractre "Bonjour !"
Avec bash :
aucun typage
toute valeur de variable est considre comme une chaine de caractres
LPIC1 / Comptia Linux+
alphorm.com
alphorm.com
alphorm.com
alphorm.com
Variables d'environnement
utiliser la commande export
$ MESSAGE="Bonjour !"
$ export MESSAGE
Par convention, la rfrence est en majuscules
nom) de la variable
pas sa valeur
ne pas utiliser le caractre $
LPIC1 / Comptia Linux+
alphorm.com
variables de paramtres
variables locales
utiles en scripting (vu plus loin)
$1, $2, $3 enregistrent les arguments passs une commande
$0 enregistre la commande ayant permis de lancer la programme
$* enregistre tout les arguments
$# enregistre le nombre d'arguments
etc
alphorm.com
alphorm.com
Ce quon a couvert
Ce qu'est une variable
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Qu'est ce qu'une commande exactement ?
Spcificits des commandes internes
alphorm.com
alphorm.com
essentielles au systme
oprations de base
alphorm.com
Changer de rpertoire
$ cd [repertoire]
"Change directory"
Argument [repertoire]
chemin absolu
exemple : /home/alphorm/monrep
chemin relatif
exemple : alphorm/monrep
alphorm.com
rpertoire personnel
rpertoire courant
..
alphorm.com
alphorm.com
Afficher un message
$ echo [-neE] [arguments ...]
-n
Supprime le retour chariot (retour la ligne) final
-e
affiche les squences d'chappement
-E
Dsactive linterprtation des squences dchappement.
alphorm.com
squences dchappement
\a
\b
\c
\f
saut de page
\n
nouvelle ligne
\r
retour-chariot
\t
tabulation horizontale
\v
tabulation verticale
\\
backslash
\nnn
le caractre dont le code ASCII octal vaut nnn (un trois chiffres)
\xnnn
le caractre dont le code ASCII hexadcimal vaut nnn (un trois chiffres)
alphorm.com
dtermines.
time commande
Permet de lancer une commande, et dafficher le temps qui aura t
ncessaire son excution
exit / logout
stopper lexcution de bash.
LPIC1 / Comptia Linux+
alphorm.com
Ce quon a couvert
Comment les commandes sont reconnues par le bash
Ce qu'est une commande interne
Les squences d'chappement essentielles
Plusieurs commandes internes essentielles
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Les astuces connaitre pour bien utiliser le terminal
alphorm.com
Dmonstration
alphorm.com
Ce quon a couvert
Comment utiliser le terminal son maximum
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Nommage
Chemins d'accs
Globbing
Commandes essentielles
alphorm.com
Nommage
Max 255 caractres
sensibles la casse
alphorm.com
Chemins d'accs
le dlimiteur est le slash (/)
alphorm.com
Globbing
Remplacer des chaines de caractre par des jockers ("wildcards")
?
[]
[a-f]
alphorm.com
Commandes essentielles
cp [OPTION]... SOURCE CIBLE
copier des fichiers et des rpertoires
mv [option...] source cible
dplacer ou renommer des fichiers
rm [options] fichier...
supprimer des fichiers
touch [-acm][-tdate] [] fichier...
crer un fichier vide ou modifier son horodatage
alphorm.com
alphorm.com
Ce quon a couvert
Les conventions respecter pour nommer un fichier
Comment accder un fichier
Ce qu'est le globbing
Ce qu'est un lien (symbolique ou matriel)
L'horodatage Linux
Les commandes essentielles
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Fluxs
Pourquoi les fluxs
Redirections
Pipe
utilisation et substitution d'arguments
alphorm.com
Fluxs
1.
2.
3.
alphorm.com
alphorm.com
Redirections
>
>>
2>
2>>
&>
stdout + stderr
<
<<
<>
alphorm.com
Pipe
le caractre |
alphorm.com
antiquotes
permet de remplacer de manire itrative un argument par les sorties dune
commande
alphorm.com
Ce quon a couvert
Ce qu'est un flux
comment rediriger ces fluxs
comment utiliser xargs et l'antiquote pour raliser une substitution
d'arguments
FIN
alphorm.com
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Concatner des fichiers
Fusionner les lignes de deux fichiers
Regrouper les lignes de diffrents fichiers
Regrouper les lignes de diffrents fichiers
alphorm.com
alphorm.com
alphorm.com
alphorm.com
Ce quon a couvert
Comment combiner des fichiers textes
par concatnation
par fusion de lignes
par regroupement
FIN
alphorm.com
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Les commandes utiles pour tranformer un texte
alphorm.com
Commandes utiles
Convertir les tabulations en espaces
$ expand [-t num][fichier...]
Convertir les espaces en tabulations
$ *unexpand [-a][fichier...]
Trier les lignes dun fichier texte
$ sort [options] [+POS1 [-POS2]] [fichier...]
Dcouper un fichier
$ split [options] [fichier_entre[prfixe_sortie]]
alphorm.com
alphorm.com
Ce quon a couvert
les commandes utiles pour transformer un texte
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Les commandes utiles pour formater un texte
alphorm.com
Commandes utiles
Mettre en forme des textes
$ fmt [options] [fichier...]
Numroter les lignes dun fichier
$ nl [options] [fichier...]
alphorm.com
Ce quon a couvert
les commandes utiles pour formater un texte
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Les commandes utiles pour afficher un texte
alphorm.com
Commandes utiles
Afficher les premires lignes d'un fichier
$ head [options] [fichier...]
Afficher les dernires lignes d'un fichier
$ tail [options] [fichier...]
Afficher un fichier page par page
$ less [fichier...]
alphorm.com
Ce quon a couvert
les commandes utiles pour afficher un texte
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Les commandes utiles pour rsumer un texte
alphorm.com
Commandes utiles
Supprimer une partie de chaque ligne d'un fichier.
$ cut [options] [fichier...]
Afficher le nombre d'octets, de mots et de lignes d'un fichier
$ wc [options] [fichier...]
alphorm.com
Ce quon a couvert
les commandes utiles pour rsumer un texte
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Qu'est ce qu'une expression rgulire ?
Comment crire une expression rgulire ?
Caractres spciaux
Exemples
alphorm.com
Utile pour :
la recherche
la suppression
le remplacement
etc
LPIC1 / Comptia Linux+
alphorm.com
alphorm.com
Caractres spciaux
[ ] ensemble
[ x x ] intervalle
. n'importe quel caractre
regexp
simple
* zro ou plus
rptition
+ un ou plus
? zro ou un
{n,m} de n m fois
| ou logique
regexp
tendue
() sous-section
ligne
^ dbut
$ fin
alphorm.com
Exemples
lignes commenant par un nombre
^[0-9][0-9]*
FreeBSD, OpenBSD ou NetBSD
(Free|Open|Net)BSD
Chaine contenant "Bonjour" puis "au revoir."
Bonjour.*au revoir\.
Un mot commenant par un ou plusieurs 'a' ou 'b'
[ab]+[a-Z]*
alphorm.com
Ce quon a couvert
Comprendre les expressions rgulires
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Pour quoi faire ?
Syntaxe
Demo
alphorm.com
alphorm.com
Syntaxe
$ grep [options] regexp [fichier]
Options
-c : afficher le dcompte des lignes correspondantes
-i : ignorer la casse
-E : utiliser la syntaxe tendue pour les expressions rgulires
identique egrep
alphorm.com
Dmo
alphorm.com
Ce quon a couvert
Comment effectuer une recherche l'aide d'une expression rgulire
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Pour quoi faire ?
Syntaxe
Substitution
Drapeaux
Autres commandes
alphorm.com
alphorm.com
Syntaxe
$ sed [options] commande [fichier]
$ sed [options] f script [fichier]
Options :
-e : permet d'enchainer plusieurs commandes la suite
-r : utilisation des expressions rgulires tendues
-i : effectuer les modifications directement dans le fichier
alphorm.com
Substitution
s/modle/remplacement/drapeau(x)
Exemple :
$ sed s/^#$/#commentaire/ monfichier
alphorm.com
Drapeaux
g
global
N
(nombre)
nime occurrence
write
evaluate
excution de commande
Exemples
$ sed 's/A/B/g' monfichier
$ sed "s/.*5/echo '$A'/e" monfichier
$ sed 's/A/a/gw rslt' monfichier
LPIC1 / Comptia Linux+
alphorm.com
Autres commandes
commande
usage
exemple
quitter
3q
effacer
3d
affichage (avec n)
3p
i\texte
insrer le texte
3i\machin
a\texte
ajouter le texte
3a\machin
c\texte
3c\machin
afficher
3=
alphorm.com
Ce quon a couvert
Comprendre les principes de base de sed.
FIN
alphorm.com
Edition de fichiers
Edition de fichiers textes
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Les outils
Emacs
Nano
Vim
La "guerre" d'diteurs
Un peu de srieux
alphorm.com
Les outils
Graphiques
gedit sous Gnome
kate ou kedit sous KDE
mousepad sous Xfce
CLI
vim
nano
emacs
alphorm.com
Emacs
Puissant
Extensible
Personnalisable
alphorm.com
Dmonstration
alphorm.com
Nano
clone libre de Pico
simple et efficace
minimal
alphorm.com
Dmonstration
alphorm.com
Vim
la rfrence pour ce cours (et la LPIC)
amlioration de vi
cr par Bill Joy en 1976
prsent sur tout les systmes Unix depuis
modal
mais non-libre
Braam Moolenaar en 1991
possde son propre language d'extension
LPIC1 / Comptia Linux+
alphorm.com
Dmonstration
alphorm.com
La "guerre" d'diteurs
Encore une occasion de troll \o/
"Vim est un diteur ; il ne cherche pas inclure "tout sauf l'vier de la cuisine"
mais vous pouvez nettoyer le vtre avec Vim."
"Emacs est un trs bon systme d'exploitation auquel il ne manque qu'un
bon diteur de texte."
La relle raison :
l'habitude
les rflexes conditionns
alphorm.com
Un peu de srieux
Avantages rels de Emacs
usage plus "naturel" pour un dbutant
donne un style "hacker" ^^
a fait plaisir Stallman
Avantages rels de Vim
vite les troubles musculosquelettiques
plus lger, plus rapide
garanti par les standards POSIX
vite les conflits de touches de contrle
LPIC1 / Comptia Linux+
alphorm.com
Ce quon a couvert
Les diffrentes solutions pour diter du texte
Trler en finesse
FIN
alphorm.com
Edition de fichiers
Vim
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Les modes
Commandes utiles
Vimtutor
alphorm.com
Les modes
Touche
Mode
Usage
Esc
normal
insertion
ajouter du texte
commande
visuel
voir dmo
slection
Ex
alphorm.com
Commandes utiles
commande usage
A
ctrl+r
rtablir
yy
copier la ligne
dd
coller
effacer le caractre
dw
diw
alphorm.com
Vimtutor
tutorial intgr
$ vimtutor fr
alphorm.com
Ce quon a couvert
Les modes de Vim
Quelques commandes utiles
Comment lancer le vimtutor
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Le concept
Les diffrents types
Les dpts
Les outils
Comparaison
alphorm.com
Le concept
archive
compos de :
fichiers
excutables ou sources
configuration
documentation
dpendances
informations
LPIC1 / Comptia Linux+
alphorm.com
alphorm.com
Les dpts
vite d'avoir chercher soit mme un paquet
alphorm.com
Les outils
Gestionnaires de paquets
dpkg
rpm
Gestionnaires de tlchargement et rsolution de dpendances
apt Debian & Ubuntu
urpmi Mandriva
Yum Red Hat
Zypp - Suse
LPIC1 / Comptia Linux+
alphorm.com
Comparaison
deb
rpm
oui
recommandations,
suggestions
oui
non
programme de
vrification
non
oui
priorits
oui
non
alphorm.com
Ce quon a couvert
Ce qu'est un paquet (ou package).
Ce que sont les dpts.
Leur utilit.
Les types d'outils disponibles.
Les avantages et inconvnients des formats deb et rpm.
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Commande
Vrifier un paquet
Installer un paquet
Mettre jour un paquet
Obtenir des informations sur un paquet
Obtenir des informations sur un fichier
Dsinstaller un paquet
LPIC1 / Comptia Linux+
alphorm.com
Introduction
Gestionnaires de paquets rpm
cr par Red Hat
en 1995
Adopt par un grand nombre de distributions
RHEL, Fedora & CentOS
Mandriva, Mageia & PCLinuxOS
SLES, SLED & OpenSuse
MeeGo
etc
LPIC1 / Comptia Linux+
alphorm.com
Commande
$ rpm [options]
Permet de :
construire
installer
interroger
vrifier
mettre jour
dsinstaller
LPIC1 / Comptia Linux+
alphorm.com
Vrifier un paquet
$ rpm -V paquet
Vrifie la correspondance entre
Options
-p : indiquer un fichier rpm au lieu
d'un nom de la base
taille
md5
permissions
type
propritaire
LPIC1 / Comptia Linux+
alphorm.com
Installer un paquet
$ rpm -i monpaquet.rpm
Options supplmentaires :
-v : mode verbeux
alphorm.com
alphorm.com
alphorm.com
alphorm.com
Dsinstaller un paquet
$ rpm -e paquet
Options
-v : mode verbeux
alphorm.com
Ce quon a couvert
Comment utiliser le RPM Package manager pour :
installer
mettre jour
vrifier
dsinstaller
obtenir des informations
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Qu'est ce que Yum ?
Rechercher un paquet
Mise jour
Administration
Rechercher un paquet
Informations
Gestion des dpendance
Installer un paquet
Dsinstaller un paquet
alphorm.com
alphorm.com
Mise jour
$ yum update
en cas de premier lancement
$ yum update yum
vrifier les mises jour disponibles
$ yum check-update
partir d'un fichier local
$ yum localupdate paquet.rpm
mise jour vers une version ultrieure de la distribution
$ yum upgrade
LPIC1 / Comptia Linux+
alphorm.com
Rechercher un paquet
alphorm.com
Informations
quivalent rpm qi
$ yum info Paquet
version installe et disponibilit de mises jour
$ yum list Paquet
alphorm.com
alphorm.com
Installer un paquet
alphorm.com
Dsinstaller un paquet
alphorm.com
Rechercher un paquet
quivalent rpm qi
$ yum search Mot_cl
alphorm.com
Administration
nettoyer le cache
permet de librer de l'espace disque en supprimant les rpm tlchargs
$ yum clean option
Options : headers, packages, metadata, dbcache, plugins, expire-cache,
rpmdb, all
Shell mode
$ yum shell
alphorm.com
Ce quon a couvert
Comment utiliser Yum pour :
installer
mettre jour
rechercher et s'informer
dsinstaller
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Options de base
Modifier les dpts
Gestion des priorits
Ajout de dpt via rpm
alphorm.com
Introduction
Configuration par dfaut :
habituellement suffisante
Modifier les options de base
alphorm.com
Options de base
/etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3
[comments abridged]
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
alphorm.com
alphorm.com
alphorm.com
alphorm.com
/etc/yum/pluginconf.d/priorities.conf
[main]
enabled=1
Pour chaque dpt, dans les fichier repos
priority=1
alphorm.com
Importer la cl GPG
$ rpm --import http://dag.wieers.com/rpm/packages/RPM-GPGKEY.dag.txt
alphorm.com
Ce quon a couvert
Comment configurer Yum
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
La commande dpkg
Installer un paquet
Obtenir des informations sur un paquet
Obtenir des informations sur un fichier
Dsinstaller un paquet
Administration
alphorm.com
Introduction
Gestionnaires de paquets deb
cr par Ian Jackson
en 1993
un des premiers systmes de gestion de paquets moderne complet
inspira RPM, le simplifiant
Adopt par Debian et la plupart de ses drivs
Ubuntu, Linux Mint
Knoppix, Damn Small Linux
CrunchBang Linux, etc
LPIC1 / Comptia Linux+
alphorm.com
La commande dpkg
$ dpkg [options] action
Permet de :
construire
installer
interroger
vrifier
mettre jour
dsinstaller
LPIC1 / Comptia Linux+
alphorm.com
Installer un paquet
$ dpkg -i monpaquet.rpm
Options supplmentaires :
-R : mode rcursif
alphorm.com
alphorm.com
alphorm.com
Dsinstaller un paquet
En conservant les fichiers de configuration
$ dpkg -r paquet
Options :
alphorm.com
Administration
Relancer le script de post-installation d'un paquet
$ dpkg --configure paquet
alphorm.com
Ce quon a couvert
Comment utiliser dpkg pour :
installer
mettre jour
vrifier
dsinstaller
obtenir des informations
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction APT
apt-cache
Informations sur un paquet
Statistiques
Gestion des dpendances
Rechercher des paquets
alphorm.com
Introduction APT
Advanced Packaging Tool
gestionnaire de paquet, tlchargement et rsolution de dpendances
interface dpkg
bibliothque de fonctions utilise par plusieurs programmes
grce apt-rpm
alphorm.com
apt-cache
Manipulation du cache de paquets
$ apt-cache [options] action
aucune manipulation du systme
recherche dans les mtadonnes
alphorm.com
alphorm.com
Statistiques
$ apt-cache stats
alphorm.com
alphorm.com
alphorm.com
Ce quon a couvert
Comment utiliser apt-cache pour recueillir des informations sur mes
paquets
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Administration
Installation et dsinstallation
Mise jour
Options
alphorm.com
Administration
Mettre jour les informations sur les dpts
$ apt-get update
alphorm.com
Installation et dsinstallation
Installer
$ apt-get install package
Dsinstaller
$ apt-get remove package
alphorm.com
Mise jour
Mettre jour tout les packages installs
$ apt-get upgrade
alphorm.com
Options
Option
Action(s)
Description
-d
upgrade, dselect-upgrade,
install, source
tlchargement sans
installation
-f
install, remove
-m
upgrade, dselect-upgrade,
install, remove, source
-q / -qq
toutes
mode silencieux
-s
toutes
simulation
-y
toutes
-b
source
--no-upgrade install
LPIC1 / Comptia Linux+
Ce quon a couvert
Comment utiliser apt-get pour :
installer
dsinstaller
mettre jour
FIN
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Fichier sources.list : exemple
Adresse
Distribution
Sections
alphorm.com
Introduction
Configuration par dfaut :
habituellement suffisante
Modifier les options de base
alphorm.com
alphorm.com
Adresse
Exemple :
deb http://fr.archive.ubuntu.com/ubuntu/ precise main restricted
bloc 1 :
bloc 2 : URL
alphorm.com
Distribution
Exemple :
deb http://fr.archive.ubuntu.com/ubuntu/ precise main restricted
bloc 3 : distribution
nom de code
- Ubuntu : quantal (12.10), precise (12.04), lucid (10.04)
- Debian : lenny, squeeze, Wheezy, sid
catgorie de version
- oldstable, stable, testing, unstable
alphorm.com
Sections
deb http://fr.archive.ubuntu.com/ubuntu/ precise main restricted
Logiciels libres
main
universe
Logiciels non-libres ou
possiblement non-libres
restricted
multiverse
Ubuntu
Debian
alphorm.com
Ce quon a couvert
Comment configurer les dpots APT
FIN
alphorm.com
Configuration du
matriel
Introduction
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Un peu de thorie
Qu'est ce que le BIOS ?
IRQs
Ports d'E/S
Adresses DMA
alphorm.com
Un peu de thorie
Gnrale
alphorm.com
alphorm.com
IRQs
Interruptions matrielles
dclenches par les priphriques
afin de prendre la main sur le processeur
alphorm.com
Ports d'E/S
espace mmoire fixe et unique
alloue un priphrique
permettant la communication entre le CPU et le priphriques
alphorm.com
Adresses DMA
Direct Memory Access
systme daccs direct la mmoire par les priphriques
afin den disposer comme dune zone de tampon
Espace unique
permet d'allger la charge systme
en vitant tout mcanisme de pooling
alphorm.com
Ce quon a couvert
Quelques prrequis thoriques ncessaires pour la configuration
alphorm.com
Configuration du
matriel
procfs
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Processeur(s)
Objectif
IRQs
Alimentation
Mmoire
processeur(s)
Kernel
zones thermiques
Informations gnrales
BUS
USB
PCI
alphorm.com
Introduction
systme de fichier virtuel
destin la gestion des processus
alphorm.com
Objectif
Rcuprer (voir modifier) des informations sur :
les processus
le matriel
ainsi que des informations gnrales sur le systme
alphorm.com
Alimentation
Rpertoire
ACPI
ou APM (pour les plus anciens)
obsolte depuis le kernel 2.6.36 : remplacement par sysfs
Fichiers
info : informations gnrales
sleep : tts de sommeil du systme
button : interrupteurs
etc
LPIC1 / Comptia Linux+
alphorm.com
Alimentation : le processeur
rpertoire /proc/acpi/processor
un rpertoire par processeur
etc
alphorm.com
alphorm.com
BUS
/proc/bus/
alphorm.com
USB
/proc/bus/usb/
un rpertoire par bus
exemple : 001
permettant de retrouver les fichiers correspondants aux priphriques
alphorm.com
PCI
/proc/bus/pci/
fichiers difficiles d'interprtation
utilise /proc/bus/pci/devices
liste les priphriques PCI
IRQs et Ports d'E/S vus par le contrleur PCI (non le kernel)
alphorm.com
Processeur(s)
/proc/cpuinfo
fichiers difficiles d'interprtation
utilise /proc/bus/pci/devices
liste les priphriques PCI
IRQs et Ports d'E/S vus par le contrleur PCI (non le kernel)
alphorm.com
Processeur(s)
/proc/cpuinfo
processor
model name
cache size
physical id
siblings
core id
cpu cores
processor
model name
cache size
physical id
siblings
core id
cpu cores
LPIC1 / Comptia Linux+
:
:
:
:
:
:
:
:
:
:
:
:
:
:
0
Intel(R) Pentium(R) 4 CPU 2.80GHz
1024 KB
0
2
0
1
1
Intel(R) Pentium(R) 4 CPU 2.80GHz
1024 KB
0
2
0
1
alphorm.com
IRQs
/proc/interrupts
0:
1:
2:
8:
12:
13:
16:
20:
30:
31:
NMI:
ERR:
IRQs
CPU0
1366814704
128
0
0
5323
1
11184294
8450043
10432
23
0
0
CPU1
0
340
0
1
5793
0
15940594
11120093
10722
22
nombre
d'interruptions
XT-PIC
IO-APIC-edge
XT-PIC
IO-APIC-edge
IO-APIC-edge
XT-PIC
IO-APIC-level
IO-APIC-level
IO-APIC-level
IO-APIC-level
type
timer
keyboard
cascade
rtc
PS/2 Mouse
fpu
Intel EtherExpress Pro 10/100 Ethernet
megaraid
aic7xxx
aic7xxx
priphrique
alphorm.com
Mmoire
/proc/kcore
"alias" vers la mmoire vive
/proc/meminfo
tat courant de la mmoire
alphorm.com
Kernel
/proc/sys/
paramtres du kernel au lancement
modifiables via
$ sysctl
alphorm.com
Informations gnrales
/proc/version & /proc/sys/kernel/version
version du systme
$ uname -a
/proc/loadavg
temps de fonctionnement du systme
$ uptime
alphorm.com
Ce quon a couvert
Ce qu'est le rpertoire /proc.
alphorm.com
Configuration du
matriel
Sysfs
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Historique
Dossiers
alphorm.com
Introduction
systme de fichier virtuel
bas sur ramfs
Permet :
de rcolter des informations sur le hardware
alphorm.com
Historique
Cr sous l'insistance de Linus Torvalds
pour Linux 2.5
pour debugger le nouveau modle de pilote
Avant :
aucune mthode de reprsentation unifie des relations pilote/priphrique
pas de mcanisme gnrique de hotplug
procfs encombr (pas seulement processus)
alphorm.com
Devices
/sys/devices/
couche physique
relations parent / enfant
complexe
les autres dossiers contiennes des liens symboliques vers les dossiers de
/sys/devices/
alphorm.com
/sys/class/
le plus pratique
par types
alphorm.com
Autres dossiers
/sys/block/ : priphriques de type block
alphorm.com
Ce quon a couvert
A quoi correspond le dossier /sys/
Sa structure.
alphorm.com
Configuration du
matriel
udev
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Historique
Pseudo-priphriques
Rseau
Block
Configuration
alphorm.com
Introduction
fait le lien entre sysfs et les informations donnes par l'utilisateur
alphorm.com
Historique
l'origine, fichiers inscrits en dur
puis devfs
cration de udev
depuis Linux 2.6.13 ( aot 2005)
pour rpondre aux problmatiques du hotplug
ne reprsenter que les priphriques rellement prsents
alphorm.com
Pseudo-priphriques
/dev/null
/dev/zero
/dev/full
alphorm.com
Rseau
Sous Linux, pas de nud particulier
Toujours crs par udev, mais directement pour les logiciels
habituellement : eth[012]
alphorm.com
Block
/dev/fd[abc]
/dev/hd[abc]
/dev/sd[abc]
/dev/st, ht, nst
/dev/sr[012]
/dev/loop[012]
alphorm.com
Configuration
/etc/udev
/etc/udev/rules.d
alphorm.com
Ce quon a couvert
Ce qu'est le rpertoire /dev.
Son fonctionnement.
Pourquoi et comment l'utiliser.
Quelques exemple de "nodes".
Ses fichiers de configuration.
alphorm.com
Configuration du
matriel
Introduction au Kernel
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
La naissance
L'essor
Qu'est ce qu'un kernel ?
Espace utilisateur et espace noyau
Un noyau monolithique
Un noyau modulaire
alphorm.com
La naissance
l'origine
Linux Torvalds, 22ans, Finlandais, Universit d'Helsinsky
simple mulateur de terminal
dans un but ludique
alphorm.com
L'essor
mars 1994 : version 1.0
juillet 1996 : version 2.0
licence GPL
2000 : Open Source Development Labs
janvier 2007 : Fondation Linux
fvrier 2013 : version 3.8
alphorm.com
alphorm.com
appels systme
alphorm.com
Un noyau monolithique
fort dbat avec Andrex S Tanenbaum
avantages
concept simple : facilit la conception
bonne vitesse d'excution
dfauts
difficult de maintenance
volume (cf. hotplug)
LPIC1 / Comptia Linux+
alphorm.com
Un noyau modulaire
depuis la version 1.2
mars 1995
alphorm.com
Ce quon a couvert
L'histoire du noyau Linux.
Sa structure.
Son rle.
alphorm.com
Configuration du
matriel
kernel modules
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
afficher les modules actuellement chargs
Charger un module
Dcharger un module
alphorm.com
Introduction
la plupart des drivers sont incorpors comme des modules
ainsi que d'autres fonctionnalits, comme les systmes de fichier
/lib/modules
alphorm.com
Size
35820
21888
65200
5568
7296
15680
49536
19236
42848
39080
nom
taille
Used by
0
1 isofs
0
1
1
1
1 vfat
0
0
2 sr_mod,ide_cd
Charger un module
# insmode chemin_vers_le_module
charge un seul et unique module
Exemple :
# insmod /lib/modules/2.6.26/kernel/drivers/block/floppy.ko
alphorm.com
-n : test
-r : dcharger un module
-- show-depends
-l : lister les modules disponibles
LPIC1 / Comptia Linux+
alphorm.com
Dcharger un module
# rmmod nom_du_module
Permet de librer de la mmoire
Options :
-v : verbose
-f : force
-w : wait
alphorm.com
Ce quon a couvert
La gestion du chargement et dchargement manuel des modules Linux.
alphorm.com
Configuration du
matriel
Les disques durs
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Qu'est ce qu'un disque dur ?
Les diffrents types
PATA
SATA
SCSI
Disques externes
alphorm.com
alphorm.com
alphorm.com
PATA
quasi disparu depuis 2005
peu pratique
faibles performances
normalement /dev/hdx
mais souvent reconnus comme du SCSI par Linux
LPIC1 / Comptia Linux+
alphorm.com
SATA
apparu en 2003
a largement remplac le PATA
branchement chaud
meilleurs performances
meilleur cablage
alphorm.com
SCSI
standard de bus trs large
disques mais aussi imprimantes, scanners, etc
SAS : Serial Attached SCSI
mode de transmission en srie du SATA + SCSI
Plus orient pro
/dev/sdx
de nos jours reprsente la plupart des disques durs, dits "pseudo-scsi"
alphorm.com
Disques externes
USB
IEEE-1394
dit Firewire par Apple ou i.Link par Sony
e-SATA
SCSI
alphorm.com
Ce quon a couvert
Ce qu'est un disques dur.
alphorm.com
Configuration du
matriel
Partitionning
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Qu'est ce que c'est ?
Pourquoi ?
Comment ?
Et les autres formats de table ?
Adressage
Codes de partition
alphorm.com
seul
alphorm.com
Pourquoi ?
Multi-OS
varier les systmes de fichier
Gestion de l'espace
Protection pour la corruption
Scurit cf. mount & fstab
Sauvegarde
alphorm.com
Comment ?
traditionnellement (x86 Intel MBR)
alphorm.com
alphorm.com
Adressage
CHS : Cylinder/Head/Sector
ECHS
alphorm.com
Codes de partition
2 chiffres Hexadcimaux
indiquent un format / des fonctions spcifiques
0x06 FAT
0x82 Linux Swap
0x83 Linux FS
alphorm.com
Outils
En ligne de commande :
fdisk / gdisk
GNU parted
cfdisk (curses)
Outils graphiques :
Gparted
QtParted
KDE partition manager
etc
alphorm.com
Ce quon a couvert
Ce qu'est exactement le partionning.
alphorm.com
Configuration du
matriel
FHS
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Donnes utilisateurs
Avant le FHS
Variables
La naissance du FHS
Montage
Partageabilit
FS virtuels
Statique ou variable ?
Programmes
Systme
alphorm.com
Introduction
simplicit
cohrence
alphorm.com
Avant le FHS
cf histoire d'Unix
nombreuses variantes = incohrences, abscense de standards
1994 : FSSTND
programmes = /bin ou /usr/bin
scripting
montage en ro
alphorm.com
La naissance du FHS
1996 par le Free Standard Group
version actuelle : 2.3 janv. 2004
alphorm.com
Partageabilit
alphorm.com
Statique ou variable ?
alphorm.com
Programmes
/bin
/usr/local/bin
/sbin
/usr/bin
/lib
alphorm.com
Systme
/boot
/etc
/usr
/srv
/usr/local
/opt
alphorm.com
Donnes utilisateurs
/home
/root
alphorm.com
Variables
/var
/tmp
alphorm.com
Montage
/mnt
/media
alphorm.com
FS virtuels
/dev
/proc
alphorm.com
Ce quon a couvert
Quel est le rle exact des dossiers les plus importants du systme.
alphorm.com
Configuration du
matriel
fdisk
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
La commande fdisk
Les commandes de fdisk
alphorm.com
Introduction
"fixed disk"
projet util-linux
alphorm.com
La commande fdisk
# fdisk [options] [priphrique]
Options :
-l : affichage des partitions
Exemple
# fdisk /dev/sdb
LPIC1 / Comptia Linux+
alphorm.com
description
alphorm.com
Ce quon a couvert
Comment partitionner un priphrique avec fdisk.
alphorm.com
Configuration du
matriel
GNU Parted
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
La commande parted
Les commandes de parted
alphorm.com
Introduction
diteur de partition
projet GNU
alphorm.com
La commande parted
# parted [options][device]
Options :
-l : lister les partitions
alphorm.com
description
afficher l'aide
mkpart
rm
move
resize
alphorm.com
Ce quon a couvert
Comment partitionner un disque dur avec GNU Parted.
alphorm.com
Configuration du
matriel
Introduction aux systmes de
fichiers
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Qu'est ce qu'un fs ?
Concepts
Les linuxiens
Les "sophistiqus"
Les autres OS
Supports optiques
alphorm.com
Qu'est ce qu'un fs ?
structure de donne
alphorm.com
Concepts
journalisation
fragmentation
alphorm.com
Les linuxiens
ext
ext2
ext2
ext4
btrfs
reiserfs
reiser4
alphorm.com
Les "sophistiqus"
JFS
XFS
alphorm.com
Les autres OS
FAT
NTFS
HFS
HFS+
alphorm.com
Supports optiques
Iso-9660
Joliet
UDF
alphorm.com
Ce quon a couvert
Les diffrentes fs disponibles sur Linux.
alphorm.com
Configuration du
matriel
formatage
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Crer un systme de fichier
FAT
SWAP
alphorm.com
Introduction
terme ambigu
bas-niveau
haut-niveau
cration d'un fs
alphorm.com
Options :
-c : recherche de secteurs dfectueux
-m pourcentage : pourcentage d'espace rserv
5 par dfaut
alphorm.com
FAT
# mkfs.msdos partition
# mkfs.vfat partition
Options :
-F fat-size : type / taille de FAT
alphorm.com
SWAP
Extension de la mmoire
type code 0x82
"formatage"
# mkswap partition
utilisation
# swapon partition
ou cf /etc/fstab
alphorm.com
Ce quon a couvert
Ce qu'est le formatage.
alphorm.com
Configuration du
matriel
Gestion de la proprit d'un
fichier
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Afficher
Modifier
Modifier le groupe
alphorm.com
Introduction
scurit
un propritaire
un groupe propritaire
alphorm.com
Afficher
lister
$ ls l [fichier]
colonnes 3 et 4
alphorm.com
Modifier
# chown [options] [newowner][:newgroup] filenames
Options
-R ou --recursive
alphorm.com
Modifier le groupe
# chgrp [options] newgroup filenames
Options
-R ou --recursive
alphorm.com
Ce quon a couvert
Premire partie des droits d'accs aux fichiers.
dossier.
dossier.
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Afficher
Type code
Permissions simples
Modifier les droits
SUID & SGID
Sticky bit
Reprsentation des droits spciaux
LPIC1 / Comptia Linux+
alphorm.com
Introduction
standard Unix
alphorm.com
Afficher
$ ls -l
colonne 1
ex : drwxr--r--
alphorm.com
Type code
caractre signification
-
fichier
rpertoire
lien symbolique
pipe
socket
priphrique bloc
priphrique caractre
alphorm.com
Permissions simples
read write execute
9 bits
reprsentation octale : r = 4, w = 2, x = 1
ex : 754 = rwxr-xr--
alphorm.com
Mode :
destinataire : u, g, o ou a
+, - ou =
droits
ou criture octale
Exemple :
$ chmod u+r,g-x fichier
LPIC1 / Comptia Linux+
alphorm.com
excutables
attaques sushi
alphorm.com
Sticky bit
alphorm.com
octal suplmentaire
7777
SUID = 4, SGID = 2, Sticky bit =1
ex : 6744 = rwsr-Sr--
alphorm.com
Ce quon a couvert
Les droits d'accs aux fichiers sous les systme Unix.
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Prrequis
Fonctionnement
Afficher
Crer ou modifier
Supprimer
Masque
Hirarchie
LPIC1 / Comptia Linux+
alphorm.com
Introduction
alphorm.com
Prrequis
kernel :
CONFIG_FS_POSIX_ACL=y
CONFIG_SystemeDeFichiers_FS_POSIX_ACL=y
$ grep ACL /boot/config-*
alphorm.com
Fonctionnement
3 bits de permissions
alphorm.com
Afficher
$ getfacl fichier
alphorm.com
Crer ou modifier
$ setfacl [options] -m [d:]permission[,permission...] fichier
Options
-R : rcursif
-d : hritage (directory)
Permissions
prfixe:[utilisateur_ou_Groupe:]droits
alphorm.com
Supprimer
toutes les acls
$ setfacl -b fichier
une acl
$ setfacl x acl fichier
alphorm.com
Masque
droit maximal
Exemple :
mask:r-x
pierre:rw-
#effective:r--
alphorm.com
Hirarchie
masque
>acl utilisateur
>acl groupe
>acl g::
>posix groupe propritaire
LPIC1 / Comptia Linux+
alphorm.com
Ce quon a couvert
Comment grer les ACL Linux.
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Afficher
Modifier
alphorm.com
Introduction
droits par dfaut
fichier : 0666 rw-rw-rwdossier : 0777 rwxrwxrwx
alphorm.com
Afficher
format "classique"
$ umask -S
format octal
$ umask -p
alphorm.com
Modifier
$ umask mode
alphorm.com
Ce quon a couvert
Comment modifier les droits par dfauts la cration d'un fichier.
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Prrequis
Limitations
Initialiser, vrifier et mettre jour
Afficher
Editer
alphorm.com
Introduction
Linux est un systme multi-utilisateur
donc un utilisateur peu prendre tout l'espace de stockage
inodes
blocs
alphorm.com
Prrequis
kernel
CONFIG_QUOTAS=y
CONFIG_XFS_QUOTAS=y
alphorm.com
Limitations
deux types :
hard
soft
priode de "grce"
alphorm.com
prrequis
alphorm.com
Afficher
# repquota [-a] [fs]
# quota [Options]
Options
-a : all
-v : verbose
-g : quotas de groupes
-l : ignorer NFS
-q : seulement les fs sur lesquels les quotas sont dpasss
alphorm.com
Editer
# edquota [-t][[-u] user] [-g groupe]
alphorm.com
Ce quon a couvert
Comment mettre en place et administer les quotas Linux.
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Commande
Restrictions
Excuter une action
Operateurs conditionnels
alphorm.com
Introduction
analyse fichier par fichier
partir d'un ou plusieurs dossiers
nom, date de cration, etc
trs lent
flexible et efficace
alphorm.com
Commande
$ find [path ...] [expression ...]
Expression :
-name pattern : par nom
-perm mode : par permissions
-size n[c|k|M|G] : par traille
-gid GID ou group name : par groupe
-uid UID ou user name : par utilisateur
alphorm.com
Restrictions
$ find [path ...] [expression ...]
Restrictions :
-maxdepth levels : limiter le nombre de sous-rpertoires analyss
-type [b|c|d|p|f|l|s]
alphorm.com
Exemples :
$ find . -type f -exec ls -l {} \;
alphorm.com
Oprateurs conditionnels
-a : ET
$ find . \( -perm g=w -a -group root \)
-o : OU
$ find . \( -name '*.tex' -o -name '*.dvi' \)
! : ngation
$ find . ! -user root
alphorm.com
Ce quon a couvert
Comment utiliser find pour rechercher des fichiers.
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Mise jour
Commande
Autres implmentations
alphorm.com
Introduction
partir d'une DB
alphorm.com
Mise jour
# updatedb
alphorm.com
Commande
$ locate [options] [nom]
Options :
-i : ignorer la casse
-r regexp : utiliser une expression rgulire
-c : n'afficher que le nombre de fichiers correspondant
alphorm.com
Autres implmentations
mlocate
plus moderne
fonctionnement identique
slocate
scuris
empche les utilisateurs de voir les noms de fichiers auxquels ils n'ont pas
accs
le plus souvent, locate est un lien symbolique vers un de ces
programmes
alphorm.com
Ce quon a couvert
Comment rechercher un fichier avec locate.
alphorm.com
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
whereis
which
type
alphorm.com
whereis
recherche uniquement dans certains rpertoires
fichiers binaires
librairie et headers
pages man
configuration
etc
alphorm.com
whereis (2)
$ whereis [-bms] filename.
Options :
-b : seulement les fichiers binaires
-m : seulement les pages man
-s : seulement les sources
alphorm.com
which
$ which [-a] filename
Options :
-a : afficher toutes les correspondances
alphorm.com
type
$ type commande
Options :
-a : pour toutes les corrrespondance
-t : sortie raccourcie
alphorm.com
Ce quon a couvert
Obtenir des informations sur les commandes bash.
alphorm.com
Dmarrage du systme
dmarrage du systme
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Prsentation
alphorm.com
Prsentation
alphorm.com
Ce quon a couvert
Les diffrentes tapes du dmarrage d'un systme x86 fonctionnant
avec Linux.
alphorm.com
Dmarrage du systme
GRUB1
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Historique
Fonctionnement
Installation
Configuration
Options globales
Options par kernel image ou OS
Interaction
LPIC1 / Comptia Linux+
alphorm.com
Introduction
les bootloader Unix sont plus complexes que ceux de Windows
qui chargent simplement le kernel
kernel
alphorm.com
Historique
Eric Boleyn GNU/Hurd
1999 : premier paquet
deux version
trs diffrentes
alphorm.com
Fonctionnement
Stages (1 - 1.5 - 2)
alphorm.com
Installation
# grub-install disque_ou_partition
deux formats
dev : /dev/sda ou sda1
grub : '(hd0)' ou '(hd0,0)'
alphorm.com
Configuration
/boot/grub/menu.lst ou grub.conf
# grub.conf/menu.lst
#
# Global Options:
#
default=0
timeout=15
splashimage=/grub/bootimage.xpm.gz
#
# Kernel Image Options:
#
title Fedora (2.6.25)
root (hd0,0)
kernel /vmlinuz-2.6.25 ro root=/dev/hda5 mem=2048M
initrd /initrd-2.6.25
title Debian (2.6.26-experimental)
root (hd0,0)
kernel (hd0,0)/bzImage-2.6.26-experimental ro root=/dev/hda6
#
# Other operating systems
#
title DOS
rootnoverify (hd0,1)
chainloader +1
LPIC1 / Comptia Linux+
alphorm.com
Options globales
default=n
timeout=n
splashimage=chemin
alphorm.com
rootnoverify
chainloader
LPIC1 / Comptia Linux+
alphorm.com
Interaction
alphorm.com
Ce quon a couvert
Les spcificits d'un chargeur d'amorage orient Unix.
alphorm.com
Dmarrage du systme
GRUB2
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Installation
Configuration
Configuration des scripts grub.d
Mise jour
alphorm.com
Introduction
refonte totale
nombreux avantages
alphorm.com
Installation
partir de legacy
# update-from-grub-legacy
directement
# grub-install recheck "(hdX)"
# update-grub2
alphorm.com
Configuration
/etc/default/grub
/boot/grub/device.map
/etc/grub.d
alphorm.com
Grub2
title titre
menuentry "titre" {
root (hdX,X)
set root=(hdX,X)
kernel
linux
Restent inchangs :
initrd
chainloader
alphorm.com
Mise jour
mettre jour le fichier grub.cfg
# update-grub
alphorm.com
Ce quon a couvert
alphorm.com
Dmarrage du systme
init et les services
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Rappel
Init
Services
Script system V init
Commandes
alphorm.com
Rappel
alphorm.com
Init
premier et dernier processus
plusieurs solutions :
sysvinit
shell
upstart
systemd
initng
runit, svscan, minit
LPIC1 / Comptia Linux+
alphorm.com
Services
dmon(s)
excution en arrire plan
directement gr et lanc par init
alphorm.com
scripts bash
oprations :
start
stop
restart
status
alphorm.com
Commandes
lancer une commande sur un script system V init
$ service script commande [options]
alphorm.com
Ce quon a couvert
Ce qu'est (ou peu tre) init.
alphorm.com
Dmarrage du systme
runlevels
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Runlevels
inittab
rc
chkconfig
ntsysv
update-rc.d
Afficher et changer de runlevel
LPIC1 / Comptia Linux+
alphorm.com
Introduction
dtermine quels services sont lancs ou stopps
dans un contexte donn
li init
dernire tape du boot : runlevel par dfaut
alphorm.com
Runlevels
Run Level
Debian
amorage
RedHat
ARRET
mono-utilisateur au dmarrage
mono-utilisateur commut
mono-utilisateur
multi-utilisateur
Multi-utilisateur
dconnect
mode connect
(rseau)
multi-utilisateur
en mode
console
Suse
mode-graphique (X11)
redmarrage
alphorm.com
inittab
/etc/inittab
configuration de init
id:runlevels:action:process
alphorm.com
rc
script
/etc/init.d/rc
ou /etc/rc.d/rc
alphorm.com
chkconfig
Lister les associations services / runlevel
# chkconfig --list [service]
ajouter un service
# chkconfig --add service
alphorm.com
ntsysv
$ ntsysv [--level XXX]
TUI
par Red Hat
menu des services disponibles
alphorm.com
update-rc.d
dsactiver un service
# update-rc.d NomService remove
ajouter un service
# update-rc.d NomService defaults
alphorm.com
changer de runlevel
# init [0123456Qq]
# telinit [0123456Qq]
Eteindre ou redmarrer
# shutdown [-rhc] time ["Warning Message"]
# halt / # reboot / # poweroff
alphorm.com
Ce quon a couvert
Ce qu'est un runlevel.
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Etats standards
Etats particuliers
Hirarchie
alphorm.com
Introduction
programme en cours d'excution
plusieurs tats
cf. ordonnancement, multitche, etc
alphorm.com
Etats standards
alphorm.com
Etats particuliers
alphorm.com
Hirarchie
chaque processus a un "pre"
$ pstree
alphorm.com
Ce quon a couvert
Ce qu'est un processus.
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Options
Obtenir plus d'informations
Filtrer
Spcificateurs standards de format
Exemples concrets
alphorm.com
Introduction
"processes' status"
$ ps [options]
alphorm.com
Options
compatibilit
3 types :
Unix98
BSD
GNU long
alphorm.com
-f : full
-l ou l : long
-j ou j : job control
hirarchie :
-H, f ou forest
u : orient utilisateur
v : mmoire virtuelle
ne pas tronquer : -w ou w
LPIC1 / Comptia Linux+
alphorm.com
Filtrer
pour un utilisateur
RUID (real user id) : -U user ou --User user
EUID (effective user id) : -u user ou U user ou --user user
alphorm.com
Header
code
Header
user / euser
User / EUSER
tty / tt
TT
euid
EUID
tname
TTY
ruid
RUID
code
Header
ruser
RUSER
time / cputime
TIME
code
Header
%cpu
%CPU
pid
PID
ni / nice
NI
ppid
PPID
%mem
%MEM
alphorm.com
Exemples concrets
alphorm.com
Ce quon a couvert
processus.
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Prsentation
Commandes internes
alphorm.com
Prsentation
$ top [options]
Options
-d delay
-p pid
-n iter
dynamique
temps rel
alphorm.com
Commandes internes
commande
description
aide
tuer un processus
quitter
renice
alphorm.com
Ce quon a couvert
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Afficher les processus de votre session
Processus d'avant plan
Processus d'arrire plan
alphorm.com
alphorm.com
Pour ractiver :
$ fg [jobID]
alphorm.com
alphorm.com
Ce quon a couvert
Qu'est ce qu'un processus d'avant ou d'arrire plan.
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Lancer un processus avec une priorit donne
Modifier la priorit d'un processus
alphorm.com
Introduction
permet de favoriser plus ou moins l'accs des processus au matriel
seul root peu affecter une priorit ngative, et donc plus favorable
alphorm.com
Options
-X ou -n X ou --adjustement=X
par dfaut : 10
alphorm.com
un groupe
alphorm.com
Ce quon a couvert
Comment sont gres les priorits des processus.
alphorm.com
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Signaux
Envoyer un signal un processus
Envoyer un signal un groupe de processus
Lancer un programme persistant
alphorm.com
Introduction
communication interprocessus
POSIX
notification asynchrone
signaler l'apparition d'un vnement
alphorm.com
Signaux
cf man 7 signal et $ kill -l
SIGKILL (9)
SIGHUP (1)
SIGTERM (15
alphorm.com
alphorm.com
-i : interactif
alphorm.com
alphorm.com
Ce quon a couvert
Ce qu'est un signal.
Quels sont les principaux signaux connaitre.
alphorm.com
environnement graphique
Introduction
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Prsentation
alphorm.com
Prsentation
alphorm.com
Ce quon a couvert
La structure gnrale de l'environnement graphique Linux.
alphorm.com
environnement graphique
X Window System
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Historique
Moniteur
Fonctionnement
Carte graphique
Dmarrer le serveur X
Rsolution et profondeur de
Stopper le serveur X
Outils de configuration
couleur
Informations
Fichier de configuration
Modules
Priphriques d'entre
LPIC1 / Comptia Linux+
alphorm.com
Historique
Projet Athena : W
1983 : portage de W sur Unix
1984 : X1 - MIT (Bob Scheifler)
1987 : X11
1991 : X386 - bas sur X11R4
renomm XFree86 en 1992
2004 : X.Org Server
fork de XFree86 4.3
alphorm.com
Fonctionnement
client / serveur
via XDMCP (protocole rseau)
alphorm.com
Dmarrer le serveur X
via le terminal
$ startx
alphorm.com
Stopper le serveur X
Red Hat
$ init 3
alphorm.com
Outils de configuration
Red Hat
# system-config-display
Suse
# yast
Debian
# dpkg-reconfigure xserver-xorg
alphorm.com
Fichier de configuration
/etc/X11/xorg.conf
si absent : dtection du matriel chaque dmarrage
une section par fonctionnalit majeure
Section "..."
...
EndSection
Gnrer un fichier
# xorg -configure
alphorm.com
Modules
drivers
pour les fonctions ou matriels spcifiques
Exemple
Section Module
Load dbe
Load extmod
Load fbdevhw
EndSection
alphorm.com
Priphriques d'entre
Exemple 1 : clavier
Section InputDevice
Identifier Keyboard0
Driver kbd
Option XkbModel pc105
Option XkbLayout us
Option AutoRepeat 500 200
EndSection
Exemple 2 : souris
Section InputDevice
Identifier Mouse0
Driver mouse
Option Protocol IMPS/2
Option Device /dev/input/mice
Option Emulate3Buttons no
Option ZAxisMapping 4 5
EndSection
LPIC1 / Comptia Linux+
alphorm.com
Moniteur
Exemple
Section Monitor
Identifier Monitor0
ModelName VisionMaster Pro 450
HorizSync 27.0-115.0
VertRefresh 50.0-160.0
# My custom 1360x1024 mode
Modeline 1360x1024 197.8 \
1360 1370 1480 1752 \
1024 1031 1046 1072 -HSync -VSync
EndSection
alphorm.com
Carte graphique
Exemple
Section Device
Identifier Videocard0
Driver nv
VendorName nVidia
BoardName GeForce 6100
VideoRam 131072
EndSection
Drivers : /usr/X11R6/lib/modules/drivers
LPIC1 / Comptia Linux+
alphorm.com
alphorm.com
Informations
gnrales
$ xdpyinfo [-ext extension]
alphorm.com
Ce quon a couvert
Qu'est ce que X11, X.org et XFree86.
alphorm.com
environnement graphique
Display Manager
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Session locale
Session distante
Slectionner un gestionnaire d'affichage
Configuration de XDM
Configuration de KDM
Configuration de GDM
alphorm.com
Introduction
permet de dmarrer une session sur un serveur X
Nombreux et interchangeables
XDM : par dfaut pour X, rare pour les distributions
KDM : KDE
GDM : Gnome
LXDM : LXDE
etc
alphorm.com
Session locale
alphorm.com
Session distante
alphorm.com
DISPLAYMANAGER=KDM
Suse
/etc/sysconfig/displaymanager
DISPLAYMANAGER=kdm
Debian, Ubuntu
choix du sysvinit script
# dpkg-reconfigure gdm
LPIC1 / Comptia Linux+
alphorm.com
Configuration de XDM
/etc/X11/xdm/ ou /usr/X11R6/lib/X11/xdm/
xdm-config
configuration gnrale
Xaccress
htes autoriss pour une connection XDMCP distante
Xservers
htes (serveurs x) dlguant l'invite d'authentification notre machine
Xresources
proprits X utilises par les composants visuels
LPIC1 / Comptia Linux+
alphorm.com
Configuration de KDM
bas sur XDM
mmes fichiers de configuration
fonctionnalits supplmentaires : dossier kdm
/etc/X11/kdm/
/etc/kde/kdm/
/usr/share/config/kdm/
/usr/share/kde4/config/kdm/
pour la plupart : fichier kdmrc
type de session, extinction, etc
LPIC1 / Comptia Linux+
alphorm.com
Configuration de GDM
n'utilise pas les fichiers de configuration de XDM
dossier /etc/X11/gdm/
fichier gdm.conf - similaire kdmrc
commande
$ gdmconfig
alphorm.com
Ce quon a couvert
Ce qu'est un display manager.
Comment il fonctionne.
Comment le configurer.
alphorm.com
environnement graphique
accs distant
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Pr-requis
Mthode simple
XDM
KDM
GDM
autres solutions
alphorm.com
Pr-requis
iptables
Suse : /etc/sysconfig/displaymanager
DISPLAYMANAGER_XSERVER_TCP_PORT_6000_OPEN=yes
alphorm.com
Mthode simple
ajouter l'hte la liste des clients autoriss
xserver$ xhost +hotexclient
alphorm.com
XDM
xdm-config : commenter
!DisplayManager.requestPort: 0
alphorm.com
KDM
kdmrc
[Xdmcp]
Enable=true
alphorm.com
GDM
gdm.conf
DisallowTCP=false
[Xdmcp]
enable=yes
gdm.schemas
<key>security/DisallowTCP</key>
alphorm.com
Autres solutions
VNC
SSH
$ ssh -X hote
alphorm.com
Ce quon a couvert
Comment mettre en place un accs X distant.
alphorm.com
Impression
Introduction
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Ghostscript
Fonctionnement (local)
Spooling
CUPS
Autres solutions
Lancement du systme d'impression
alphorm.com
Introduction
anecdote : "une histoire d'imprimante"
PostScript
langage d'impression
vectoriel
standard Unix
alphorm.com
Ghostscript
1986 - L. Peter Deutsch
interprteur PS et PDF
alphorm.com
Fonctionnement (local)
alphorm.com
Spooling
simultaneous processing operations on line
concept n en 1958
file d'attente
mmoire tampon
alphorm.com
CUPS
Common Unix Printing System
dmon cupsd
alphorm.com
Autres solutions
rarement employes sous Linux
fonctionnement similaire
LPIC1 / Comptia Linux+
alphorm.com
pour vrifier
alphorm.com
Ce quon a couvert
Le fonctionnement du systme d'impression Unix.
alphorm.com
Impression
Gestion des tches
d'impression
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Soumettre une tche d'impression
Informations
Annuler une tche d'impression
alphorm.com
Options :
alphorm.com
Informations
Sur une file d'impression
$ lpq -P[]qeuename
lpstat
$ Sur
CUPS[-h hostname[:port]] [-p [imprimante(s)]]
alphorm.com
Options :
alphorm.com
Ce quon a couvert
Comment lancer une impression sous Linux.
les spools
les imprimantes
le serveur CUPS
alphorm.com
Impression
Configuration de CUPS
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Configurer les imprimantes
Fichiers PPD
Fichier de configuration
Interface web
alphorm.com
-p : ajouter ou modif
-x : supprimer
alphorm.com
Fichiers PPD
PostScript Printer Dfinition
description des caractristiques d'une imprimante PS
/etc/cups/ppd/*.ppd
fournis par :
CUPS (intgr)
package
http://www.linuxfoundation.org/en/OpenPrinting/Database/Foomatic
GIMP Print - Gut
CUPS Driver Development kit (HP & Epson)
constructeur
LPIC1 / Comptia Linux+
alphorm.com
Fichier de configuration
/etc/cups/cupsd.conf
Browsing On
BrowseAddess 192.168.1.255
<Location /printers>
Order Deny,Allow
Deny from All
BrowseAllow from 127.0.0.1
BrowseAllow from 192.168.1.0/24
BrowseAllow from @LOCAL
Allow from 127.0.0.1
Allow from 192.168.1.0/24
Allow from @LOCAL
</Location>
alphorm.com
Interface web
alphorm.com
Ce quon a couvert
Comment ajouter une imprimant.
alphorm.com
Administration systme
Gestion des utilisateurs et
groupes
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Nommage
Modifier un utilisateur
Groupes
UID et GID
Le fichier passwd
Le fichier group
Le fichier shadow
utilisateur
Supprimer un utilisateur
Ajouter un groupe
Modifier et supprimer un groupe
Le fichier gshadow
Ajouter un utilisateur
LPIC1 / Comptia Linux+
alphorm.com
Nommage
case sensitive
maximum 32 caractres
privilgier un maximum de 8
LPIC1 / Comptia Linux+
alphorm.com
Groupes
dfinition similaire aux utilisateurs
un utilisateur appartient
un groupe primaire
et ventuellement des groupes secondaires
$ newgrp groupe
alphorm.com
UID et GID
nombre identifiant
unique ???
0-99 : outils et fonctions spcifiques systme
0 : root
ex : 2 (Red Hat) daemon
100-500 ou 1000 : fonctions spcifiques lies la distribution
alphorm.com
Le fichier passwd
/etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/false
daemon:x:2:2:daemon:/sbin:/bin/false
adm:x:3:4:adm:/var/adm:/bin/false
lp:x:4:7:lp:/var/spool/lpd:/bin/false
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/bin/false
news:x:9:13:news:/usr/lib/news:/bin/false
uucp:x:10:14:uucp:/var/spool/uucppublic:/bin/false
operator:x:11:0:operator:/root:/bin/bash
ftp:x:21:21::/home/ftp:/bin/false
nobody:x:65534:65534:nobody:/:/bin/false
alias:x:501:501::/var/qmail/alias:/bin/bash
pierre:x:509:509:Pierre Feuille:/home/pierre:/bin/bash
paul:x:511:512:Paul Ogne:/home/paul:/bin/bash
jacques:x:511:509:Jacques Chirac:/home/jacques:/bin/bash
alphorm.com
Le fichier group
/etc/group
root:x:0:root
bin:x:1:root,bin,daemon
daemon:x:2:root,bin,daemon
sys:x:3:root,bin,adm
adm:x:4:root,adm,daemon
tty:x:5:
...
rv:x:500:
gdm:x:42:
jackuser:x:493:
nm-openconnect:x:492:
icecast:x:491:
stapdev:x:490:
stapusr:x:489:
oprofile:x:16:
stap-server:x:155:
ccache:x:488:
pierre:x:509:
paul:x:512:
LPIC1 / Comptia Linux+
alphorm.com
Le fichier shadow
/etc/shadow
root:$1$cJtWmhbX$1iCfb31CvckZiVDeae0Zx.:13383:0:99999:7:::
daemon:*:13383:0:99999:7:::
bin:*:13383:0:99999:7:::
sys:*:13383:0:99999:7:::
sync:*:13383:0:99999:7:::
games:*:13383:0:99999:7:::
man:*:13383:0:99999:7:::
proxy:*:13383:0:99999:7:::
www-data:*:13383:0:99999:7:::
nobody:*:13383:0:99999:7:::
dhcp:!:13383:0:99999:7:::
syslog:!:13383:0:99999:7:::
klog:!:13383:0:99999:7:::
cupsys:!:13383:0:99999:7:::
messagebus:!:13383:0:99999:7:::
haldaemon:!:13383:0:99999:7:::
hplip:!:13383:0:99999:7:::
paul:$1$tgS/4j6v$D9dP0cyqc6QydDOQDAiPm.:13383:0:99999:7:::
LPIC1 / Comptia Linux+
alphorm.com
Le fichier gshadow
/etc/gshadow
general:!!:shelley:juan,bob
alphorm.com
Ajouter un utilisateur
# useradd [-c commentaire] [-d rp_perso] [-e date_expiration] [-f
inactive_time] [-g groupe_initial] [-G groupe[,...]] [-m [-k
rp_squelette] | -M] [-p mot_de_passe] [-s shell] [-u uid [ -o]]
[-n] [-r] login
alphorm.com
Modifier un utilisateur
$ usermod [options] [-d repertoire [-m]] [-l login] [-L] [-U] login
Options
similaires useradd
alphorm.com
alphorm.com
Supprimer un utilisateur
alphorm.com
Ajouter un groupe
# groupadd [-g GID [-o]] [-r] [-f] groupname
alphorm.com
suppression
# groupdel nom
alphorm.com
Ce quon a couvert
Comment administrer les utilisateurs et groupes sous Linux.
alphorm.com
Administration systme
Logs
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Historique
Concept
Implmentations
Niveaux
Facilits
Configuration
Analyse
Log manuel
LPIC1 / Comptia Linux+
alphorm.com
Introduction
journalisation ou logging
enregistrement squentiel
dans un fichier
journal ou log file
alphorm.com
Historique
80s - Eric Allman
Projet Sendmail
rapidement un standard de fait
GNU/Linux
Unix
priphriques rseau
alphorm.com
Concept
client - serveur
UDP 514
centralisation
via un socket
alphorm.com
Implmentations
syslogd + klogd
historique
LPIC1 3.5
Debian 4.0
syslog-ng
rsyslog
alphorm.com
Niveaux
dfinie l'importance du message
debug, info, notice, warning (warn), err (error), crit, alert, emerg (panic)
alphorm.com
Facilits
dfinie l'origine (programme ou outil) gnrant le message
auth (security)
authpriv, cron, kern, lpr, mail, news, syslog, user, uucp
local0 local7
daemon
mark
*
LPIC1 / Comptia Linux+
alphorm.com
Configuration
/etc/syslog.conf
format
secteur1;secteur2
facilit.priorit
action
action
Exemples
mail.*
*.emerg
kern.*
kern.crit
kern.crit
kern.info;kern.!err
LPIC1 / Comptia Linux+
/var/log/mail
*
/var/log/kernel
@logger.pangaea.edu
/dev/console
/var/log/kernel-info
alphorm.com
Analyse
/var/log/
format courant
time hte identifiant[pid]: info
Exemples
Apr 14 23:17:00 speaker /USR/SBIN/CRON[6026]: (george) CMD
(/usr/bin/fetchmail -f /home/george/.fetchmailrc > /dev/null)
Apr 14 23:17:52 speaker sshd[6031]: Accepted publickey for george
from ::ffff:192.168.1.3 port 48139 ssh2
alphorm.com
Log manuel
$ logger [-isd] [-f file] [-p pri] [-t tag] [-u socket] [message
...]
alphorm.com
Ce quon a couvert
Ce qu'est syslog.
alphorm.com
Administration systme
Maintenir le temps systme
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Configuration
Modifier et consulter l'horloge systme
Modifier et consulter l'horloge matrielle
alphorm.com
Introduction
2 horloges
hardware
software
temps local
peu adapt pour le WAN
LPIC1 / Comptia Linux+
alphorm.com
Configuration
/etc/localtime
fichier binaire
copie ou lien symbolique vers
/usr/share/zoneinfo/
Debian : /etc/timezone
Fedora : /etc/sysconfig/clock
alphorm.com
Options
alphorm.com
modifier
et inversement
$ hwclock -W
alphorm.com
Ce quon a couvert
Comment est gr le temps sous Linux.
alphorm.com
Administration systme
cron
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Cron : dmonstration
alphorm.com
Introduction
issu de Unix V7
Brian Kernighan
extrmement sommaire
mono-utilisateur (root)
adapt pour Unix System V
multi-utilisateur
moderne
LPIC1 / Comptia Linux+
alphorm.com
Cron : dmonstration
alphorm.com
Ce quon a couvert
Comment administrer cron.
alphorm.com
Administration systme
anacron
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Dmonstration
alphorm.com
Introduction
alphorm.com
Dmonstration
alphorm.com
Ce quon a couvert
Configurer anacron.
alphorm.com
Administration systme
Gestion des interfaces rseaux
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Modle OSI
Commandes
Interfaces
Lister les interfaces
Modifier une adresses MAC
Activation et dsactivation d'une interface
Wi-Fi : association
Wi-Fi : scurit
wpa_supplicant : configuration
LPIC1 / Comptia Linux+
alphorm.com
Modle OSI
Type de
Donne
Couches
Hautes
Donne
Segment /
Datagramme
Couches Paquet
Matrielles Trame
Bit
LPIC1 / Comptia Linux+
couche
Protocoles
7. Application
6. Prsentation
5. Session
4. Transport
TCP / UDP
3. Rseau
2. Liaison
1. Physique
alphorm.com
Commandes
solutions historique
#
route [options]
ip [ OPTIONS
] OBJECT { COMMAND | help }
# solution
moderne
alphorm.com
Interfaces
terme cl - numro (cf. udev)
alphorm.com
ip link
list
$ avec
iproute2
avec lshw
alphorm.com
ip link
set dev <dev> address <adresse_mac>
# avec
iproute2
alphorm.com
ip link
set dev <dev> up
# avec
iproute2
# ip link set dev <dev> down
# ifup <dev>
alphorm.com
Wi-Fi : association
Lister les rseaux accessibles :
$ iwlist wlan0 scan
Sassocier un rseau :
# iwconfig wlan0 essid <SSID>
alphorm.com
Wi-Fi : scurit
rseau ouvert
# iwconfig wlan0 key open
WEP
# iwconfig wlan0 key <cl wep>
WPA
$ wpa_supplicant -c mon_wpa.conf -i wlan0
alphorm.com
wpa_supplicant : configuration
mon_wpa.conf
network={
ssid="<SSID du rseau>"
proto=WPA RSN
key_mgmt=WPA-PSK
psk="<mot de passe>"
}
alphorm.com
Ce quon a couvert
Configuration rseaux GNU/Linux en lien avec la couche liaison son
modle OSI :
interfaces
adresses MAC
Wi-Fi
alphorm.com
Administration systme
Adressage IP
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Modle OSI
Introduction au DHCP
Les clients DHCP
Adressage IP statique avec ifconfig
Adressage IP statique avec iproute2
Configuration persistante
alphorm.com
Modle OSI
Type de
Donne
Couches
Hautes
Donne
Segment /
Datagramme
Couches Paquet
Matrielles Trame
Bit
LPIC1 / Comptia Linux+
couche
Protocoles
7. Application
6. Prsentation
5. Session
4. Transport
TCP / UDP
3. Rseau
2. Liaison
1. Physique
alphorm.com
Introduction au DHCP
protocole client / serveur
couches 3 et 7
adressage ip dynamique
requte broadcast
alphorm.com
pump interface
$ Autres
outils
$ dhcpcd interface
alphorm.com
# Exemples
ifconfig eth0 192.168.10.20
# ifconfig eth0 192.168.1.20 netmask 255.255.255.0
# ifconfig eth0 192.168.1.20 netmask 255.255.255.0 broadcast
192.168.1.255
alphorm.com
alphorm.com
Configuration persistante
/etc/network/interfaces
/etc/sysconfig/
network : gnral
network-script/ifcfg-* : un par interface
alphorm.com
Ce quon a couvert
Comment allouer une adresse IP vos interfaces rseaux.
alphorm.com
Administration systme
Route
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Modle OSI
Vrifier
Ajouter et supprimer
MTU et TTL
alphorm.com
Modle OSI
Type de
Donne
Couches
Hautes
Donne
Segment /
Datagramme
Couches Paquet
Matrielles Trame
Bit
LPIC1 / Comptia Linux+
couche
Protocoles
7. Application
6. Prsentation
5. Session
4. Transport
TCP / UDP
3. Rseau
2. Liaison
1. Physique
alphorm.com
Vrifier
Exemple :
# route -n
alphorm.com
Ajouter et supprimer
Ajouter avec route
# route add -net 172.20.10.0/24 gw 192.168.1.1
# Supprimer
route del avec
-net route
172.20.10.0/24 gw 192.168.1.1
alphorm.com
MTU et TTL
Changer le mtu et le ttl dune route existante :
# ip route change default via 10.0.0.1 dev eth0 mtu 500 hoplimit 10
alphorm.com
Ce quon a couvert
Configurer basique du routage GNU/Linux.
alphorm.com
Administration systme
ARP
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Modle OSI
Commande arp
iproute2
alphorm.com
Modle OSI
Type de
Donne
Couches
Hautes
Donne
Segment /
Datagramme
Couches Paquet
Matrielles Trame
Bit
LPIC1 / Comptia Linux+
couche
Protocoles
7. Application
6. Prsentation
5. Session
4. Transport
TCP / UDP
3. Rseau
2. Liaison
1. Physique
alphorm.com
Commande arp
Ajout dune entre statique :
$ arp -s 192.168.1.2 00:40:33:2D:B5:DD
arp -d 192.168.1.2
$ Suppression
dune entre :
arp -va
$ Lister
les entres :
alphorm.com
iproute2
Affficher la table :
$ ip neigh show
alphorm.com
Ce quon a couvert
Ajouter et supprimer des entres ARP statiques.
alphorm.com
Administration systme
Rsolution de nom
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Modle OSI
Fichier hosts
Configuration des solutions de rsolution
Nom d'hte
Spcifier les serveurs DNS
alphorm.com
Modle OSI
Type de
Donne
Couches
Hautes
Donne
Segment /
Datagramme
Couches Paquet
Matrielles Trame
Bit
LPIC1 / Comptia Linux+
couche
Protocoles
7. Application
6. Prsentation
5. Session
4. Transport
TCP / UDP
3. Rseau
2. Liaison
1. Physique
alphorm.com
Fichier hosts
/etc/hosts
entres statiques
alphorm.com
alphorm.com
Nom d'hte
Consultation et modification dynamique
$ hostname [nouveaunom]
Modification persistente
/etc/hostname
alphorm.com
alphorm.com
Ce quon a couvert
Configuration de la rsolution de nom sous GNU/Linux.
alphorm.com
Connaissances
complmentaires
Introduction au scripting bash
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Rappel : variables
Shebang
Sortie
Test
Expressions mathmatiques
Composition
Alternatives :
si - sinon
Selon
Boucles :
Pour
Tant que
Lecture depuis lentre
standard
Lancement
alphorm.com
Introduction
automatiser
comprendre
alphorm.com
Rappel : variables
dclaration
mavariable="valeur"
paramtres de position : $#, $@, $*, $0, $1, $2, $3, etc
alphorm.com
Shebang
Premire ligne d'un script
Indique qu'un fichier est un script
Suivit de l'interprteur
Exemples :
#!/bin/sh -x
#!/bin/bash
#!/usr/bin/perl
#!/usr/bin/tcl
#!/bin/sed -f
#!/usr/awk -f
alphorm.com
Sortie
exit [valeur]
alphorm.com
Test
test expression
ou
[ expression ]
Exemples
[ 2 -lt 3 ]
[ "$var1" != "$var2" ]
[ -x /bin/bash ]
alphorm.com
Expressions mathmatiques
calculer et afficher le rsultat sur la sortie standard
expr expression
expression
let
excuter
une opration
((expression))
ou
alphorm.com
Composition
squentielle : cmd1 ; cmd2
parallle : cmd1 & cmd2
sur erreur (ou) : cmd1 || cmd2
sur succs (et) : cmd1 && cmd2
alphorm.com
Alternatives : si - sinon
if test
then
instructions
elif test
then
instructions
else
instructions
fi
alphorm.com
Alternatives : Selon
case variable in
expr)
instructions
;;
esac
alphorm.com
Boucles : Pour
for var in [liste]
do
done
Exemple :
for (( i=1 ; i<=5 ; i++ ))
do
echo $i
done
alphorm.com
done
alphorm.com
alphorm.com
Lancement
$ ./script
$ bash script
alphorm.com
Ce quon a couvert
Comment s'crit un script bash.
Comment lancer un script bash.
alphorm.com
Connaissances
complmentaires
Introduction la gestion de
bases de donnes
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
SGBD
Installer
Types de donne
Gestion des bases de donnes
Crer une table
Ajouter un enregistrement
Clauses
WHERE
GROUP BY
ORDER BY
Modifier des enregistrements
Supprimer des enregistrements
Combiner des tables
avec JOIN
alphorm.com
Introduction
Structured Query Language
manipulation
dfinition de donnes
contrle de transaction
contrle de donnes
alphorm.com
SGBD
MySQL
MariaDB
PostgreSQL
SQLite
Oracle
etc
LPIC1 / Comptia Linux+
alphorm.com
Installer
MariaDB
https://downloads.mariadb.org/mariadb/reposito
ries/
# apt-get install mysql-server mysql-client
MySQL
# apt-get install postgresql postgresql-client
PostgreSQL
alphorm.com
Types de donnes
Type
Description
INTEGER (INT)
SMALLINT
DECIMAL(X,Y)
NUMERIC
FLOAT
DOUBLE
DATETIME
date et heure
DATE
date
TIME
temps (HH:MM:SS)
CHAR(X)
VARCHAR(X)
ENUM('a','b','c')
liste numre
SET('a','b','c')
alphorm.com
SHOW
Afficher
les bases de donnes
DATABASES;
USE
Utiliser
une base de donnes
nom;
alphorm.com
Exemple
CREATE TABLE matable ( id INT NOT NULL auto_increment, nom
varchar(255) NOT NULL, prenom varchar(255) NOT NULL, date DATE
DEFAULT 0000-00-00' NOT NULL, PRIMARY KEY (id));
alphorm.com
Ajouter un enregistrement
INSERT INTO nom_de_la_table [(liste des colonnes)] SELECT ...
Exemple
INSERT INTO objects VALUES(lizard,green,6,soft,10.00);
alphorm.com
Exemples
SELECT * FROM objects;
SELECT value,color FROM objects;
alphorm.com
Clause WHERE
permet de n'affecter qu'une partie des enregistrements
alphorm.com
Clause GROUP BY
groupement des enregistrements
Exemple
alphorm.com
Clause ORDER BY
trier
Exemple
alphorm.com
Exemple
UPDATE objects SET size=5 WHERE name=lizard;
alphorm.com
Exemple
DELETE FROM locations WHERE name=tree AND location=back yard ;
alphorm.com
alphorm.com
Ce quon a couvert
Qu'est ce qu'une base de donne.
alphorm.com
Connaissances
complmentaires
Gestion des e-mails
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Fonctionnement
Solutions
Envoyer un e-mail
Consulter vos e-mails
Redirections
alphorm.com
Introduction
un des services rseau les plus important
alphorm.com
Fonctionnement
alphorm.com
Solutions
Sendmail
Postfix
Exim
qmail
alphorm.com
Envoyer un e-mail
alphorm.com
alphorm.com
# mailq
# sendmail -bq
quivalent de :
alphorm.com
Redirections
/etc/aliases ou /etc/mail/aliases
name: addr1[,addr2[,...]]
adresses
nom local
fichier
| commande
alphorm.com
Ce quon a couvert
Comment fonctionne le mailing.
Quelles sont les diffrents MTA disponibles sous GNU/Linux.
alphorm.com
Scurit
Scurit rseau
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Rechercher les ports ouverts sur un serveur
Les super-serveurs
Inetd
Xinetd
Scuriser xinetd
TCP Wrapper
Configuration du TCP Wrapper
LPIC1 / Comptia Linux+
alphorm.com
Introduction
ncessit de grer les diffrents services
alphorm.com
$ UDP
nmapscan
-sU hostname
# lsof -i [46][protocol][@hostname|hostaddr][:service|port]
alphorm.com
/etc/inittab
/etc/init.d
fichiers de configuration du super-serveur
alphorm.com
Les super-serveurs
alphorm.com
inetd
InterNET Daemon
/etc/inetd.conf + /etc/inetd.d/
service socket protocol (no)wait utilisateur programme args
Exemple
alphorm.com
xinetd
eXtended InterNET Daemon
plus scuris
/etc/xinetd.conf + /etc/xinetd.d/
Exemple
service ftp
{
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/sbin/in.ftpd
server_args = -l
disable = yes
}
LPIC1 / Comptia Linux+
alphorm.com
Scuriser xinetd
bind = adresse-IP
only-from = adresse-IP
no-access = adresse-IP
access-time = hh:mm-hh:mm
alphorm.com
TCP Wrapper
alphorm.com
daemon-list : cf /etc/services
client-list : nom ou adresse IP
hte
rseau
ALL
alphorm.com
Ce quon a couvert
sujet 110-01 : Effectuer des tches d'administration de scurit
alphorm.com
Scurit
Scurit systme
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Bonnes pratiques pour les mots de passe
Limiter l'accs root
Sudo
Configuration de sudo
Configuration de sudo : Exemple
Limiter l'usage des ressources
Configuration de pam_limits
Commande ulimit
Fichier nologin
Localiser les fichiers avec SUID/SGID
alphorm.com
alphorm.com
$ su -c "commande"
alphorm.com
Sudo
alphorm.com
Configuration de sudo
/etc/sudoers
ident
# visudo
alphorm.com
alphorm.com
pam_limits
alphorm.com
Configuration de pam_limits
/etc/security/limits.conf
domain type item value
Exemple
@limited hard cpu 2
alphorm.com
Commande ulimit
commande interne bash
# ulimit [options [limit]]
Options
fichiers : -c -f -n
processus : -u -t
mmoire : -v -s -m -d -l
limitations : -H -S
LPIC1 / Comptia Linux+
-a
alphorm.com
Fichier nologin
/etc/nologin
pour maintenance
Authentification dsactive jusqu' 14h pour maintenance.
Simple message
alphorm.com
Exemple
# find / -perm +6000 -type f
alphorm.com
Ce quon a couvert
Sujet 110.1 : Effectuer des tches d'administration de scurit
Scurit
SSH
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Connexion du client
Copie de fichiers
Configuration basique du serveur
Comprendre le rle des cls SSH
Gestion des cls SSH
Enregistrement des cls d'hte
Cls d'authentification
Transfert de ports
Mise en uvre
LPIC1 / Comptia Linux+
alphorm.com
Introduction
Telnet, VNC, X, etc
en clair
SSH : encryption
OpenSSH
alphorm.com
Connexion du client
Syntaxe
$ ssh [options] [-F configfile] [-i identity_file] [-l login_name]
[-p port] [user@]hostname [command]
Exemple
$ ssh admin1@linuxserver
Configuration :
/etc/ssh/ssh-config
/.ssh/config
LPIC1 / Comptia Linux+
alphorm.com
Copie de fichiers
Syntaxe
$ scp mylocalfile user@server:remotefile
$ scp user@server:remotefile mylocalfile
Exemple
$ scp archive.tar.gz bernard@192.168.1.1:mesarchives/archive.tar.gz
alphorm.com
Port 22
Protocol 2,1
ListenAddress 0.0.0.0
KeepAlive Yes
HostKey ssh_host_dsa.key
HostKey ssh_host_rsa.key
PermitRootLogin no
PasswordAuthentication yes
PubkeyAuthentication yes
PermitEmptyPasswords no
X11Forwarding yes
alphorm.com
alphorm.com
alphorm.com
message
~/.ssh/known_hosts
/etc/ssh_known_hosts ou /etc/ssh/ssh_known_host
alphorm.com
Cls d'authentification
gnration des cls
client$ ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -C -N
ajout de la cl
serveur$ cat ~/temp.rsa >> ~/.ssh/authorized_keys
alphorm.com
alphorm.com
Transfert de ports
alphorm.com
Client
# ssh -N -f -L 2000:destination:143 user@serveurssh.com
alphorm.com
Ce quon a couvert
Sujet 110.3 : Scuriser des changes rseau avec le cryptage
Utilisation et configuration d'un client OpenSSH 2.
~/.ssh/authorized_keys
/etc/ssh_known_hosts
alphorm.com
Scurit
GnuPG
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Plan
Introduction
Chiffrement par cls symtriques
Chiffrement par cls symtriques : pratique
Chiffrement par cls asymtriques
Signature : thorie
Gnration de cls asymtriques
Certificat de rvocation
Fingerprint
Gestion des cls
Signature
alphorm.com
Introduction
GNU Privacy Guard
alphorm.com
alphorm.com
dchiffrer
$ gpg -o fichier -d fichier.gpg
alphorm.com
alphorm.com
Signature : thorie
alphorm.com
interactif
chiffrement
longueur
temps
identit
passphrase
alphorm.com
Certificat de rvocation
$ gpg --output revoke.asc --gen-revoke name
alphorm.com
Fingerprint
$ gpg --fingerprint name
"empreinte digitale"
alphorm.com
import
$ gpg --import filename
lister
$ gpg --list-keys
supprimer
$ gpg --delete-key name
LPIC1 / Comptia Linux+
alphorm.com
Signature
signer
$ gpg --clearsign original-file
import
$ gpg --verify received-file
alphorm.com
Ce quon a couvert
Sujet 110.3 Scuriser des changes rseau avec le cryptage
alphorm.com
Conclusion
Conclusion
Site : http://alphorm.com
Blog : http://alphorm.com/blog
Forum : http://alphorm.com/forum
LPIC1 / Comptia Linux+
Nol Mac
Formateur et Consultant indpendant
Expert Unix et FOSS
Contact : alphorm@noelmace.com
alphorm.com
Au revoir
Et bientt, pour la LPIC2 et bien d'autres sujets !
alphorm.com