Update 'installer.sh'
This commit is contained in:
124
installer.sh
124
installer.sh
@@ -49,14 +49,36 @@ echo "Administrator email:"
|
|||||||
read email
|
read email
|
||||||
echo "Webserver:"
|
echo "Webserver:"
|
||||||
PS3='Keuze:'
|
PS3='Keuze:'
|
||||||
options=("Apache" "Nginx proxy" "Nginx proxy & standalone" "Nginx, PHP-FPM" "Quit")
|
options=("Nginx, PHP-FPM" "Apache" "Other" "Quit")
|
||||||
select opt in "${options[@]}"
|
select opt in "${options[@]}"
|
||||||
do
|
do
|
||||||
case $opt in
|
case $opt in
|
||||||
|
"Nginx, PHP-FPM")
|
||||||
|
webserv=n
|
||||||
|
newsql=1
|
||||||
|
script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/NGINX-Installer.sh
|
||||||
|
break;;
|
||||||
"Apache")
|
"Apache")
|
||||||
webserv=a
|
webserv=a
|
||||||
|
newsql=1
|
||||||
script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/Apache-Installer.sh
|
script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/Apache-Installer.sh
|
||||||
break;;
|
break;;
|
||||||
|
"Other")
|
||||||
|
webserv=o
|
||||||
|
break;;
|
||||||
|
"Quit")
|
||||||
|
exit;;
|
||||||
|
*) echo "Fout commando $REPLY";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if [ $webserv = o ]; then
|
||||||
|
PS3='Keuze:'
|
||||||
|
options=( "Nginx proxy" "Nginx proxy & standalone")
|
||||||
|
select opt in "${options[@]}"
|
||||||
|
do
|
||||||
|
case $opt in
|
||||||
"Nginx proxy")
|
"Nginx proxy")
|
||||||
webserv=np
|
webserv=np
|
||||||
script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/RevProxySimple.sh
|
script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/RevProxySimple.sh
|
||||||
@@ -65,15 +87,16 @@ do
|
|||||||
webserv=nps
|
webserv=nps
|
||||||
script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/RevProxyAdvanced.sh
|
script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/RevProxyAdvanced.sh
|
||||||
break;;
|
break;;
|
||||||
"Nginx, PHP-FPM")
|
|
||||||
webserv=n
|
|
||||||
script=https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/NGINX-Installer.sh
|
|
||||||
break;;
|
|
||||||
"Quit")
|
|
||||||
exit;;
|
|
||||||
*) echo "Fout commando $REPLY";;
|
*) echo "Fout commando $REPLY";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ $webserv = n ]; then
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Password login uit zetten -> yes/no?" yn
|
read -p "Password login uit zetten -> yes/no?" yn
|
||||||
@@ -124,8 +147,6 @@ else
|
|||||||
nextcloud=0
|
nextcloud=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cockpit=1
|
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Installeer Memcached -> yes/no?" yn
|
read -p "Installeer Memcached -> yes/no?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
@@ -164,6 +185,8 @@ done
|
|||||||
##-----------------##
|
##-----------------##
|
||||||
|
|
||||||
phpver=7.3
|
phpver=7.3
|
||||||
|
sqlver=8.0 #or 5.7
|
||||||
|
cockpit=1
|
||||||
|
|
||||||
##----------------##
|
##----------------##
|
||||||
# Pre-Config #
|
# Pre-Config #
|
||||||
@@ -219,18 +242,18 @@ apt install fail2ban -y
|
|||||||
# Install Phase #
|
# Install Phase #
|
||||||
##-------------------##
|
##-------------------##
|
||||||
|
|
||||||
echo "****************************"
|
|
||||||
sleep 0.5
|
|
||||||
echo "Installatie duurt 5 minuten."
|
|
||||||
sleep 0.5
|
|
||||||
echo "****************************"
|
|
||||||
|
|
||||||
wget $script -O Ubuntu-Web_Installer.sh
|
wget $script -O Ubuntu-Web_Installer.sh
|
||||||
source Ubuntu-Web_Installer.sh
|
source Ubuntu-Web_Installer.sh
|
||||||
|
|
||||||
##------------------##
|
##-----------##
|
||||||
# MySQL Config #
|
# MySQL #
|
||||||
##------------------##
|
##-----------##
|
||||||
|
|
||||||
|
|
||||||
|
if [ $newsql = 1 ]; then
|
||||||
|
wget https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/mysql-${sqlver}.sh -O Mysql-Installer.sh
|
||||||
|
source Mysql-Installer.sh
|
||||||
|
fi
|
||||||
|
|
||||||
rm /etc/mysql/my.cnf
|
rm /etc/mysql/my.cnf
|
||||||
cat > /etc/mysql/my.cnf <<- "EOF"
|
cat > /etc/mysql/my.cnf <<- "EOF"
|
||||||
@@ -279,17 +302,70 @@ if [ $cockpit = 1 ]; then
|
|||||||
source Slave-Installer.sh
|
source Slave-Installer.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ $sshkey = 1 ]; then
|
if [ $sshkey = 1 ]; then
|
||||||
sed -i 's/PermitRootLogin yes/PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config
|
sed -i 's/PermitRootLogin yes/PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##------------------------##
|
##---------------##
|
||||||
# PHP-Myadmin update #
|
# Wordpress #
|
||||||
##------------------------##
|
##---------------##
|
||||||
|
|
||||||
bash <(curl -s https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/PHPMyAdmin_Updater.sh)
|
if [ $wordpress = 1 ]; then
|
||||||
|
db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`
|
||||||
|
db_name="wp_$db_suffix"
|
||||||
|
db_user="wp_$db_suffix"
|
||||||
|
db_pass=$(date +%s|sha256sum|base64|head -c 32)
|
||||||
|
mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
|
||||||
|
mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"
|
||||||
|
mysql -u root -p"$password" -e "FLUSH PRIVILEGES;"
|
||||||
|
wget https://wordpress.org/latest.tar.gz -O /tmp/wp.tar.gz
|
||||||
|
tar xzvf /tmp/wp.tar.gz -C /tmp
|
||||||
|
mv /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
|
||||||
|
cp -a /tmp/wordpress/. /var/www/"$domain"/html
|
||||||
|
WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -)
|
||||||
|
cat <<EOF > /var/www/"$domain"/html/wp-config.php
|
||||||
|
<?php
|
||||||
|
define('DB_NAME', '$db_name');
|
||||||
|
define('DB_USER', '$db_user');
|
||||||
|
define('DB_PASSWORD', '$db_pass');
|
||||||
|
define('DB_HOST', 'localhost');
|
||||||
|
define('DB_CHARSET', 'utf8');
|
||||||
|
define('DB_COLLATE', '');
|
||||||
|
#define( 'WP_SITEURL', '' );
|
||||||
|
#define( 'WP_HOME', '' );
|
||||||
|
#define( 'ALTERNATE_WP_CRON', true );
|
||||||
|
#define('DISABLE_WP_CRON', 'true');
|
||||||
|
#define('WP_CRON_LOCK_TIMEOUT', 900);
|
||||||
|
#define('AUTOSAVE_INTERVAL', 300);
|
||||||
|
define( 'WP_MEMORY_LIMIT', '256M' );
|
||||||
|
define( 'DISALLOW_FILE_EDIT', true );
|
||||||
|
#define( 'EMPTY_TRASH_DAYS', 7 );
|
||||||
|
define( 'NOBLOGREDIRECT', 'https://$domain' );
|
||||||
|
#define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
|
||||||
|
#define( 'FS_CHMOD_FILE', ( 0644 & ~ umask() ) );
|
||||||
|
#define( 'WP_ALLOW_REPAIR', true );
|
||||||
|
#define( 'FORCE_SSL_ADMIN', true );
|
||||||
|
#define( 'AUTOMATIC_UPDATER_DISABLED', true );
|
||||||
|
#define( 'WP_AUTO_UPDATE_CORE', false );
|
||||||
|
$WPSalts
|
||||||
|
#\$table_prefix = '$db_name';
|
||||||
|
\$table_prefix = 'wp';
|
||||||
|
|
||||||
|
define('WP_DEBUG', false);
|
||||||
|
if ( !defined('ABSPATH') )
|
||||||
|
define('ABSPATH', dirname(__FILE__) . '/');
|
||||||
|
|
||||||
|
#\$memcached_servers = array(
|
||||||
|
# 'default' => array(
|
||||||
|
# '127.0.0.1:11211'
|
||||||
|
# )
|
||||||
|
#);
|
||||||
|
#define('WP_REDIS_HOST', '127.0.0.1');
|
||||||
|
#define('WP_REDIS_PASSWORD', '$password');
|
||||||
|
#define('WP_REDIS_PORT', '6379');
|
||||||
|
require_once(ABSPATH . 'wp-settings.php');
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
##-------------------##
|
##-------------------##
|
||||||
# Backup Script #
|
# Backup Script #
|
||||||
|
|||||||
Reference in New Issue
Block a user