-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
54 lines (41 loc) · 1.51 KB
/
install.sh
File metadata and controls
54 lines (41 loc) · 1.51 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
#!/bin/bash
# Check Root Privilege
if [ "$EUID" -ne 0 ]
then echo "Root privilege is required to run the installation script."
exit
fi
# Set Hostname
hostnamectl set-hostname the-fools
sed -i "s/127.0.1.1/127.0.1.1 the-fools/" /etc/hosts
# Configure APT repository
apt update
# Install Packages (Nginx, MySQL, PHP-FPM)
apt install -y nginx mysql-server php-fpm php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-ldap php-zip php-curl
# Copy files
cp -rf env/* /
# Remove default index.html
rm -f /var/www/html/index.nginx-debian.html
# Set owners and permission for public files
chown -R www-data. /var/www/html
chown root. /var/www/html/batch_process_service_status.sh
chmod 777 /var/www/html/batch_process_service_status.sh
# Set (Ensure) owner and permission for system files
chmod 644 /etc/nginx/sites-available/default
chmod 644 /etc/mysql/conf.d/mysql.cnf
chmod 644 /etc/php/7.2/fpm/pool.d/www.conf
# Restart services
systemctl restart nginx
systemctl restart mysql
# Start service on boot
systemctl enable php7.2-fpm
systemctl enable nginx
systemctl enable mysql
# Setup database
mysql -e "create database fakenews"
mysql -e 'create user "faker"@"localhost" IDENTIFIED BY "S3a0#d9$yj"'
mysql -e 'GRANT SELECT, INSERT ON fakenews.* TO "faker"@"localhost"'
mysql fakenews < imports/fakenews.sql
# Set password for user 'admin'
mysql -e 'UPDATE users SET password = "$2y$10$g68xMI/sDMLz10oFuC0FO.uahTWW7VaKttjIcYeEtoESM0DlkevqW" WHERE username = "admin"'
# Setup Cron
crontab imports/cronjobs