postinst 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. # Configuration Apache2
  3. [ -z "$(grep \/var\/www\/www /etc/apache2/apache2.conf)" ] && ed -s /etc/apache2/apache2.conf <<EOF
  4. /\#<Directory
  5. -i
  6. <Directory /var/www/www/>
  7. Options Indexes FollowSymLinks
  8. AllowOverride None
  9. Require all granted
  10. </Directory>
  11. .
  12. w
  13. EOF
  14. a2enmod headers
  15. a2enmod rewrite
  16. a2enmod ssl
  17. a2ensite api.conf
  18. a2ensite www.conf
  19. a2ensite cro.conf
  20. # Configuration PHP
  21. if [ -f /etc/php/7.4/apache2/php.ini ];
  22. then
  23. ed -s /etc/php/7.4/apache2/php.ini <<EOF
  24. /upload_max_filesize
  25. s/2M/30M
  26. .
  27. w
  28. EOF
  29. fi
  30. # Redemarrage du serveur Apache2
  31. systemctl restart apache2
  32. # Configuration de la base de donnees
  33. mysql_secure_installation
  34. mysql -u root <<EOF
  35. CREATE USER IF NOT EXISTS 'newuser'@'localhost';
  36. SET PASSWORD FOR 'newuser'@'localhost' = PASSWORD( 'password' );
  37. GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost';
  38. FLUSH PRIVILEGES;
  39. exit
  40. EOF
  41. # Ajoute les tables de Math-Cloud
  42. if [ -f /tmp/iimt_mathcloud.sql ] &&
  43. [ -f /tmp/iimt_mathcloud_audit.sql ] &&
  44. [ -f /tmp/iimt_mathcloud_shadow.sql ];
  45. then
  46. mysql -u root <<EOF
  47. SOURCE /tmp/iimt_mathcloud.sql
  48. SOURCE /tmp/iimt_mathcloud_audit.sql
  49. SOURCE /tmp/iimt_mathcloud_shadow.sql
  50. exit
  51. EOF
  52. fi
  53. # Redemarrage de la base de donnees
  54. systemctl restart mysql