You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.4 KiB

  1. #!/bin/bash
  2. # Allo-GG
  3. # Installation de Allo-GG sur un Pi Zero avec Rasbian.
  4. # Configuration du nom réseau du module
  5. echo "allo-gg" > /etc/hostname
  6. # Installation des dependances
  7. cd
  8. apt-get -y update
  9. apt-get -y upgrade
  10. apt-get -y install apache2 php7.0 git-core vim tree
  11. # Installation de wiringPi
  12. git clone git://git.drogon.net/wiringPi
  13. cd wiringPi
  14. git pull origin
  15. ./build
  16. cd
  17. # Création de l'utilisateur
  18. useradd --create-home allo-gg
  19. adduser allo-gg sudo
  20. echo allo-gg:allo-gg | chpasswd
  21. echo root:allo-gg | chpasswd
  22. # Autoriser le reboot du module
  23. echo >> /etc/sudoers
  24. echo "## user is allowed to execute halt and reboot" >> /etc/sudoers
  25. echo "allo-gg ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff" >> /etc/sudoers
  26. echo "www-data ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff" >> /etc/sudoers
  27. # Autorisation de clefs SSH publiques
  28. echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbvr8J95SXj0byVhBSOt/iShxzf0TVGKaxvo4d+pdrEaiDFxQEn/Iim9qEH9FXV9kQ8frUuYmVbh7Rqvh8QpTQM77eLHeZgXejw7St0OMmZSGpUsomIANZQNspDQ/qQbXFXmKnGJiC7TCEqaNoDTmHrdZ4Hvei4ly16e8Zic5pjcMruNeixcVkZOLJZWViGgbMlZN8jSll9pFfNRYKhIp6boalK5DexzgUZkUCk4HkPHo0I70LyElINmt9PkpHwzAFbsTRmI27Z9C5xI5OZ86aL+Kq4lm+MoD+f3hDiOdAByNqIEU1LU7tnMpQHbKSYSoVHlySF1+tuw3O1E4HQO45 heuzef@x240" >> /home/allo-gg/.ssh/authorized_keys
  29. echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkdi/Nt+Remfwx5vM/lBmnTUOQ3+UJtbT4P1P+sOXt0dADUHj7gRvZxfb73n7A8y6rfocDiV4IRf1yvg8JWrAFC7/aDCMYDAOMAld9fKFU7u73beWl0zMSTVSGxt2MTSpyU+POx6VvucWppJQJN8R2VtAPHheUZlpLEf0n2gzgyYEYuHEOPHfx91u3omu4QCYRVWv4ZFRCCvznC2Cd+GW2S8uNqe6oxe2HuXtghAIRO+XXDSfwJc0lsm7uKMJ9rtQMYSYUI0f3HErHArf5ssQMCMcHivdJuoWEmvK2UarQdT5kKlytDUjFMrjj4Ks6+Ew6mdvp6H4/PeRjONaDWOQ3 karimcisse@Karims-MacBook-Air.local" >> /home/allo-gg/.ssh/authorized_keys
  30. # Désactiver toutes authentifications SSH par mot de passe
  31. echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
  32. echo "PermitRootLogin no" >> /etc/ssh/sshd_config
  33. # Installation de Allo-GG
  34. rm -vf /var/www/html/index.html
  35. chown -R allo-gg:allo-gg /var/www/html/
  36. su -l allo-gg -c "git clone https://github.com/heuzef/Allo-GG.git /var/www/html/"
  37. # Lancement automatique du script de demarrage
  38. sed -i '1 i #!/bin/sh -e' /etc/rc.local
  39. sed -i '$ d' /etc/rc.local
  40. echo "/bin/bash /var/www/html/scripts/boot.sh &" >> /etc/rc.local
  41. echo "" >> /etc/rc.local
  42. echo "exit 0" >> /etc/rc.local
  43. echo
  44. echo "----------------------------"
  45. echo "Install done ! Rebooting ..."
  46. sleep 3
  47. sh /var/www/html/scripts/reboot.sh