How to upgrade your perfect Debian9 (Stretch) server to Debian 10 (Buster) (page 3)

botond published 2022/01/22, Sat - 23:03 time

Content

 

3. page content

 

Continuation

Az previous page we've made the full distribution and major version upgrade, and on this page we're reviewing the new Debian 10 (Buster) system, checking things on the server, and fixing the trunk, we will remove the excess packages from it.

 

Update (2023-01-31):
A new version of the description has been prepared:

 

 

What to do after an upgrade

After the server restarts, run a full review of the system again to make sure everything is working properly.

System overview

Here we look at the same things as before the update.

Query version and release information

Now read the kernel and system version information again. These can be done with the same commands as before the upgrade:

uname -a
lsb_release -a
hostnamectl
cat /etc/os-release
cat /etc/debian_version

Query Debian release information after system upgrade

Everything switched to Debian 10, leaving only the server name debian9. This can be renamed later if needed. Of course, such a name is not very viable on a live server, so there is no problem with other servers that the hostname should be changed.

Websites

Let's look at it again to our existing WordPress websitewhether it works:

WordPress website check

That's fine, so a PHP (7.4 with which this page runs), Apache it also works for sure, so we have nothing more to do here.

Web statistics

Self-hosted Matomo webstat:

Matomo web statistics

It works too, we don't have more to do here either.

phpMyAdmin

A phpMyAdmin:

phpMyAdmin 4.6.6

PhpMyAdmin also works, on the right you can see the MariaDB database server 10.3.31, which was previously version 10.1.48, and Debian 10.

The PHP version also appears a little lower, which remains version 7.0.33, and the lower panel also shows the version of phpMyAdmin, which has also not changed, so version 4.6.6 still works. These are the reasons why they have not changed.

In the Debian 9 (Stretch) release repository from the phpmyadmin package this was the latest version available. However, there is a newer version of this, but why isn't it updated with the other software? The answer is:

Debian a 10 (Buster) did not include the phpMyAdmin package egy security risk because of. Therefore, at the beginning of Debian 10, you had to manually install phpMyAdmin from the downloaded source package. Accordingly, for example, when building the Debian 10 LAMP server, so did I. this is how i installed it. In the meantime, however, the A newer version of phpMyAdmin has been added to the Debian 10 Backports repository, which is already it APT package manager can be used to install normally and receive security updates as well. Because this server was set to Backports storage, so we will now be able to get a newer version of phpMyAdmin here without having to manually download, install and configure it.

Looking at the phpMyAdmin package:

apt-get upgrade
apt-cache policy phpmyadmin

then we can see the following:

Scanning the phpmyadmin package

The first apt-get command first lists a bunch of packages to remove, which we'll deal with later, but in the end we'll see the phpmyadmin item there as a retained package. The next command will take a look at why this package is being withheld. Here you can see that Debian 9 is still upstairs, but there is also 5.0.4 in buster-backports. The package manager follows the policy, unless otherwise specified, not to use the backports container by default unless specifically requested to do so. This is important because if we did not touch on it now, our phpMyAdmin web database management system would no longer be updated for this reason. So we need to switch to upgrade the package from backports from here. To do this, issue the following command:

apt-get install phpmyadmin -t buster-backports

 

 

A -t switch (ie --target-release) instructs the package manager to perform further updates of this package from the specified package from now on. So in the future, the normal upgrade option will also upgrade from here. The output is:

Install the phpmyadmin package from the buster-backports repository

As you can see in the picture, it installs quite a few new packages that are dependencies of the new phpmyadmin package. This means that there will be a more serious update here, as another web version will be skipped by our web database manager.

Here, of course, continue with the Yes option. You will also submit a few serial version logs during the installation:

apt-listchanges: News
---------------------

phpmyadmin (4:4.9.1+dfsg1-1) unstable; urgency=low

  phpMyAdmin webbased setup is not included anymore.

 -- Matthias Blümel <debian@blaimi.de>  Tue, 22 Oct 2019 20:37:37 +0200

(press q to quit)

From this, exit the q to continue.

After a little installation, there is even a package configuration, which is already familiar:

phpmyadmin package configuration

 ┌────────────────────────────────────────────────────────┤ phpmyadmin konfigurálása ├────────────────────────────────────────────────────────┐
 │                                                                                                                                            │
 │ According to the maintainer for this package, database upgrade operations need to be performed on phpmyadmin. Typically, this is due to    │
 │ changes in how a new upstream version of the package needs to store its data.                                                              │
 │                                                                                                                                            │
 │ If you want to handle this process manually, you should refuse this option. Otherwise, you should choose this option. During the upgrade,  │
 │ a backup of the database will be made in /var/cache/dbconfig-common/backups, from which the database can be restored in the case of        │
 │ problems.                                                                                                                                  │
 │                                                                                                                                            │
 │ Perform upgrade on database for phpmyadmin with dbconfig-common?                                                                           │
 │                                                                                                                                            │
 │                                          <Igen>                                            <Nem>                                           │
 │                                                                                                                                            │
 └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Here again, it asks if you want dbconfig-common to update phpMyAdmin automatically. Select Yes here. Then configure for another 1-2 seconds and we will get our command line back.

Of course, all this will work without any problems if at that time we installed the phpMyAdmin database manager on the still Debian 9 server so that we set everything up properlyand still installed without error.

Then if we look at the phpmyadmin package again:

apt-cache policy phpmyadmin

Check the updated phpmyadmin package in the repository

You can already see version 5.0.4 here and that it is from the buster-backports repository.

Then even look at it in your browser, go back to phpMyAdmin:

Check the updated phpmyadmin package in your browser

Here, however, we get an error message describing that this version of phpMyAdmin already requires at least PHP 7.1.3, but we only have PHP 7.0.33 installed. We also mentioned earlier that the PHP version used by phpMyAdmin has not changed, so now we'll talk about why.

In fact, PHP 7.4 is already up on this server, but since we upgraded this server from Debian 9, there was still PHP 7.0 running as the default module, which hasn't changed since. Since the phpMyAdmin system is run by PHP SAPI (Server Application Programming Interface) as the default Apache module (mod_php), we still need to switch to module 7.4. To do this, run the following commands:

a2dismod php7.0
a2enmod php7.4
systemctl restart apache2

The first command disables PHP module 7.0, the second command enables module 7.4, and finally restarts Apache as it runs PHP modules.

Switch to PHP 7.4 Apache module

You can then upgrade in your browser, and after logging in you will be greeted by the new phpMyAdmin 5.0.4:

Check for updated phpmyadmin package in browser - Works

So here our version of PHP running as a module used by phpMyAdmin is newer and phpMyAdmin itself is newer. For both, we can rest assured that they will also receive updates after that.

I would like to point out here that this is a unique case, so other servers may have different versions of PHP installed. However, if you do not have any other PHP versions installed, but only inherited the default version 9.x of Debian 7.0 (Stretch) before the upgrade, you can find information on how to install newer versions of PHP on a LAMP (or any other) server:
How to install newer PHP versions on our Debian 9 (Stretch) LAMP server in PHP-FPM mode

Also worth it PHP-FPM You can also use the phpMyAdmin database manager in this mode to configure it here:
Create and configure a PHP-FPM pool for phpMyAdmin

ISPConfig

Az ISPConfigWe also look at the server status section:

ISPConfig - Server status

Everything is fine here, we have nothing more to do with it.

 

 

Roundcube

Roundcube webmail client:

Roundcube - Login

Roundcube - Inbox

I sent myself a test letter, everything is fine here too.

Munin

Let's look again at Muninalso:

Control of Munin

Well, unfortunately, this is not happening now. Since it didn't work before the update, I won't deal with it now. Maybe I'll check back or reinstall later.

As you can see, everything works before the upgrade, so the web sections will play well even after upgrading to the main version of Debian. This is followed by checking the packages.

 

Checking packages

In this last chapter, we'll put the packages in order, and we'll have to go through a few more steps.

Remove packages that have become redundant

Packages that have become redundant are packages that were previously dependent on other packages, but were updated or removed during packages so that they are no longer needed. To delete them, issue the following apt command continues rootstaying inside as:

apt --purge autoremove

A -- purge option ensures that not only the packages are removed, but also their configurations. so there is nothing left in the system after them. For me, the output is:

Remove packages that have become redundant

In this example, you want to remove 38 packages, freeing up a total of 349 MB of disk space. Continue here with Yes.

This step can also be performed as a one-time step at the end of this chapter, I will only run it here at the beginning for the sake of illustration, as this will make it clearer that even more redundant packets will be generated after the next batch operation.

Find and remove obsolete packages

Deprecated packages are "created" when we upgrade the entire Debian system, and these packages are no longer available in the newly configured repositories, but for example a newer major version of the software has been released, so this is the only way to get an update. In this case, it is a good idea to remove these packages. First, just look for these packages to see which packages have been marked as obsolete after the upgrade. You can use any of the following commands to do this:

aptitude search '~o'
aptitude search ?obsolete
apt-show-versions | grep 'No available version'

Search for obsolete packages

Search for obsolete packages

Here we get a longer list than before the upgrade, which is natural since many packages are no longer available in the Debian 10 repositories.

Another interesting thing is that when searching before the upgrade, it also listed the manually installed jailkit package, where I wrote afterwards that we don't need to delete it, because it will be available in the Debian 10 backports repository. That's right, so it's now out of the obsolete package, as you'll continue to receive updates.

However, you should be careful when deleting these packages, as you may be able to mark packages that you are already using but no longer update, such as the jailkit package at the beginning. Of course, there is no such package here right now, but there may be some other systems that may still be needed. Therefore, I suggest here that we review this list, look in the current package for their fresh counterparts, and only delete them if we are sure they are no longer needed.

Just an example of looking for packages that contain "cpp-" or "gcc-":

Check for obsolete packages

Here it is nice to see that the version 6 packages are still from Debian 9 and they already have their equivalent with the main version 8. Of course, there are other packages here that are dependent on them, so if we remove these obsolete packages, we will have redundant packages again, so they will have to be deleted afterwards. In this situation, therefore, a cpp-6 and the gcc-6 we can safely remove packages without causing any trouble.

 

 

To avoid damaging our system, it's a good idea to first make a list of these obsolete packages and pick out any that might be needed. You can easily create a list of package names awk command:

aptitude search '~o' | awk '$4 == "-" {print $3; next}; {print $2}'

Create a list of obsolete packages using the awk command

but we can get the same output a cut also using the command:

aptitude search '~o' | cut -d' ' -f3

Then redirect it to a file with one of the commands that is more sympathetic to its output:

aptitude search '~o' | awk '$4 == "-" {print $3; next}; {print $2}' > elavult_csomagok.txt

Then we raisin out the packages we might still need. You can also use the nano editor for this:

nano ./elavult_csomagok.txt

When done, save and then delete the remaining packages in the file from a command:

apt-get --purge remove $(cat elavult_csomagok.txt)

Delete obsolete packages based on the list

As you can see, in the meantime we have already had other redundant packages, which we will delete again at the end. Continue here with Yes.

The package manager then retrieves the listed packages.

Re-delete redundant packages

Then run the command to remove the redundant packages again:

apt --purge autoremove

Re-delete redundant packages

Of course, it's a good idea to run this here once in the end, just for the sake of example.

Empty the package cache

Finally, empty the package cache that many packages have already accessed during the upgrade:

du -sh /var/cache/apt/archives
apt-get clean
du -sh /var/cache/apt/archives

Empty the package cache

412 Mb of space is now available.

So our packages are now perfectly fine, which we can check with an upgrade command:

apt-get upgrade

Packages are fine

(0 updated, 0 newly installed, 0 removed, and 0 not updated.)

 

 

Conclusion

In this three-page description, we've successfully updated Debian 9 (Stretch) the perfect server, For Debian 10 (Buster), which has a lot of features and settings, so upgrading was much more complex than a field desktop system. Later, of course, I'll even make an up-to-date description with a machine with a desktop environment, so use it with health if someone needs to update a server like this or something similar.

 

 

Navigation

This description consists of several pages: