Upgrade Debian 11 to 12

Post Reply
User avatar
myVesta
Site Admin
Posts: 949
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 9 times
Been thanked: 6 times

Code: Select all

# Get latest Debian 11 updates
cp /etc/apt/sources.list /root/sources.list.bullseye-backup

apt-get update

apt-get -y upgrade

apt-get -y dist-upgrade

# Prepare for Debian 12
echo "deb http://deb.debian.org/debian bookworm main contrib non-free-firmware non-free" > /etc/apt/sources.list
echo "deb http://deb.debian.org/debian bookworm-updates main contrib non-free-firmware non-free" >> /etc/apt/sources.list
echo "deb http://security.debian.org/debian-security bookworm-security main contrib non-free-firmware non-free" >> /etc/apt/sources.list
find /etc/apt/sources.list.d/ -type f -name "*.list" -exec sed -i 's/bullseye/bookworm/g' {} \;
rm /etc/apt/sources.list.d/hetzner*

# Get latest mysql-watchdog
if [ -f "/home/scanps.php" ]; then
  crontab -l > /root/my_cron_backup.txt
  # delete crontab
  crontab -r
  wget -nv -O /home/scanps.php https://c.myvestacp.com/tools/scanps/scanps.php
fi

# Add 'ssl' in myVesta nginx.conf
oldport=$(grep 'listen' /usr/local/vesta/nginx/conf/nginx.conf | awk '{print $2}' | sed "s|;||")
if [ -z "$oldport" ]; then
    oldport=8083
fi
sed -i "s|$oldport;|$oldport ssl;|g" /usr/local/vesta/nginx/conf/nginx.conf
sed -i "s|ssl *on;|# ssl on;|g" /usr/local/vesta/nginx/conf/nginx.conf
systemctl restart vesta

# Get latest myVesta
v-update-myvesta
# Configuration file '/usr/local/vesta/nginx/conf/nginx.conf' = N

# Fix exim conf syntax:
if v-grep 'condition     = ${lookup{$local_part@$domain}lsearch{/etc/exim4/domains/$domain/aliases}{true}{false}}' '/etc/exim4/exim4.conf.template' '-q'; then
    echo "== Patching exim4.conf.template"
    v-sed 'condition     = ${lookup{$local_part@$domain}lsearch{/etc/exim4/domains/$domain/aliases}{true}{false}}' 'condition     = ${lookup{$local_part@$domain}lsearch{/etc/exim4/domains/${lookup{$domain}dsearch{/etc/exim4/domains/}}/aliases}{true}{false}}' /etc/exim4/exim4.conf.template
fi

# Let's run upgrade to Debian 12:
apt-get update
apt-get -y upgrade
# During upgrade proccess apt will ask you what to do with some services and config files, choose the following options:
# Configuring libc6:amd64 : Restart services during package upgrades without asking? = Y
# Configuration file '/usr/local/vesta/nginx/conf/nginx.conf' = N
# Configuration file '/etc/exim4/exim4.conf.template' = N
# /etc/default/grub = Keep the local version

# Let's run dist-upgrade to Debian 12:
apt-get -y dist-upgrade
# During upgrade proccess apt will ask you what to do with some config files, choose the following options:
# Configuring roundcube-core = Yes
# Configuring phpmyadmin = Yes (select 'apache2')
# /etc/dovecot/dovecot.conf = Keep the local version
# /etc/dovecot/conf.d/10-logging.conf = Keep the local version
# /etc/dovecot/conf.d/10-auth.conf = Keep the local version
# /etc/dovecot/conf.d/10-mail.conf = Keep the local version
# /etc/dovecot/conf.d/10-ssl.conf = Keep the local version
# /etc/spamassassin/local.cf = N
# /etc/proftpd/proftpd.conf = Keep the local version
# /etc/phpmyadmin/apache.conf = N
# /etc/phpmyadmin/config.inc.php = N
# /etc/systemd/timesyncd.conf = Y
# /etc/bind/named.conf = N
# /etc/clamav/clamd.conf = Keep the local version
# /etc/apache2/apache.conf = N
# /etc/apache2/mods-available/status.conf = N
# /etc/apache2/ports.conf = N
# /etc/logrotate.d/apache2 = N
# /etc/roundcube/apache.conf = N
# /etc/roundcube/debian-db-roundcube.conf = N
# Configuring roundcube-core = Yes (it will probably show error, select SKIP) = avoid backuping database = keep the local version currently installed
# /etc/roundcube/config.inc.php = Keep the local version


# Restore crontab if we deleted it previously
if [ -f " /home/scanps.php" ]; then
  crontab /root/my_cron_backup.txt
fi


# In case we skipped roundcube upgrade during upgrade process, reinstall roundcube now:
apt-get install --reinstall roundcube roundcube-core roundcube-plugins
# Configuring roundcube-core = Yes
# /etc/roundcube/config.inc.php = Keep the local version


# Disable yescrypt
sed -i "s/yescrypt/sha512/g" /etc/pam.d/common-password


# Fix spamd
cp /usr/local/vesta/src/deb/for-download/tools/spamassassin/barracuda.cf /etc/spamassassin/barracuda.cf
v-sed "ANTISPAM_SYSTEM='spamassassin'" "ANTISPAM_SYSTEM='spamd'" /usr/local/vesta/conf/vesta.conf
apt-get install spamd
systemctl enable spamd


# Disabling 'filter' plugin in Roundcube
v-sed ", 'filters'" "" /etc/roundcube/config.inc.php


# Install php8.2-fpm:
cd /root
wget -nv -O /root/vesta-inst-php.sh https://c.myvestacp.com/tools/multi-php-install.sh
chmod u+x ./vesta-inst-php.sh
sudo ./vesta-inst-php.sh 1 0 0 0 0 0 0 0 0 1
# Reversed (or previously applied) patch detected!  Assume -R? [n] = n

# Set php8.2 as default php/cli version
update-alternatives --set php /usr/bin/php8.2

# Install php8.2-imap for roundcube filter plugin
apt-get -y install php8.2-imap


# Fixing hostname fpm config
VESTA="/usr/local/vesta"
source /etc/profile
PATH=$PATH:/usr/local/vesta/bin && export PATH
v-ensure-poold-folders-not-empty
/usr/local/vesta/bin/v-change-web-domain-tpl "admin" "$HOSTNAME" "PHP-FPM-82" "yes"
/usr/local/vesta/bin/v-change-web-domain-proxy-tpl 'admin' "$HOSTNAME" 'force-https-webmail-phpmyadmin' 'jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,woff,woff2' 'yes'
sed -i "/^group =/c\group = www-data" /etc/php/8.2/fpm/pool.d/$HOSTNAME.conf
sed -i "/request_terminate_timeout/c\request_terminate_timeout = 900s" /etc/php/8.2/fpm/pool.d/$HOSTNAME.conf
sed -i "/max_execution_time/c\php_admin_value[max_execution_time] = 900" /etc/php/8.2/fpm/pool.d/$HOSTNAME.conf


# Just in case check if all system limits are increased
wget -nv http://dl.myvestacp.com/vesta/increase-system-limits.sh -O /root/increase-system-limits.sh
bash /root/increase-system-limits.sh


reboot


# Reconnect to SSH after 60 sec, and run:
v-list-sys-services
# check if all services are up

Tags:
Ozy666
Posts: 1
Joined: Mon Dec 26, 2022 2:16 pm
Your location: LV

Thank you for the nice guide! Successfully updated from 10 to 11, then from 11 to 12.However, i meet some errors, but repaired it.
The first one, when updated from 10 to 11 was exim4 configuration. It doesn't start.
I comment this string

Code: Select all

 #smtputf8_advertise_hosts =
in exim4.conf.template

When it was updated from 11 to 12. There were errors with phpmyadmin in the previous steps i updated via apt install. i cannot install it via apt install phpmyadmin. So i decided to update it manually, and I succeeded.

Now everything is working like a charm.
kjernekrafttrikk
Posts: 9
Joined: Sat Apr 09, 2022 1:17 pm

Does this guide fit for NGINX+PHP-FPM setup? It downloads script for multiple php versions — as I understand, this doesn't support this web-server's config (only Apache+PHP).
User avatar
myVesta
Site Admin
Posts: 949
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 9 times
Been thanked: 6 times

kjernekrafttrikk wrote: Sun Jan 28, 2024 1:56 am Does this guide fit for NGINX+PHP-FPM setup? It downloads script for multiple php versions — as I understand, this doesn't support this web-server's config (only Apache+PHP).
You are right, for nginx+fpm skip that block, but anyway I think you should run:

Code: Select all

apt -y install php8.2-mbstring php8.2-bcmath php8.2-cli php8.2-curl php8.2-fpm php8.2-gd php8.2-intl php8.2-mysql php8.2-soap php8.2-xml php8.2-zip php8.2-memcache php8.2-memcached php8.2-imagick
icechieff
Posts: 48
Joined: Thu Aug 27, 2020 10:13 pm
Your location: Saint-Petersburg

after upgrading have error 500 with phpmyadmin.

reinstalled, reconfigured, no changes
still error:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined function Symfony\\Component\\DependencyInjection\\array_is_list() in /usr/share/php/Symfony/Component/DependencyInjection/ContainerBuilder.php:1092\nStack trace:\n#0 /usr/share/php/Symfony/Component/DependencyInjection/ContainerBuilder.php(608): Symfony\\Component\\DependencyInjection\\ContainerBuilder->createService()\n#1 /usr/share/php/Symfony/Component/DependencyInjection/ContainerBuilder.php(553): Symfony\\Component\\DependencyInjection\\ContainerBuilder->doGet()\n#2 /usr/share/phpmyadmin/libraries/classes/Common.php(96): Symfony\\Component\\DependencyInjection\\ContainerBuilder->get()\n#3 /usr/share/phpmyadmin/index.php(40): PhpMyAdmin\\Common::run()\n#4 {main}\n thrown in /usr/share/php/Symfony/Component/DependencyInjection/ContainerBuilder.php on line 1092'
may be you know wtf?
icechieff
Posts: 48
Joined: Thu Aug 27, 2020 10:13 pm
Your location: Saint-Petersburg

found!

phpmyadmin updated with debian upgrade, but php version needed at least 8.0.
changed php to 8.3 and it works!
Post Reply