WordPress/install.sh

35 lines
1.3 KiB
Bash

sudo apt update -qq && sudo apt upgrade -y
sudo apt install lamp-server^ php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip -y
sudo systemctl restart apache2
sudo a2enmod rewrite
sudo a2enmod ssl
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
touch /tmp/wordpress/.htaccess
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
mkdir /tmp/wordpress/wp-content/upgrade
sudo mkdir /var/www/shop
sudo mkdir /var/www/shop/{ssl/html}
sudo cp -a /tmp/wordpress/. /var/www/shop/html
sudo chown -R www-data:www-data /var/www/shop/html
sudo find /var/www/shop/html/ -type d -exec chmod 750 {} \;
sudo find /var/www/shop/html/ -type f -exec chmod 640 {} \;
curl -s https://api.wordpress.org/secret-key/1.1/salt/
sudo nano /var/www/shop/wp-config.php
define('FS_METHOD', 'direct');
cp /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-available/shop.conf
nano /etc/apache2/sites-available/default-ssl.conf
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
mysql
CREATE DATABASE shop DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'sariboto'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON shop.* TO 'sariboto'@'%';
FLUSH PRIVILEGES;
EXIT;