Vous êtes sur la page 1sur 8

1/ Installer une machine UBUNTU 11.

10 2/ Ouvrir un terminal : Ctrl + alt + t 3/ Passer en mode adminstrateur : # sudo -i 4/ Faire un mise a jour du systeme : # apt-get update ##################################################### ## Installation et configuration du serveur Apache ## ##################################################### # apt-get install apache2 # ifconfig eth0 192.168.1.10 netmask 255.255.255.0 ( on peut l 'ajouter avec le graphique avec aut eth0 et passerelle 192.168.1.10 ) # gedit /etc/hosts On ajoute la ligne suivante : 192.168.1.10 www.esprit.com www.esprit-prepa.com www.espritpetrolium.com save et quit # mkdir /var/www/esprit # mkdir /var/www/esprit-prepa # mkdir /var/www/espritpetrolium # cp /var/www/index.html /var/www/esprit/index.html # gedit /var/www/esprit/index.html "Il est fonctionnel a partir de esprit.com :) " # cp /var/www/index.html /var/www/esprit-prepa/index.html # gedit /var/www/esprit-prepa/index.html "Il est fonctionnel a partir de esprit-prepa.com" # cp /var/www/index.html /var/www/espritpetrolium/index.html # gedit /var/www/espritpetrolium/index.html "Il est fonctionnel a partir de espritpetrolium.com" # touch /etc/apache2/sites-available/esprit.conf # gedit /etc/apache2/sites-available/esprit.conf ============================================================================ <VirtualHost *:80> ServerName www.esprit.com ServerAlias www.esprit.com DocumentRoot /var/www/esprit <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/esprit>

Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> ========================================================================= # touch /etc/apache2/sites-available/esprit-prepa.conf # gedit /etc/apache2/sites-available/esprit-prepa.conf ============================================================================ <VirtualHost *:80> ServerName www.esprit-prepa.com ServerAlias www.esprit-prepa.com DocumentRoot /var/www/esprit-prepa <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/esprit-prepa> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all

</Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> ========================================================================= # touch /etc/apache2/sites-available/espritpetrolium.conf # gedit /etc/apache2/sites-available/espritpetrolium.conf ============================================================================ <VirtualHost *:80> ServerName www.espritpetrolium.com ServerAlias www.espritpetrolium.com DocumentRoot /var/www/espritpetrolium <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/espritpetrolium> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks

AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> ========================================================================= # a2ensite esprit.conf # a2ensite esprit-prepa.conf # a2ensite espritpetrolium.conf # service apache2 reload Pour tester: Ouvrir Mozilla firefox et taper : www.esprit.com et www.esprit-prepa.com et www.espritpetrolium.com ########################################################## ## ## Installation et configuration du serveur de messagerie ## ########################################################## ## ####### Configuration du nom de la machine######### # sudo -i # gedit /etc/hosts =========================================================================== 127.0.0.1 esprit.tn localhost localhost.localdomain =========================================================================== # gedit /etc/hostname =========================================================================== esprit.tn =========================================================================== # hostname esprit.tn et puis redmarrez la machine ##########Installation et Configuration de postfix####################### # sudo -i # apt-get install postfix # gedit /etc/postfix/main.cf vrfier ces parametres ========================================================================= myhostname = esprit.tn mydomain = esprit.tn alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = $mydomain mydestination = esprit.tn, localhost.localdomain, localhost

relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all default_transport = smtp relay_transport = smtp inet_protocols = all html_directory = /usr/share/doc/postfix/html home_mailbox = Maildir/ mailbox_command = =========================================================================== Enregistez et quitter # /etc/init.d/postfix restart ##########Configuration du DOVECOT ################## # apt-get install dovecot-pop3d # apt-get install mailutils # gedit /etc/dovecot/dovecot.conf ajoutez ces deux lignes: ########################################### protocols = pop3 pop3s mail_location = maildir:~/Maildir ########################################### enregistez et quitter # /etc/init.d/dovecot restart ########################## Creation des utilisateurs de test ########### #useradd -m user1 #passwd user1 #useradd -m user2 #passwd user2

************************************************************* ######################### Test d'envoi ############################# # telnet localhost 25 Trying 127.0.0.1... Connected to esprit.tn. Escape character is '^]'. 220 esprit.tn ESMTP Postfix (Ubuntu) helo user1 250 esprit.tn MAIL FROM:<user1@esprit.com> 250 2.1.0 ok RCPT TO:<user2@esprit.tn> 250 2.1.5 ok DATA 354 End data with <CR><LF>.<CR><LF> c un test telnet . 250 2.0.0 Ok: queued as 097DED4551

quit 221 2.0.0 Bye Connection closed by foreign host. ######################### Test de reception ############################# # telnet localhost 110 Connected to esprit.tn. Escape character is '^]'. +OK Dovecot ready. user user2 +OK pass user2 +OK Logged in. list +OK 2 messages: 1 400 2 395 . quit Connection closed by foreign host. ******************************************************************************** ******* ##########Installation et Configuration de SASL####################### # adduser postfix sasl # postconf -e 'smtpd_sasl_local_domain =' # postconf -e 'smtpd_sasl_auth_enable = yes' # postconf -e 'smtpd_sasl_security_options = noanonymous' # postconf -e 'broken_sasl_auth_clients = yes' # postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_m ynetworks,reject_unauth_destination' # postconf -e 'inet_interfaces = all' # echo 'pwcheck_method: saslauthd' >> /etc/postfix/sasl/smtpd.conf # echo 'mech_list: plain login' >> /etc/postfix/sasl/smtpd.conf # mkdir /etc/postfix/ssl # cd /etc/postfix/ssl/ # openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024 # chmod 600 smtpd.key # openssl req -new -key smtpd.key -out smtpd.csr # openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt /// 1024 mot de passe # openssl rsa -in smtpd.key -out smtpd.key.unencrypted # mv -f smtpd.key.unencrypted smtpd.key # openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -da ys 3650 # postconf -e 'smtpd_tls_auth_only = no' # postconf -e 'smtp_use_tls = yes' # postconf -e 'smtpd_use_tls = yes' # postconf -e 'smtp_tls_note_starttls_offer = yes' # postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key' # postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt' # postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem' # postconf -e 'smtpd_tls_loglevel = 1' # postconf -e 'smtpd_tls_received_header = yes' # postconf -e 'smtpd_tls_session_cache_timeout = 3600s' # postconf -e 'tls_random_source = dev:/dev/urandom' # postconf -e 'myhostname = esprit.com' # apt-get install libsasl2-modules libsasl2-modules-sql libgsasl7 libauthen-sasl

-cyrus-perl sasl2-bin libpam-mysql # mkdir -p /var/spool/postfix/var/run/saslauthd # rm -fr /var/run/saslauthd # gedit /etc/default/saslauthd START=yes et modifiez la derniere ligne OPTIONS="-c -m /var/run/saslauthd" comme cela: OPTIONS="-m /var/spool/postfix/var/run/saslauthd" ################################ TEST ########################################## ######### # /etc/init.d/saslauthd reload # telnet localhost 25 Trying 127.0.0.1... Connected to esprit.tn. Escape character is '^]'. 220 esprit.com ESMTP Postfix (Ubuntu) EHLO somename.tld 250-esprit.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN 250-AUTH=PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN ################################################################################ ########## ##################################################### ## Installation et configuration du Nagios ## ##################################################### ############################################ Installation et configuration SNMP# ############### # apt-get install snmpd snmp # mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak # touch /etc/snmp/snmpd.conf # gedit /etc/snmp/snmpd.conf rocommunity public syslocation Esprit syscontact <user1@esprit.com> # gedit /etc/default/snmpd 1 - Add a '#' before this line : SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid '

2 - Add the next line : SNMPDOPTS= -Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/ snmpd.conf' 3 Configure this options as your needs : SNMPDRUN= yes TRAPDRUN= yes # /etc/init.d/snmpd restart #####Test SNMP ####### # snmpwalk -v1 -c public localhost

############################################ Installation et configuration Nagio s################ # apt-get install nagios3 il vous demande un mot de passe : nagiosadmin # htpasswd -c /etc/nagios3/htpasswd.users admin il vous demande un mot de passe : nagiosadmin Pour tester: Ouvrir Mozilla firefox et taper : http://localhost/nagios3/ Mot de passe : nagiosadmin user: nagiosadmin