Skip to content

Commit

Permalink
Ubuntu 24.04 (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
enoch85 authored Oct 3, 2024
1 parent 4598805 commit 78d7072
Show file tree
Hide file tree
Showing 30 changed files with 120 additions and 49 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
### https://www.techandme.se
### https://www.hanssonit.se/wordpress-vm/

- Ubuntu 22.04 Server
- MariaDB 10.10
- Ubuntu 24.04 Server
- MariaDB 11.4
- NGINX 1.26 (with Brotli support)
- PHP-FPM 8.1
- PHP-FPM 8.4
- Latest Wordpress (updates automatically)
- WP-CLI
- Redis Cache
Expand Down
2 changes: 1 addition & 1 deletion addons/automatic_updates.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059
true
Expand Down
52 changes: 52 additions & 0 deletions addons/brotli-nginx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
# Copyright © 2024 Simon Lindner (https://github.com/szaimen)

# shellcheck disable=2034,2059
true
SCRIPT_NAME="Nginx Brotli"
SCRIPT_EXPLAINER="Enables Brotli compression support for Nginx"
# shellcheck source=lib.sh
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/techandme/wordpress-vm/master/lib.sh)

# Check for errors + debug code and abort if something isn't right
# 1 = ON
# 0 = OFF
DEBUG=0
debug_mode

# Check if root
root_check

# Replace old Nginx with Brotli supported Nginx
if [ ! -f /etc/nginx/modules-enabled/50-mod-http-brotli-filter.conf ]
then
install_if_not ppa-purge
ppa-purge nginx/stable
rm -f /etc/apt/sources.list.d/nginx*
check_command yes | add-apt-repository ppa:ondrej/nginx
apt update -q4 && spinner_loading
install_if_not nginx
systemctl stop nginx
systemctl start nginx
systemctl enable nginx
apt-get purge ppa-purge -y
apt-get autoremove -y
else
exit
fi

# Enable Brotli
install_if_not libnginx-mod-brotli
echo "load_module modules/ngx_http_brotli_filter_module.so;" > /etc/nginx/modules-enabled/50-mod-http-brotli-filter.conf

# Enable Brotli in config
rm -f /etc/nginx/nginx.conf
curl_to_dir "$STATIC" nginx.conf /etc/nginx/

# Restart Nginx
if nginx -t
then
systemctl restart nginx
fi
2 changes: 1 addition & 1 deletion addons/locales.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059,1091
true
Expand Down
2 changes: 1 addition & 1 deletion addons/locate_mirror.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059
true
Expand Down
6 changes: 3 additions & 3 deletions addons/redis-server-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SCRIPT_NAME="Redis Server Ubuntu"
# shellcheck source=lib.sh
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/techandme/wordpress-vm/master/lib.sh)

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# Check for errors + debug code and abort if something isn't right
# 1 = ON
Expand All @@ -17,9 +17,9 @@ debug_mode
root_check

# Check Ubuntu version
if ! version 18.04 "$DISTRO" 22.04.10
if ! version 20.04 "$DISTRO" 24.04.10
then
msg_box "Your current Ubuntu version is $DISTRO but must be between 18.04 - 22.04.10 to run this script."
msg_box "Your current Ubuntu version is $DISTRO but must be between 20.04 - 24.04.10 to run this script."
msg_box "Please contact us to get support for upgrading your server:
https://www.hanssonit.se/#contact
https://shop.hanssonit.se/"
Expand Down
2 changes: 1 addition & 1 deletion addons/smtp-mail.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059
true
Expand Down
2 changes: 1 addition & 1 deletion apps/adminer.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059
true
Expand Down
2 changes: 1 addition & 1 deletion apps/bpytop.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059
true
Expand Down
2 changes: 1 addition & 1 deletion apps/fail2ban.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
# Inspired by https://github.com/nextcloud/nextcloudpi/blob/master/etc/nextcloudpi-config.d/fail2ban.sh

# shellcheck disable=2034,2059
Expand Down
4 changes: 2 additions & 2 deletions apps/midnight-commander.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# Copyright © 2023 Simon Lindner (https://github.com/szaimen)
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
# Copyright © 2024 Simon Lindner (https://github.com/szaimen)

# shellcheck disable=2034,2059
true
Expand Down
2 changes: 1 addition & 1 deletion apps/netdata.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059
true
Expand Down
2 changes: 1 addition & 1 deletion apps/webmin.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059
true
Expand Down
2 changes: 1 addition & 1 deletion lets-encrypt/activate-tls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SCRIPT_NAME="Activate TLS"
# shellcheck source=lib.sh
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/techandme/wordpress-vm/master/lib.sh)

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# Check for errors + debug code and abort if something isn't right
# 1 = ON
Expand Down
2 changes: 1 addition & 1 deletion lets-encrypt/test-new-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SCRIPT_NAME="Test New Configuration"
# shellcheck source=lib.sh
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/techandme/wordpress-vm/master/lib.sh)

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# Check for errors + debug code and abort if something isn't right
# 1 = ON
Expand Down
23 changes: 16 additions & 7 deletions lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ NGINX_CONF="/etc/nginx/nginx.conf"
NGINX_DEF="$SITES_AVAILABLE/default"

# PHP-FPM
PHPVER=8.1
PHPVER=8.4
PHP_FPM_DIR=/etc/php/$PHPVER/fpm
PHP_INI=$PHP_FPM_DIR/php.ini
PHP_POOL_DIR=$PHP_FPM_DIR/pool.d
Expand Down Expand Up @@ -485,10 +485,10 @@ version(){

[[ $2 != "$h" && $2 != "$t" ]]
}
if ! version 20.04 "$DISTRO" 22.04.10
if ! version 20.04 "$DISTRO" 24.04.10
then
print_text_in_color "$IRed" "Your current Ubuntu version is $DISTRO but must be between \
20.04 - 22.04.10 to run this script."
20.04 - 24.04.10 to run this script."
print_text_in_color "$ICyan" "Please contact us to get support for upgrading your server:"
print_text_in_color "$ICyan" "https://www.hanssonit.se/#contact"
print_text_in_color "$ICyan" "https://shop.hanssonit.se/"
Expand Down Expand Up @@ -711,8 +711,8 @@ You can find the download link here: https://www.ubuntu.com/download/server"
exit 1
fi

if ! version 20.04 "$DISTRO" 22.04.10; then
msg_box "Your current Ubuntu version is $DISTRO but must be between 20.04 - 22.04.10 to run this script."
if ! version 20.04 "$DISTRO" 24.04.10; then
msg_box "Your current Ubuntu version is $DISTRO but must be between 20.04 - 24.04.10 to run this script."
msg_box "Please contact us to get support for upgrading your server:
https://www.hanssonit.se/#contact
https://shop.hanssonit.se/"
Expand Down Expand Up @@ -807,7 +807,7 @@ version(){

[[ $2 != "$h" && $2 != "$t" ]]
}
if version 20.04 "$DISTRO" 22.04.10
if version 20.04 "$DISTRO" 24.04.10
then
print_text_in_color "$ICyan" "Testing if network is OK..."
if ! netplan apply
Expand All @@ -828,7 +828,7 @@ then
fi
fi
else
msg_box "Your current Ubuntu version is $DISTRO but must be between 20.04 - 22.04.6 to run this script."
msg_box "Your current Ubuntu version is $DISTRO but must be between 20.04 - 24.04.6 to run this script."
msg_box "Please contact us to get support for upgrading your server:
https://www.hanssonit.se/#contact
https://shop.hanssonit.se/"
Expand Down Expand Up @@ -1049,6 +1049,15 @@ then
elif grep 8.2 <<< "$GETPHP" >/dev/null 2>&1
then
export PHPVER=8.2
elif grep 8.3 <<< "$GETPHP" >/dev/null 2>&1
then
export PHPVER=8.3
elif grep 8.4 <<< "$GETPHP" >/dev/null 2>&1
then
export PHPVER=8.4
elif grep 8.5 <<< "$GETPHP" >/dev/null 2>&1
then
export PHPVER=8.5
fi

export PHP_INI=/etc/php/"$PHPVER"/fpm/php.ini
Expand Down
2 changes: 1 addition & 1 deletion menu/additional_apps.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059
true
Expand Down
2 changes: 1 addition & 1 deletion menu/fail2ban_menu.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

true
SCRIPT_NAME="Fail2ban Menu"
Expand Down
2 changes: 1 addition & 1 deletion menu/main_menu.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059,1091
true
Expand Down
2 changes: 1 addition & 1 deletion menu/menu.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059,1091
true
Expand Down
2 changes: 1 addition & 1 deletion menu/server_configuration.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059
true
Expand Down
2 changes: 1 addition & 1 deletion menu/startup_configuration.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# shellcheck disable=2034,2059
true
Expand Down
4 changes: 2 additions & 2 deletions network/ddclient-configuration.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# Copyright © 2023 Simon Lindner (https://github.com/szaimen)
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
# Copyright © 2024 Simon Lindner (https://github.com/szaimen)

# shellcheck disable=2034,2059
true
Expand Down
2 changes: 1 addition & 1 deletion network/static_ip.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# Use local lib file in case there is no internet connection
if printf "Testing internet connection..." && ping github.com -c 2 >/dev/null 2>&1
Expand Down
2 changes: 1 addition & 1 deletion static/adduser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SCRIPT_NAME="Add CLI User"
# shellcheck source=lib.sh
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/techandme/wordpress-vm/master/lib.sh)

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# Check for errors + debug code and abort if something isn't right
# 1 = ON
Expand Down
2 changes: 1 addition & 1 deletion static/change_db_pass.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SCRIPT_NAME="Change Database Password"
# shellcheck source=lib.sh
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/techandme/wordpress-vm/master/lib.sh)

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

# Check for errors + debug code and abort if something isn't right
# 1 = ON
Expand Down
6 changes: 6 additions & 0 deletions static/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ events {
}

http {
##
# Brootli support
##
brotli on;
brotli_comp_level 6;

##
# Basic Settings
##
Expand Down
7 changes: 5 additions & 2 deletions static/wordpress_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ https://shop.hanssonit.se/product/premium-support-per-30-minutes/"
fi
fi

# Ubuntu 18.04 is deprecated
# Ubuntu 20.04 is deprecated
check_distro_version

# Make sure VMLOGS are present
Expand Down Expand Up @@ -75,7 +75,10 @@ then
fi
fi

# Update Redis PHP extension (20.04 --> 20.04 since 18.04 already is deprecated in the top of this script)
# Upgrade Nginx
run_script "$ADDONS" brotli-nginx

# Update Redis PHP extension (20.04 --> 20.04 since 20.04 already is deprecated in the top of this script)
print_text_in_color "$ICyan" "Trying to upgrade the Redis PECL extension..."

# Check current PHP version
Expand Down
2 changes: 1 addition & 1 deletion wordpress-startup-script.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/

#########

Expand Down
Loading

0 comments on commit 78d7072

Please sign in to comment.