A convenient way to maintain the test environment is automatic updating. However, remember to set the backup, e.g. the day before – I always set it like that in proxmoxe. The script that updates the Debian system looks like this:
Shell
1
2
3
4
5
6
# cat /root/update.sh
#!/bin/bash
apt-getupdate
apt-getupgrade-q-y
apt-getautoremove-y-q
rm-rf/var/cache/apt/archives/*.deb
You can download the script from:
Shell
1
2
$cd/root/
$wget https://soban.pl/bash/update.sh
The script cleans unnecessary deb files after the update. Keep in mind the permissions and capabilities of the script:
Shell
1
# chmod +x /root/update.sh
In crontab, I set the day after automatic backup in proxmoxe:
Shell
1
104**3/root/update.sh>/dev/null2>&1
Of course, the script can be added in the production environment, but it should not be added to the crontab.
Before we start upgrading the Debian system version, please make a snapshot or a possible backup of the system. Such a change entails significant changes that can damage the system. Of course, before you upgrade the system in production, it is best to upgrade to the testing environment first. The upgrade process affects the entire system. Services may not be available at this time. If the system is doing the hosting for your website then it may not be available!
Always bear in mind that the production environment is different from test environment, so I recommend that you do it carefully. A good practice is to keep a time interval between the upgrade of test and production environment, in my case it is a week. Remember not to make changes to production on Friday!
This is how we check the version of the system:
And now, we going to update OS, but before we do that – we will make copy of:
Shell
1
cp/etc/apt/sources.list/root/sources.list_buster
There is sorces setup for buster:
Shell
1
2
3
4
5
6
# cat /etc/apt/sources.list
deb http://ftp.debian.org/debian buster main contrib
deb http://ftp.debian.org/debian buster-updates main contrib
deb http://security.debian.orgbuster/updates main contrib
Now you need get some the system upgrade process has started. You can go for a coffee, or not 😉 There will be questions. And more information, albout apt listchanges:
Just press ‘q’ and enter.
In this case we press enter.
Services to restart:
Enter agien.
This is question, about ssh deamon configuration:
In my case, I press enter because I don’t want to make changes to its configuration.
If all went well, we can reboot the system:
Shell
1
# reboot
Now check the system:
Congratulations, we are on the new version of the system! At this point, we can verify all services, for example whether the website is working properly. If it is OK, upgrade the production environment.
In my cases, I have problem PHP new version. PHP have no persmision on nginx to user – when I try enter to page: