Services
Gestion des scripts qui sont dans '/etc/init.d':
Uniquement pour la session en cours:
$ su -c "service nom_du_service [ start | stop | restart | status ]"
De facon permanente:
$ su -c "chkconfig nom_du_service [ on | off | --list ]"
Graphique:
$ su -c "drakxservices"
Niveau de sécurité 4
On a plus accès au menu,
root$ drakperm
Ajouter une règle personnalisé pour l'utilisateur: /usr/share/applnk/Settings/ en lecture
Nano
Éditeur de fichier en remplacement de vi.
Configuration
Éditez le fichier .nanorc ou /etc/nanorc
Exemple de configuration avec couleurs personnalisées
## Sample initialization file for GNU nano ## To make sure a value is not enabled, use "unset <option>" ## Backup files to filename~ set backup ## Allow nano to be suspended with ^Z set suspend ## Enable ~/.nano_history for saving and reading search/replace strings. set historylog ###### Here is an example for * syntax "*" "$" ## highlight possible errors and parameters color brightwhite "^ *(set|unset|syntax|color).*$" ## set, unset and syntax #color cyan "^ *(set|unset) +(autoindent|backup|backupdir|brackets|const|cut|fill|historylog|morespace|mouse|multibuffer|noco$ #color green "^ *(set|unset|syntax)\>" ## colors #color yellow "^ *color +(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magent$ color magenta "^ *color\>" "\<(start|end)=" ## strings color white "\"(\\.|[^\"])*\"" ## comments color green "^ *#.*$" ###### Here is an example for c-file syntax "c-file" ".*\.c$" ".*\.h$" color red "\<[A-Z_]{2,}\>" color green "\<float\>" "\<char\>" "\<int\>" "\<void\>" color green "\<static\>" "\<const\>" "\<struct\>" color magenta "\<if\>" "\<while\>" "\<do\>" "\<else\>" "\<case\>" "\<switch\>" color brightcyan "#define" "#include" "#ifn*def" "#endif" color brightcyan "#elif" "#else" "#if" ###### Here is an example for HTML syntax "HTML" "[\.]*html$" color blue start="<" end=">" color red "&([^; ])*;" ###### Here is an example for TeX files syntax "TeX" "\.tex$" color green "\\(.|([A-Za-z]*))" color magenta "\{" "\}" color blue "%.*" ###### Here is an example for Java source syntax "Java source" "[\.]*java$" color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>" color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>" color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>" color red ""[^\"]*"" color yellow "\<(true|false|null)\>" color blue "//.*" color blue start="/\*" end="\*/" color brightblue start="/\*\*" end="\*/" #color brightgreen, brightgreen "[ ]+$" ###### Here is an example for perl syntax "perl" "\.p[lm]$" color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork)|get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join|keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek|seekdir|se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr|y|truncate|umask|un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>" color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>" color cyan start="[$@%]" end="( |\\W|-)" color yellow "".*"|qq\|.*\|" color white "[sm]/.*/" color white start="(^use| = new)" end=";" color green "#.*" color yellow start="<< 'STOP'" end="STOP" ###### Here is an example for pkgbuild syntax "pkgbuild" "^.*PKGBUILD$" color green start="^" end="$" color cyan "^.*(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces).*=.*$" color brightcyan "\<(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces)\>" color cyan "\.install" color brightwhite "=" "'" "\(" "\)" "\"" "#.*$" "\," "\{" "\}" color brightcyan "(\$|\$\{|\$\()(pkgname|pkgver|pkgrel|pkgdesc|force|url|license|install|source|md5sums|groups|backup|depends|makedepends|conflicts|provides|replaces|startdir)(|\}|\))" color brightred "build\(\)" color brightred "\<(configure|make)\>" color red "\<(DESTDIR|PREFIX|prefix|sysconfdir|datadir|libdir|includedir|mandir)\>" ###### Here is an example for PHP #syntax "php" "\.php[2345s~]?$" syntax "php" "[\.]*php$" "[\.]*tpl$" color brightblue "(.*)\(" color blue "\$[a-zA-Z_0-9$]*|[=!<>]" color brightblue "[0-9]" color brightred "([^A-Za-z0-9])|[^A-Za-z](null|array|int|string|float|bool|object|resource)[^A-Za-z0-9_]+[^A-Za-z]" color green "(^|[^A-Za-z0-9])(<\?php|\?>|var|and|or|default|class|extends|true|false|global|function|new|switch|case|break|next|prev|elseif|if|else|foreach|for|as|do|while|exit|die|declare|require_once|require|include_once|include|return|echo|static|array|isset)([^A-Za-z0-9])" color cyan "\$[]\[A-Za-z0-9_][^\\][^-\,()\"\'[:space:]]*" color green "[.,{}();]" color red "('.*')|(\".*\")" color magenta "(#.*|//.*)$" color magenta start="/\*" end="\*/" color brightblue "(<\?(php)?|\?>)" color white start="\?>" end="<\?(php)?" ###### Here is an example for patch syntax "patch" "\.(patch|diff)$" color brightgreen "^\+.*" color green "^\+\+\+.*" color brightblue "^ .*" color brightred "^-.*" color red "^---.*" color brightyellow "^@@.*" color magenta "^diff.*" ###### Here is an example for *ml syntax "ml" ".*\.([jrs]?html?|xml|sgml?)$" color white "^.+$" color green start="<" end=">" color cyan "<[^> ]+" color cyan ">" color yellow start="<!DOCTYPE" end="[/]?>" color yellow start="<!--" end="-->" color red "&[^;]*;" ###### Here is an example for xorg.conf syntax "xorg" "xorg\.conf$" color brightwhite "(Section|EndSection|Sub[sS]ection|EndSub[sS]ection)" # keywords color yellow "[^A-Za-z0-9](Identifier|Screen|InputDevice|Option|RightOf|LeftOf|Driver|RgbPath|FontPath|ModulePath|Load|VendorName|ModelName|BoardName|BusID|Device|Monitor|DefaultDepth|View[pP]ort|Depth|Virtual|Modes|Mode|DefaultColorDepth|Modeline|\+vsync|\+hsync|HorizSync|VertRefresh)[^A-Za-z0-9]" # numbers color magenta "[0-9]" # strings color green ""(\\.|[^\"])*"" # comments color white "#.*" ###### Here is an example for conf/rc/sh syntax "conf/rc/sh" "conf$|rc$|sh$" color white ".+" color green "^#.*" ###### Here is an example for ebuilds/eclasses syntax "ebuild" "\.e(build|class)$" # All the standard portage functions color brightgreen "^src_(unpack|compile|install)" "^pkg_(config|nofetch|setup|(pre|post)(inst|rm))" # Highlight bash related syntax color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>" color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)" color green "-(e|d|f|r|g|u|w|x|L)\>" color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>" # Highlight variables ... official portage ones in red, all others in bright red color brightred "\$\{?[a-zA-Z_0-9]+\}?" color red "\<(ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|FILESDIR|WORKDIR|(P|R)?DEPEND|PROVIDE|DISTDIR|RESTRICT)\>" color red "\<(S|D|T|PV|PF|P|PN|A)\>" "\<C(XX)?FLAGS\>" # Highlight portage commands color magenta "\<use(_(with|enable))?\> [a-z0-9X ]*" "inherit.*" color brightblue "e(begin|end|conf|install|make|warn|infon?|error|patch)" color brightblue "\<die\>" "\<use(_(with|enable))?\>" "\<inherit\>" "\<has\>" "\<(has|best)_version\>" "\<unpack\>" color brightblue "\<(do|new)(ins|s?bin|doc|lib(|\.so|\.a)|man|info|exe)\>" color brightblue "\<do(python|sed|dir|hard|sym|html|jar|mo)\>" "\<keepdir\>" color brightblue "prepall(|docs|info|man|strip)" "prep(info|lib|lib\.so|man|strip)" color brightblue "\<(|doc|ins|exe)into\>" "\<f(owners|perms)\>" "\<(exe|ins)opts\>" # Highlight common commands used in ebuilds color blue "\<make\>" "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|let|ln|mkdir|mv|rm|sed|set|tar|touch|unset)\>" # Highlight comments (doesnt work that well) color yellow "#.*$" # Highlight strings (doesnt work that well) color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'" ###### Here is an example for shell scripts syntax "shellscript" "[\.]*sh$" color brightgreen "^[a-zA-Z_0-9]+\(\)" color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>" color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)" color green "-(e|d|f|r|g|u|w|x|L)\>" color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>" color brightblue "\<make\>" "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>" color brightred "\$\{?[a-zA-Z_0-9]+\}?" color yellow "#.*$" color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'" ###### Here is an example for manpages #syntax "manpage" "\.[1-9]x?$" #color green "\.(S|T)H.*$" #color brightgreen "\.(S|T)H" "\.TP" #color brightred "\.(BR?|I[PR]?).*$" #color brightblue "\.(BR?|I[PR]?|PP)" #color brightwhite "\\f[BIPR]" #color yellow "\.(br|DS|RS|RE|PD)" ###### Here is an example for * #syntax "*" "$" ## highlight possible errors and parameters #color brightwhite "^ *(set|unset|syntax|color).*$" ## set, unset and syntax #color cyan "^ *(set|unset) +(autoindent|backup|backupdir|brackets|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quotestr|rebinddelete|regexp|smarthome|smooth|speller|suspend|tabsize|tempfile|view|whitespace)" #color green "^ *(set|unset|syntax)\>" ## colors #color yellow "^ *color +(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magenta|cyan))?\>" #color magenta "^ *color\>" "\<(start|end)=" ## strings #color white "\"(\\.|[^\"])*\"" ## comments #color green "^ *#.*$" ###### Here is an example for nanorc syntax "nanorc" "[\.]*nanorc$" color white "^ *(set|unset).*$" color cyan "^ *(set|unset) (autoindent|backup|const|cut|fill|keypad|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|quotestr|regexp|smooth|speller|suspend|tabsize|tempfile|historylog|view)" color brightwhite "^ *syntax [^ ]*" color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>" color white "^ *color\>.*" color yellow "^ *color (bright)?(white|black|red|blue|green|yellow|magenta|cyan)\>" color magenta "^ *color\>" color green "^#.*$" ###### Here is an example for urls syntax "urls" color brightmagenta "^.*$" color cyan "^(1[0-9][0-9]|20[256]|30[45]).*$" color green "^20[03].*$" color brightyellow "^(201|30[0-37]).*$" color brightred "^(204|[45][0-9][0-9]|666).*$" ###### Here is an example for css syntax "css" "\.css$" color brightred "." color magenta start="\{" end="\}" color brightwhite start=":" end="[;^\{]" color brightblue ":active|:focus|:hover|:link|:visited|:link|:after|:before|$" color brightblue start="\/\*" end="\\*/" color green ";|:|\{|\}"
JAVA
Instalation sur Debian Sarge
les outils nécéssaires
$aptitude install fakeroot java-package
Télécharger Java
Création et instalation du paquet
#Toujours répondre yes $fakeroot make-jpkg jdk-numéro_de_version-linux-i586.bin #Instalation du paquet créer $dpkg -i sun-j2sdk-numéro_de_version_i586.deb #Test $java -version
Serveur de son
Pulse Audio
Commandes
#Liste des modules $ pulseaudio --dump-modules #Voir les processus qui tournent $ ps aux | grep pulse #Tuer les processus $ pulseaudio -k
Serveur de version
GIT
Git est un gestionnaire de version décentralisé comme GNU Arch ou Monotone (ou Bitkeeper dans le monde propriétaire). Chaque répertoire de travail est un vrai dépôt git (avec toutes les fonctionnalités), il ne dépend pas du réseau et donc d'un serveur centrale.
Subversion
Définition
Subversion est un VCS, Version Control System, ou logiciel de gestion de version. C'est un logiciel qui permet à plusieurs développeurs de travailler sur un même projet, voir sur un même fichier simultanément. Il est responsable de la gestion des accès concurrents, ou plus exactement des modifications concurrentes sur un même fichier. De plus si les modifications ne sont pas conflictuelles, Subversion assure la fusion de celles-ci afin d'avoir au final une version du projet qui comprend toutes les modifications. source: hikage.developpez.com
Installation de Subversion et Apache 2
$ aptitude install subversion libapache2-svn subversion-tools
Gestion d'un dépôt
le répertoire de base des dépôts sera /var/lib/svn/repository
$ mkdir -p /var/lib/svn/repository/ $ svnadmin create /var/lib/svn/repository/projet_de_test
Check out du code
$ svn co file:///var/lib/svn/repository/projet_de_test
Configuration
Editer le fichier /etc/apache2/mods-available/dav_svn.conf
<Location /svn> DAV svn Require valid-user SVNParentPath /var/lib/svn/repository AuthType Basic AuthName "Subversion Repository" AuthUserFile /var/lib/svn/conf/htpasswd AuthzSVNAccessFile /var/lib/svn/conf/access </Location>
Rajouter dans le fichier /etc/apache2/sites-enabled/default
<Directory /var/lib/svn/repository> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>
Créer les utilisateurs
$ mkdir -p /var/lib/svn/conf/ # -c est pour créer le fichier uniquement $ htpasswd -c /var/lib/svn/conf/htpasswd nom_user1 # pour les autres utilisateurs $ htpasswd /var/lib/svn/conf/htpasswd nom_user2 $ htpasswd /var/lib/svn/conf/htpasswd nom_user3
Configurer les accès utilisateurs, éditer le fichier /var/lib/svn/conf/access
[groups] developpeur = nom_user1, nom_user2 [nomprojet1:/] @developpeur = rw * = r [nomprojet2:/] nom_user3 = rw * = r [projetprivehikage:/documentation/utilisateur] auteurdoc = rw
Modification des droits du dépôt:
$ chown -R nom_user1:www-data /var/lib/svn/repository $ chmod -R 775 /var/lib/svn/repository
Ensuite relance apache:
$ /etc/init.d/apache2 reload
tester avec l'URL http://ip_server/svn/nomprojet1
Commandes
$ svnadmin create repo $ svn info repo $ svn info path $ svn import folder repo/VERSION $ svn co repo/VERSION target-folder $ svn export repo/VERSION target-folder
Réseaux
nombres de TCP
# netstat -nat | awk '{print $6}' | sort | uniq -c | sort -n 1 Foreign 1 established) 7 LAST_ACK 12 LISTEN 13 SYN_RECV 14 CLOSING 17 FIN_WAIT2 22 CLOSE_WAIT 26 FIN_WAIT1 229 ESTABLISHED 928 TIME_WAIT
Linux Center
Le projet Linux Center est un index thématique de pages Web consacrées au système d'exploitation Linux, à ses applications et plus généralement au logiciel libre
Monitoring
Munin
# Installation $ aptitude install munin munin-node # Configuration $ nano /etc/munin/munin.conf
Mettre à jour Apache2, pour voir les résultats:
/etc/apache2/apache2.conf ExtendedStatus On <IfModule mod_status.c> <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1 </Location> </IfModule> # ajouter le module $ a2enmod info #test de la bonne configuration $ apache2 -t
Votre monitoring est accessible via http://localhost/munin/
si vous avez un site sur le même serveur, faite un lien :
root@serveurmunin:/# cd /var/www/monsiteweb root@serveurmunin:/var/www/monsiteweb# ln -s ../munin/ munin
Options MUNIN
# les plugins disponibles pour votre version : $ ls -l /usr/share/munin/plugins/ # ajouter un contrôle pour mysql_queries $ ln -s /usr/share/munin/plugins/mysql_queries /etc/munin/plugins/mysql_queries $ nano /myhome/.my.cnf # ajouter les lignes suivante : [mysqladmin] user = munin password = *****
puis :
$ chmod 0600 /root/.my.cnf $ which mysqladmin $ nano /etc/munin/plugin-conf.d/munin-node # Ajouter dans la section la ligne [mysql*] env.mysqladmin /usr/bin/mysqladmin # Ajout du monitoring pour apache $ ln -s /usr/share/munin/plugins/apache_accesses /etc/munin/plugins/apache_accesses $ ln -s /usr/share/munin/plugins/apache_processes /etc/munin/plugins/apache_processes $ ln -s /usr/share/munin/plugins/apache_volume /etc/munin/plugins/apache_volume # essayer le module suivant: $ /usr/share/munin/plugins/apache_processes # Si vous le message d'erreur suivant : Can't locate object method "new" via package "LWP::UserAgent" at /usr/share/munin/plugins/apache_processes line 134. # executer la commande suivante: $ aptitude install libwww-perl $ /etc/init.d/munin-node restart
Gestion des Backup automatiques
Bind
Editer le fichier /etc/default/bind9 en ajoutant a la ligne OPTION -4 qui permet de n'ecouter QUE en IPV4
OPTIONS="-4 -u bind" ou en chroot: OPTIONS="-4 -u bind -t /var/chroot/bind9"