Skip to content

Commit d97736c

Browse files
authored
Ubuntu 22.04 (#2279)
Signed-off-by: enoch85 <[email protected]>
1 parent c4b764a commit d97736c

27 files changed

+197
-84
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ Server installation. Simplified. :cloud:
1717
--------------------
1818

1919
## Dependencies:
20-
(Ubuntu Server 20.04 LTS 64-bit)
20+
(Ubuntu Server 22.04 LTS 64-bit)
2121
<br>
22-
(Linux Kernel: 5.4)
22+
(Linux Kernel: 5.15)
2323
- Apache 2.4
24-
- PostgreSQL 12
25-
- PHP-FPM 7.4
24+
- PostgreSQL 14
25+
- PHP-FPM 8.1
2626
- Redis Memcache (latest stable version from PECL)
2727
- PHP-igbinary (latest stable version from PECL
2828
- PHP-smbclient (latest stable version from PECL)

addons/0-byte-files.sh

+2
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ Please see files in red when you hit OK."
4848
do
4949
print_text_in_color "$IRed" "$each"
5050
done
51+
else
52+
msg_box "No 0-byte files found. *peew*"
5153
fi
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# T&M Hansson IT AB © - 2022, https://www.hanssonit.se/
4+
5+
true
6+
SCRIPT_NAME="Fix 'Could not update metadata due to invalid modified time'."
7+
# shellcheck source=lib.sh
8+
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
9+
10+
# Check if root
11+
root_check
12+
13+
msg_box "This is an attempt to automate a fix for the nasty bug from the Desktop Client:
14+
https://github.com/nextcloud/desktop/wiki/How-to-fix-the-error-invalid-or-negative-modification-date#-how-to-fix-it
15+
16+
Please only run this if you made a backup."
17+
18+
if ! yesno_box_no "Have you made a backup?"
19+
then
20+
exit 1
21+
fi
22+
23+
msg_box "OK, let's go!
24+
25+
Please note, this script might take several hours to run, depening on the size of your datadir. Don't abort it!"
26+
27+
# Download the script
28+
curl_to_dir https://raw.githubusercontent.com/nextcloud-gmbh/mtime_fixer_tool_kit/master solvable_files.sh $NCPATH
29+
30+
# Run all the needed variables
31+
ncdb
32+
33+
if [[ $NCDBTYPE = mysql ]]
34+
then
35+
msg_box "We only support PostgreSQL, sorry!"
36+
exit
37+
fi
38+
39+
# Run the script and remove it
40+
print_text_in_color "$ICyan" "Running the scan and fixing broken files..."
41+
bash "$NCPATH"/solvable_files.sh "$NCDATA" "$NCDBTYPE" "$NCDBHOST" "$NCDBUSER" "$NCDBPASS" "$NCDB" fix use_birthday verbose
42+
rm "$NCPATH"/solvable_files.sh
43+
44+
# Scan all files
45+
nextcloud_occ files:scan --all

addons/redis-server-ubuntu.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ debug_mode
1616
root_check
1717

1818
# Check Ubuntu version
19-
if ! version 16.04 "$DISTRO" 20.04.6
19+
if ! version 18.04 "$DISTRO" 22.04.10
2020
then
21-
msg_box "Your current Ubuntu version is $DISTRO but must be between 16.04 - 20.04.6 to run this script."
21+
msg_box "Your current Ubuntu version is $DISTRO but must be between 18.04 - 22.04.10 to run this script."
2222
msg_box "Please contact us to get support for upgrading your server:
2323
https://www.hanssonit.se/#contact
2424
https://shop.hanssonit.se/"

addons/security.sh

+3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ a2enmod reqtimeout # http://httpd.apache.org/docs/2.4/mod/mod_reqtimeout.html
7373
# Download the spamhaus script
7474
download_script STATIC spamhaus-drop
7575

76+
# Install iptables
77+
install_if_not iptables
78+
7679
# Make the file executable
7780
chmod +x "$SCRIPTS"/spamhaus-drop.sh
7881

apps/adminer.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ curl_to_dir "https://raw.githubusercontent.com/Niyko/Hydra-Dark-Theme-for-Admine
5656
ln -s "$ADMINERDIR"/latest.php "$ADMINERDIR"/adminer.php
5757

5858
# Only add TLS 1.3 on Ubuntu later than 20.04
59-
if version 20.04 "$DISTRO" 20.04.10
59+
if version 20.04 "$DISTRO" 22.04.10
6060
then
6161
TLS13="+TLSv1.3"
6262
fi

apps/collabora_docker.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ a2enmod ssl
135135
a2enmod headers
136136

137137
# Only add TLS 1.3 on Ubuntu later than 20.04
138-
if version 20.04 "$DISTRO" 20.04.10
138+
if version 20.04 "$DISTRO" 22.04.10
139139
then
140140
TLS13="+TLSv1.3"
141141
fi

apps/fail2ban.sh

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ do
112112
fi
113113
done
114114

115+
# Install iptables
116+
install_if_not iptables
117+
115118
# remove ncdata, else it will be used
116119
rm -f $NCDATA/nextcloud.log
117120

apps/fulltextsearch.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ else
3636
# Ask for removal or reinstallation
3737
reinstall_remove_menu "$SCRIPT_NAME"
3838
# Reset database table
39-
check_command sudo -Hiu postgres psql "$NCCONFIGDB" -c "TRUNCATE TABLE oc_fulltextsearch_ticks;"
39+
check_command sudo -Hiu postgres psql "$NCDB" -c "TRUNCATE TABLE oc_fulltextsearch_ticks;"
4040
# Reset Full Text Search to be able to index again, and also remove the app to be able to install it again
4141
nextcloud_occ_no_check fulltextsearch:reset
4242
APPS=(fulltextsearch fulltextsearch_elasticsearch files_fulltextsearch)

apps/onlyoffice_docker.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ a2enmod ssl
147147
a2enmod headers
148148

149149
# Only add TLS 1.3 on Ubuntu later than 20.04
150-
if version 20.04 "$DISTRO" 20.04.10
150+
if version 20.04 "$DISTRO" 22.04.10
151151
then
152152
TLS13="+TLSv1.3"
153153
fi

apps/pico_cms.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ a2enmod ssl
215215
a2enmod headers
216216

217217
# Only add TLS 1.3 on Ubuntu later than 20.04
218-
if version 20.04 "$DISTRO" 20.04.10
218+
if version 20.04 "$DISTRO" 22.04.10
219219
then
220220
TLS13="+TLSv1.3"
221221
fi

apps/talk.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ else
6565
removal_popup "$SCRIPT_NAME"
6666
fi
6767

68-
# Must be 20.04
69-
if ! version 20.04 "$DISTRO" 20.04.6
68+
# Must be 22.04
69+
if ! version 20.04 "$DISTRO" 22.04.10
7070
then
7171
msg_box "Your current Ubuntu version is $DISTRO but must be between 20.04 - 20.04.10 to install Talk"
7272
msg_box "Please contact us to get support for upgrading your server:
@@ -76,7 +76,7 @@ exit
7676
fi
7777

7878
# Nextcloud 19 is required.
79-
lowest_compatible_nc 19
79+
lowest_compatible_nc 20
8080

8181
####################### TALK (COTURN)
8282

@@ -333,7 +333,7 @@ echo "Hi there! :) If you see this page, the Apache2 proxy for $SCRIPT_NAME is u
333333
chown -R www-data:www-data /var/www/html/error
334334

335335
# Only add TLS 1.3 on Ubuntu later than 20.04
336-
if version 20.04 "$DISTRO" 20.04.10
336+
if version 20.04 "$DISTRO" 22.04.10
337337
then
338338
TLS13="+TLSv1.3"
339339
fi

apps/tmbitwarden.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ a2enmod headers
242242
a2enmod remoteip
243243

244244
# Only add TLS 1.3 on Ubuntu later than 20.04
245-
if version 20.04 "$DISTRO" 20.04.10
245+
if version 20.04 "$DISTRO" 22.04.10
246246
then
247247
TLS13="+TLSv1.3"
248248
fi

apps/vaultwarden.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ a2enmod headers
123123
a2enmod remoteip
124124

125125
# Only add TLS 1.3 on Ubuntu later than 20.04
126-
if version 20.04 "$DISTRO" 20.04.10
126+
if version 20.04 "$DISTRO" 22.04.10
127127
then
128128
TLS13="+TLSv1.3"
129129
fi

apps/webmin.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ install_if_not libpam-runtime
5050
install_if_not libio-pty-perl
5151
install_if_not apt-show-versions
5252
install_if_not python2
53-
install_if_not python
5453
install_if_not unzip
5554
install_if_not zip
5655

@@ -71,8 +70,8 @@ install_if_not webmin
7170

7271
if ! dpkg-query -W -f='${Status}' "webmin" | grep -q "ok installed"
7372
then
74-
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.984_all.deb
75-
dpkg --install webmin_1.984_all.deb
73+
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.991_all.deb
74+
dpkg --install webmin_1.991_all.deb
7675
fi
7776

7877
print_text_in_color "$ICyan" "Configuring Webmin..."

disk/format-chosen.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercont
1010
# Check if root
1111
root_check
1212

13-
# Needs to be Ubuntu 18.04 and Multiverse
13+
# Needs to be Ubuntu 20.04 and Multiverse
1414
check_distro_version
1515
check_multiverse
1616

disk/format-sdb.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercont
1010
# Check if root
1111
root_check
1212

13-
# Needs to be Ubuntu 18.04 and Multiverse
13+
# Needs to be Ubuntu 20.04 and Multiverse
1414
check_distro_version
1515
check_multiverse
1616

lets-encrypt/activate-tls.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fi
116116
check_php
117117

118118
# Only add TLS 1.3 on Ubuntu later than 20.04
119-
if version 20.04 "$DISTRO" 20.04.10
119+
if version 20.04 "$DISTRO" 22.04.10
120120
then
121121
TLS13="+TLSv1.3"
122122
fi

lib.sh

+28-21
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
true
99
# see https://github.com/koalaman/shellcheck/wiki/Directive
1010

11+
##### LEGACY #####
12+
## Remove 2022-09-01
13+
NCPASS=nextcloud
14+
NCUSER=ncadmin
15+
PGDB_USER=nextcloud_db_user
16+
NCCONFIGDBPASS=$(grep 'dbpassword "$NCPATH"/config/config.php | awk '{print $3}' | sed "s/[',]//g")"
17+
NCCONFIGDB=$(grep 'dbname' "$NCPATH"/config/config.php | awk '{print $3}' | sed "s/[',]//g")"
18+
19+
1120
## VARIABLES
1221
1322
# Dirs
@@ -41,7 +50,7 @@ gen_passwd() {
4150
DISTRO=$(lsb_release -sr)
4251
KEYBOARD_LAYOUT=$(localectl status | grep "Layout" | awk '{print $3}')
4352
# Hypervisor
44-
# HYPERVISOR=$(dmesg --notime | grep -i hypervisor | cut -d ':' -f2 | head -1 | tr -d ' ') TODO
53+
### TODO ### HYPERVISOR=$(dmesg --notime | grep -i hypervisor | cut -d ':' -f2 | head -1 | tr -d ' ')
4554
SYSVENDOR=$(cat /sys/devices/virtual/dmi/id/sys_vendor)
4655
# Network
4756
IFACE=$(ip r | grep "default via" | awk '{print $5}')
@@ -103,8 +112,8 @@ GEOBLOCKDAT="$GITHUB_REPO/geoblockdat"
103112
NCREPO="https://download.nextcloud.com/server/releases"
104113
ISSUES="https://github.com/nextcloud/vm/issues"
105114
# User information
106-
NCPASS=nextcloud
107-
NCUSER=ncadmin
115+
GUIUSER=ncadmin
116+
GUIPASS=nextcloud
108117
UNIXUSER=$SUDO_USER
109118
UNIXUSER_PROFILE="/home/$UNIXUSER/.bash_profile"
110119
ROOT_PROFILE="/root/.bash_profile"
@@ -113,16 +122,16 @@ BITWARDEN_USER=bitwarden
113122
BITWARDEN_HOME=/home/"$BITWARDEN_USER"
114123
# Database
115124
SHUF=$(shuf -i 25-29 -n 1)
125+
PGDB_USER=nextcloud_db_user
116126
PGDB_PASS=$(gen_passwd "$SHUF" "a-zA-Z0-9@#*")
117127
NEWPGPASS=$(gen_passwd "$SHUF" "a-zA-Z0-9@#*")
118128
ncdb() {
119-
NCCONFIGDB=$(grep "dbname" $NCPATH/config/config.php | awk '{print $3}' | sed "s/[',]//g")
120-
}
121-
[ -n "$NCDB" ] && ncdb # TODO: remove this line someday
122-
ncdbpass() {
123-
NCCONFIGDBPASS=$(grep "dbpassword" $NCPATH/config/config.php | awk '{print $3}' | sed "s/[',]//g")
129+
NCDB=$(grep "dbname" $NCPATH/config/config.php | awk '{print $3}' | sed "s/[',]//g")
130+
NCDBPASS=$(grep "dbpassword" $NCPATH/config/config.php | awk '{print $3}' | sed "s/[',]//g")
131+
NCDBUSER=$(grep "dbuser" $NCPATH/config/config.php | awk '{print $3}' | sed "s/[',]//g")
132+
NCDBTYPE=$(grep "dbtype" /var/www/nextcloud/config/config.php | awk '{print $3}' | sed "s/[',]//g")
133+
NCDBHOST=$(grep "dbhost" /var/www/nextcloud/config/config.php | awk '{print $3}' | sed "s/[',]//g")
124134
}
125-
[ -n "$NCDBPASS" ] && ncdbpass # TODO: remove this line someday
126135
# Path to specific files
127136
SECURE="$SCRIPTS/setup_secure_permissions_nextcloud.sh"
128137
# Nextcloud version
@@ -134,7 +143,6 @@ nc_update() {
134143
NCBAD=$((NCMAJOR-2))
135144
NCNEXT="$((${CURRENTVERSION%%.*}+1))"
136145
}
137-
[ -n "$NC_UPDATE" ] && nc_update # TODO: remove this line someday
138146
# Set the hour for automatic updates. This would be 18:00 as only the hour is configurable.
139147
AUT_UPDATES_TIME="18"
140148
# Keys
@@ -151,7 +159,7 @@ HTTP_CONF="nextcloud_http_domain_self_signed.conf"
151159
HTTPS_CONF="$SITES_AVAILABLE/$SUBDOMAIN.conf"
152160
HTTP2_CONF="/etc/apache2/mods-available/http2.conf"
153161
# PHP-FPM
154-
PHPVER=7.4
162+
PHPVER=8.1
155163
PHP_FPM_DIR=/etc/php/$PHPVER/fpm
156164
PHP_INI=$PHP_FPM_DIR/php.ini
157165
PHP_POOL_DIR=$PHP_FPM_DIR/pool.d
@@ -200,7 +208,6 @@ turn_install() {
200208
NC_SECRET=$(gen_passwd "$SHUF" "a-zA-Z0-9@#*")
201209
SIGNALING_SERVER_CONF=/etc/signaling/server.conf
202210
}
203-
[ -n "$TURN_INSTALL" ] && turn_install # TODO: remove this line someday
204211
205212
## FUNCTIONS
206213
@@ -691,10 +698,10 @@ version(){
691698

692699
[[ $2 != "$h" && $2 != "$t" ]]
693700
}
694-
if ! version 18.04 "$DISTRO" 20.04.10
701+
if ! version 20.04 "$DISTRO" 22.04.10
695702
then
696703
print_text_in_color "$IRed" "Your current Ubuntu version is $DISTRO but must be between \
697-
18.04 - 20.04.10 to run this script."
704+
20.04 - 22.04.10 to run this script."
698705
print_text_in_color "$ICyan" "Please contact us for support upgrading your server:"
699706
print_text_in_color "$ICyan" "https://www.hanssonit.se/#contact"
700707
print_text_in_color "$ICyan" "https://shop.hanssonit.se/"
@@ -1020,13 +1027,13 @@ remove_from_trusted_domains() {
10201027

10211028
check_distro_version() {
10221029
# Check Ubuntu version
1023-
if lsb_release -sc | grep -ic "bionic" &> /dev/null || lsb_release -sc | grep -ic "focal" &> /dev/null
1030+
if lsb_release -sc | grep -ic "jammy" &> /dev/null || lsb_release -sc | grep -ic "bionic" &> /dev/null
10241031
then
10251032
OS=1
10261033
elif lsb_release -i | grep -ic "Ubuntu" &> /dev/null
10271034
then
10281035
OS=1
1029-
elif uname -a | grep -ic "bionic" &> /dev/null || uname -a | grep -ic "focal" &> /dev/null
1036+
elif uname -a | grep -ic "jammy" &> /dev/null || uname -a | grep -ic "bionic" &> /dev/null
10301037
then
10311038
OS=1
10321039
elif uname -v | grep -ic "Ubuntu" &> /dev/null
@@ -1043,8 +1050,8 @@ You can find the download link here: https://www.ubuntu.com/download/server"
10431050
exit 1
10441051
fi
10451052

1046-
if ! version 18.04 "$DISTRO" 20.04.10; then
1047-
msg_box "Your current Ubuntu version is $DISTRO but must be between 18.04 - 20.04.10 to run this script."
1053+
if ! version 20.04.10 "$DISTRO" 22.04.10; then
1054+
msg_box "Your current Ubuntu version is $DISTRO but must be between 20.04 - 22.04.10 to run this script."
10481055
msg_box "Please contact us to get support for upgrading your server:
10491056
https://www.hanssonit.se/#contact
10501057
https://shop.hanssonit.se/"
@@ -1096,7 +1103,7 @@ then
10961103
10971104
To bypass this check, comment out (add # before the line) 'ram_check X' in the script that you are trying to run.
10981105
1099-
In nextcloud_install_production.sh you can find the check somewhere around line #98.
1106+
In nextcloud_install_production.sh you can find the check somewhere around line #48.
11001107
11011108
Please note this may affect performance. USE AT YOUR OWN RISK!"
11021109
exit 1
@@ -1169,7 +1176,7 @@ version(){
11691176

11701177
[[ $2 != "$h" && $2 != "$t" ]]
11711178
}
1172-
if version 18.04 "$DISTRO" 20.04.10
1179+
if version 20.04 "$DISTRO" 22.04.10
11731180
then
11741181
print_text_in_color "$ICyan" "Testing if network is OK..."
11751182
if site_200 github.com
@@ -1194,7 +1201,7 @@ then
11941201
fi
11951202
fi
11961203
else
1197-
msg_box "Your current Ubuntu version is $DISTRO but must be between 18.04 - 20.04.10 to run this script."
1204+
msg_box "Your current Ubuntu version is $DISTRO but must be between 20.04 - 22.04.10 to run this script."
11981205
msg_box "Please contact us to get support for upgrading your server:
11991206
https://www.hanssonit.se/#contact
12001207
https://shop.hanssonit.se/"

0 commit comments

Comments
 (0)