run.sh
1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
service mysql start
# ssl configuration
openssl req -newkey rsa:4096 \
-days 365 \
-nodes \
-x509 \
-subj "/C=KR/ST=Seoul/O=KHU/OU=CSE/CN=localhost" \
-keyout localhost.dev.key \
-out localhost.dev.crt
mv localhost.dev.key /etc/ssl/private/
mv localhost.dev.crt /etc/ssl/certs/
chmod 600 /etc/ssl/private/localhost.dev.key /etc/ssl/certs/localhost.dev.crt
# Nginx configuration
cp -p ./tmp/default /etc/nginx/sites-available
# Wordpress configuration
tar -xvf ./tmp/wordpress-5.6.2.tar.gz
rm ./tmp/wordpress-5.6.2.tar.gz
mv /wordpress/ /var/www/html
cp ./tmp/wp-config.php /var/www/html/wordpress
# Move PHP files
mv ./tmp/input.php /var/www/html
mv ./tmp/process.php /var/www/html
mv ./tmp/highcharts.php /var/www/html
mv ./tmp/socket.php /var/www/html
# MariaDB configuration
echo "CREATE USER 'haseo'@'localhost' IDENTIFIED BY 'haseo';" \
| mysql -u root --skip-password
echo "CREATE DATABASE wordpress;" \
| mysql -u root --skip-password
echo "GRANT ALL PRIVILEGES ON wordpress.* TO 'haseo'@'localhost' WITH GRANT OPTION;" \
| mysql -u root --skip-password
echo "FLUSH PRIVILEGES" \
| mysql -u root --skip-password
echo "CREATE DATABASE M2351;" \
| mysql -u root --skip-password
echo "GRANT ALL PRIVILEGES ON M2351.* TO 'haseo'@'localhost' WITH GRANT OPTION;" \
| mysql -u root --skip-password
echo "FLUSH PRIVILEGES" \
| mysql -u root --skip-password
# phpMyAdmin configuration
tar -xvf ./tmp/phpMyAdmin-4.9.7-all-languages.tar.gz
rm ./tmp/phpMyAdmin-4.9.7-all-languages.tar.gz
mv phpMyAdmin-4.9.7-all-languages phpmyadmin
mv phpmyadmin /var/www/html/
cp ./tmp/config.inc.php /var/www/html/phpmyadmin/
mysql < /var/www/html/phpmyadmin/sql/create_tables.sql
# permission setting
chown -R www-data:www-data /var/www/*
find /var/www -type d -exec chmod 755 {} \;
find /var/www -type f -exec chmod 644 {} \;
# service start
service nginx start
service mysql restart
service php7.3-fpm start
service php7.3-fpm status
bash