From 106b4884abec917521bca507593a8671f949df32 Mon Sep 17 00:00:00 2001 From: ictmaatwerk Date: Wed, 12 Sep 2018 13:10:55 +0000 Subject: [PATCH] 'Apache-Installer.sh' updaten --- Apache-Installer.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Apache-Installer.sh b/Apache-Installer.sh index b9bb978..a158c86 100644 --- a/Apache-Installer.sh +++ b/Apache-Installer.sh @@ -14,7 +14,7 @@ # LAMP # #-------------------# -apt install apache2 mysql-server-5.7 -y +apt install -y apache2 mysql-server-5.7 mysql_secure_installation mysql -u root -p"$passwd" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;" mysql -u root -p"$passwd" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '"$passwd"';" @@ -55,7 +55,7 @@ systemctl restart apache2 # PHPMYADMIN # #-------------------# -apt-get install phpmyadmin -y +apt install -y phpmyadmin ln -s /usr/share/phpmyadmin /var/www/"$domain"/public_html # Redirect phpmyadmin -> database mv /var/www/"$domain"/public_html/phpmyadmin /var/www/"$domain"/public_html/database @@ -66,7 +66,9 @@ systemctl restart apache2 # POSTFIX # #-------------------# -apt install mailutils -y +debconf-set-selections <<< "postfix postfix/mailname string $domain" +debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" +apt install -y mailutils sed -i 's/#inet_interfaces = all/inet_interfaces = loopback-only/g' /etc/postfix/main.cf sed -i 's/mydestination/#mydestination/g' /etc/postfix/main.cf sed -i 's/relayhost =/mydestination = '$domain', localhost.'$domain', '$domain'/g' /etc/postfix/main.cf @@ -84,7 +86,7 @@ newaliases if [ $netdata = 1 ] then - bash <(curl -Ss https://my-netdata.io/kickstart.sh) + apt install -y netdata ufw allow 19999/tcp # systemctl stop netdata # systemctl disable netdata @@ -97,7 +99,7 @@ fi if [ $memcached = 1 ] then - apt-get install memcached -y + apt install -y memcached systemctl restart memcached # systemctl stop memcached # systemctl disable memcached @@ -110,7 +112,7 @@ fi if [ $redis = 1 ] then - apt install redis-server -y + apt install -y redis-server sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf sed -i 's/# bind 127.0.0.1 ::1/bind 127.0.0.1 ::1/g' /etc/redis/redis.conf sed -i 's/# requirepass foobared/requirepass '$passwd'/g' /etc/redis/redis.conf @@ -126,8 +128,8 @@ fi # CERTBOT # #-------------------# -add-apt-repository ppa:certbot/certbot -apt install python-certbot-apache -y +add-apt-repository -y ppa:certbot/certbot +apt install -y python-certbot-apache #certbot --apache -d $domain -d www.$domain #sed -i 's/ssl ipv6only/ssl http2 ipv6only/g' /etc/apache2/sites-available/"$domain" #sed -i 's/listen 443 ssl/listen 443 ssl http2/g' /etc/apache2/sites-available/"$domain" @@ -151,16 +153,16 @@ systemctl restart apache2 #-------------------# if [ $wordpress = 1 ] - then + then db_name="wp_1" db_user="wp_1" db_pass=$(date +%s|sha256sum|base64|head -c 32) mysql -u root -p"$passwd" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" mysql -u root -p"$passwd" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" - mysql -u root -p"$passwd" -e "FLUSH PRIVILEGES;" + mysql -u root -p"$passwd" -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 + 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"/public_html chown -R www-data:www-data /var/www/"$domain"/public_html WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -)