Compare commits

..

2 Commits

Author SHA1 Message Date
Ray Elliott abeb23e90b add database install scripts 2020-09-03 20:09:59 +01:00
Ray Elliott 86f56d6d73 add php install script 2020-09-03 19:00:38 +01:00
3 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,26 @@
#!/bin/sh
if [ "$mariadb_version" != 'latest' ] ; then
echo 'ERROR: unable to install MariaDB - only '"'latest'"' version currently supported'
exit 30
fi
_mysql_cmd="mysql -uroot -e "
ssh -T $ssh << EOSSH
if mysql --version ; then
echo "ERROR: unable to install MariaDb, 'mysql' already installed - aborting install"
exit 35
fi
echo "Installing MariaDB"
apt install -y mariadb-server
$_mysql_cmd "DELETE FROM mysql.user WHERE User='';"
$_mysql_cmd "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
$_mysql_cmd "DROP DATABASE IF EXISTS test;"
$_mysql_cmd "DELETE FROM mysql.db WHERE Db='test' OR Db='"'test\\_%'"'"
mysqladmin --user=root password "$db_root_pass"
mysqladmin --user=root --password="$db_root_pass" flush-privileges
EOSSH

View File

@ -0,0 +1,26 @@
#!/bin/sh
if [ "$mysql_version" != 'latest' ] ; then
echo 'ERROR: unable to install MySQL - only '"'latest'"' version currently supported'
exit 30
fi
_mysql_cmd="mysql -uroot -e "
ssh -T $ssh << EOSSH
if mysql --version ; then
echo "ERROR: unable to install MySQL, 'mysql' already installed - aborting install"
exit 35
fi
echo "Installing MySQL"
apt install -y mysql-server
$_mysql_cmd "DELETE FROM mysql.user WHERE User='';"
$_mysql_cmd "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
$_mysql_cmd "DROP DATABASE IF EXISTS test;"
$_mysql_cmd "DELETE FROM mysql.db WHERE Db='test' OR Db='"'test\\_%'"'"
mysqladmin --user=root password "$db_root_pass"
mysqladmin --user=root --password="$db_root_pass" flush-privileges
EOSSH

28
install/scripts/install-php.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
if [ "$php_version" != 'latest' ] ; then
echo 'ERROR: unable to install PHP - only '"'latest'"' version currently supported'
exit 30
fi
if [ -n "$wp_user" ] ; then
echo 'Installing PHP for WordPress ...'
ssh -T $ssh << 'EOSSH'
apt install -y php-fpm php-bcmath php-curl php-gd php-imagick php-mbstring \
php-mysql php-soap php-xml php-zip
_php_config_file=$(php --ini | grep Loaded | awk '{ print $4 }')
sed -i '/memory_limit/c\memory_limit = 256M' "$_php_config_file"
sed -i '/upload_max_filesize/c\upload_max_filesize = 64M' "$_php_config_file"
sed -i '/post_max_size/c\post_max_size = 64M' "$_php_config_file"
sed -i '/max_execution_time/c\max_execution_time = 300M' "$_php_config_file"
sed -i '/max_input_time/c\max_input_time = 1000' "$_php_config_file"
EOSSH
else
echo 'Installing default PHP ...'
ssh -T $ssh << EOSSH
apt install -y php libapache2-mod-php php-mysql
EOSSH
fi