server/srcs/init.sh

25 lines
1.3 KiB
Bash
Raw Normal View History

2023-03-01 04:35:27 +01:00
#!/bin/bash
ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
curl https://files.phpmyadmin.net/phpMyAdmin/5.1.1/phpMyAdmin-5.1.1-english.tar.gz -o phpmyadmin.tar.gz
curl https://wordpress.org/latest.tar.gz -o wordpress.tar.gz
tar -vxf phpmyadmin.tar.gz
tar -xvf wordpress.tar.gz
mv phpMyAdmin-5.1.1-english /var/www/phpmyadmin
mv wordpress /var/www/
mv nginx.conf /etc/nginx/sites-available/default
mv phpmyadmin.conf /var/www/phpmyadmin/config.inc.php
mv wordpress.conf /var/www/wordpress/wp-config.php
chown -R www-data:www-data /var/www
openssl genrsa -out nginx.key
openssl req -new -key nginx.key -out nginx.csr -subj "/C=NL/ST=Friesland/L=Heerenveen/O=localhost/OU=localhost/CN=localhost/emailAddress=djonker@student.codam.nl"
openssl x509 -req -days 365 -in nginx.csr -signkey nginx.key -out nginx.crt
mv nginx.crt /etc/ssl/certs/nginx.crt
mv nginx.key /etc/ssl/private/nginx.key
chmod 600 /etc/ssl/certs/nginx.crt /etc/ssl/private/nginx.key
service mysql start
mysql < sqldump.sql
echo "GRANT ALL PRIVILEGES ON *.* TO djonker@localhost IDENTIFIED BY 'password';" | mysql -u root
echo "GRANT ALL PRIVILEGES ON wordpress.* TO wordpress@localhost IDENTIFIED BY 'password';" | mysql -u root
echo "FLUSH PRIVILEGES;" | mysql -u root
rm -f wordpress.tar.gz phpmyadmin.tar.gz init.sh nginx.csr sqldump.sql