| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #! /bin/bash
- # Configuration Apache2
- if [ -f /tmp/api.conf.in ];
- then
- sed "s/USER_LOGIN/${SUDO_USER}/g" /tmp/api.conf.in > /etc/apache2/sites-available/api.conf
- fi
- if [ -f /etc/apache2/ports.conf ];
- then
- [ -z "$(grep 10302 /etc/apache2/ports.conf)" ] && ed -s /etc/apache2/ports.conf <<EOF
- /Listen\ 443
- +i
- Listen 10302
- .
- /Listen\ 443
- +i
- Listen 10302
- .
- w
- EOF
- fi
- a2enmod headers
- a2enmod rewrite
- a2enmod ssl
- a2ensite api.conf
- # Configuration PHP
- if [ -f /etc/php/7.4/apache2/php.ini ];
- then
- ed -s /etc/php/7.4/apache2/php.ini <<EOF
- /upload_max_filesize
- s/2M/30M
- .
- w
- EOF
- fi
- # Redemarrage du serveur Apache2
- systemctl restart apache2
- # Configuration de la base de donnees
- mysql_secure_installation
- mysql -u root <<EOF
- CREATE USER IF NOT EXISTS 'newuser'@'localhost';
- SET PASSWORD FOR 'newuser'@'localhost' = PASSWORD( 'password' );
- GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost';
- FLUSH PRIVILEGES;
- exit
- EOF
- # Ajoute les tables de Math-Cloud
- if [ -f /tmp/iimt_mathcloud.sql ] &&
- [ -f /tmp/iimt_mathcloud_audit.sql ] &&
- [ -f /tmp/iimt_mathcloud_shadow.sql ];
- then
- mysql -u root <<EOF
- SOURCE /tmp/iimt_mathcloud.sql
- SOURCE /tmp/iimt_mathcloud_audit.sql
- SOURCE /tmp/iimt_mathcloud_shadow.sql
- exit
- EOF
- fi
- # Redemarrage de la base de donnees
- systemctl restart mysql
- # Copie des cles SSH
- cp /tmp/sshFabrice.zip /home/${SUDO_USER}/.ssh/
- chown ${SUDO_USER}:${SUDO_USER} /home/${SUDO_USER}/.ssh/sshFabrice.zip
- # Configuration du compte utilisateur
- if [ ! -d /home/${SUDO_USER}/Git ];
- then
- mkdir /home/${SUDO_USER}/Git
- chown -R ${SUDO_USER}:${SUDO_USER} /home/${SUDO_USER}/Git
- fi
- if [ ! -f /home/${SUDO_USER}/Git/gitClone.sh ];
- then
- cat > /home/${SUDO_USER}/Git/gitClone.sh <<EOF
- #! /bin/bash
- git clone ssh://iimt@gogs.iimt.fr:iimt/MAth-Cloud-3.0.0.git
- EOF
- chmod +x /home/${SUDO_USER}/Git/gitClone.sh
- chown ${SUDO_USER}:${SUDO_USER} /home/${SUDO_USER}/Git/gitClone.sh
- fi
|