## page was renamed from ZAP/HCMV/CNF/InstallationMoodle
## page was renamed from JeanChristopheAndré/Notes/MoodleHCMV
Quelques notes en vrac sur l'installation d'un Moodle de test au CNF de HCMV -- ProgFou

=== Optimisations pour vieux serveur ===
 * vi /etc/squid/squid.conf # squid prend trop de mémoire
 {{{
cache_mem 32 MB
}}}
 * invoke-rc.d squid restart

=== Installation du réseau des serveurs virtuels ===
 * vi /etc/network/firewall.sh
 {{{
# réseau des serveurs virtuels
$IPTN -A POSTROUTING -s 192.168.127.0/24 -o eth0 -j SNAT --to-source 203.162.145.253
$IPTF -A FORWARD -s 192.168.127.0/27 -j ACCEPT
}}}
 * /etc/network/firewall.sh
 * vi /etc/modules
 {{{
dummy
}}}
 * modprobe dummy
 * vi /etc/network/interfaces
 {{{
# réseau des serveurs virtuels
auto dummy0
iface dummy0 inet static
        address 192.168.127.254
        netmask 255.255.255.0
        network 192.168.127.0
        broadcast 192.168.127.255
}}}
 * ifup dummy0
 * vi /etc/bind/db.hcmv.vn.refer.org # + mise à jour SOA
 {{{
moodle                          CNAME   www
}}}
 * rndc reload
 * vi /etc/bind/named.conf.options
 {{{
acl "this" { 127.0.0.1; 203.162.145.253; 192.168.1.1; 192.168.2.1; 192.168.127.254; };  
acl "dmz" { 203.162.145.240/28; 192.168.127.0/24; };
}}}
 * rndc reconfig

=== Installation d'un serveur virtuel ===
 * vi /etc/fstab
 {{{
/dev/mapper/vg0-vzmoodle  /var/lib/vz/private/102  ext3  defaults  1  2
}}}
 * ln -s /var/lib/vz /vz # pas indispensable mais utile (?)
 * aptitude install vzprocps # pas indispensable mais utile
 * vzctl stop 102
 * vzctl set 102 --ipdel all --save
 * vzctl set 102 --ipadd 192.168.127.10 --save
 * vzctl set 102 --nameserver 192.168.127.254 --save
 * vzctl set 102 --onboot yes --save
 * vzctl set 102 --numothersock 200:200 --save
 * vzctl set 102 --privvmpages 491520:535750 --save # règle le problème des plantages
 * vzctl start 102
 * vzctl enter 102
  * sed -i '/getty/d' /etc/inittab ; telinit q
  * invoke-rc.d klogd stop ; update-rc.d -f klogd remove
  * vi /etc/resolv.conf
  {{{
search hcmv.vn.refer.org
}}}
  * vi /etc/apt/sources.list
  {{{
deb http://ftp.hk.debian.org/debian/ etch main contrib
deb http://security.debian.org/debian-security/ etch/updates main contrib
}}}
  * rm /var/cache/apt/*.bin # pour gérer les plantages précédents
  * aptitude update ; aptitude upgrade
  * aptitude install less

=== Installation des services web ===
  * aptitude install locales
  {{{
fr_FR.UTF-8
}}}
  * aptitude install mysql-server mysql-server-5.0
  * vi /etc/mysql/my.cnf # indispensable pour que Moodle s'installe en UTF-8
  {{{
[client]
default-character-set = utf8

[mysqld]
default-character-set = utf8
}}}
  * invoke-rc.d mysql restart
  * aptitude install apache2 libapache2-mod-php4 php4 php4-mysql
  * aptitude install moodle # choisir mysql-server
  * vi /etc/moodle/apache.conf
  {{{
# allow from 127.0.0.0/255.0.0.0
allow from all
}}}
  * vi /etc/moodle/config.php
  {{{
$CFG->wwwroot = 'http://www.hcmv.vn.refer.org/moodle';
}}}
  * a2enmod rewrite
  * apache2ctl graceful
  * exit

=== Installation d'un frontal web ===
 * aptitude install apache2 libapache2-mod-php4 apache- # proxy de apache 1.3 insuffisant
 * a2enmod php4
 * a2enmod proxy
 * a2enmod rewrite
 * cp -a /etc/apache/www.hcmv.vn.refer.org.conf /etc/apache2/sites-available/001-www.hcmv.vn.refer.org
 * vi /etc/apache2/sites-available/001-www.hcmv.vn.refer.org
 {{{
  <IfModule mod_proxy.c>
    ProxyRequests Off
    <Proxy *>
      Order deny,allow
      Allow from all
    </Proxy>
    ProxyPass /moodle/ http://192.168.127.10/moodle/
    ProxyPassReverse /moodle/ http://192.168.127.10/moodle/
  </IfModule>
  RedirectMatch ^/$ /moodle/
}}}
 * vi /etc/apache2/sites-available/moodle.hcmv.vn.refer.org
 {{{
<VirtualHost *>
  ServerName moodle.hcmv.vn.refer.org
  ServerAlias moodle.cai-hcmv moodle.form-hcmv moodle
  ServerAdmin webmestre@hcmv.vn.refer.org
  <IfModule mod_proxy.c>
    ProxyRequests Off
    <Proxy *>
      Order deny,allow
      Allow from all
    </Proxy>
    ProxyPass / http://192.168.127.10/moodle/
    ProxyPassReverse / http://192.168.127.10/moodle/
  </IfModule>
</VirtualHost>
}}}
 * a2dissite default
 * a2ensite 001-www.hcmv.vn.refer.org
 * a2ensite moodle.hcmv.vn.refer.org
 * apache2ctl configtest
 * apache2ctl graceful
 * http://www.hcmv.vn.refer.org/moodle/admin/