postinst 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/bash
  2. # Stoppe le serveur Apache2 s'il est demarre
  3. if systemctl is-active --quiet apache2;
  4. then
  5. systemctl stop apache2
  6. fi
  7. # Creation et installation des certificats Let's Encrypt
  8. certbot certonly --standalone -d monrisquearteriel.com -d api.monrisquearteriel.com -d www.monrisquearteriel.com -d cro.monrisquearteriel.com
  9. # Configuration Apache2
  10. a2enmod headers rewrite ssl proxy proxy_http
  11. a2ensite ipsocloud.conf
  12. # Configuration PHP
  13. for i in /etc/php/*/apache2/php.ini;
  14. do
  15. if [ -f ${i} ];
  16. then
  17. ed -s ${i} <<EOF
  18. /upload_max_filesize
  19. s/2M/30M
  20. .
  21. w
  22. EOF
  23. fi
  24. done
  25. # Redemarrage du serveur Apache2
  26. systemctl restart apache2
  27. # Configuration de la base de donnees
  28. mysql -u root <<EOF
  29. CREATE USER IF NOT EXISTS 'newuser'@'localhost';
  30. SET PASSWORD FOR 'newuser'@'localhost' = PASSWORD( 'password' );
  31. GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost';
  32. FLUSH PRIVILEGES;
  33. exit
  34. EOF
  35. # Ajoute les tables de Math-Cloud
  36. if [ -f /tmp/iimt_mathcloud.sql ] &&
  37. [ -f /tmp/iimt_mathcloud_audit.sql ] &&
  38. [ -f /tmp/iimt_mathcloud_shadow.sql ];
  39. then
  40. mysql -u root <<EOF
  41. SOURCE /tmp/iimt_mathcloud.sql
  42. SOURCE /tmp/iimt_mathcloud_audit.sql
  43. SOURCE /tmp/iimt_mathcloud_shadow.sql
  44. exit
  45. EOF
  46. fi
  47. # Mettre les droits d'acces au repertoire storage/
  48. chmod 777 /var/www/storage/
  49. chmod 777 /var/www/storage/media/
  50. chmod 777 /var/www/storage/report/
  51. chown www-data:www-data /var/www/storage/tmp/