How to install Magento 2.4 and build a web server - Magento 2 Tutorial

I have a problem with downgrading to the previous version, what should I do?

login as: magento
[email protected]'s password:
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-107-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Wed Jun  1 14:59:18 UTC 2022

  System load:  0.0               Users logged in:       0
  Usage of /:   4.4% of 77.36GB   IPv4 address for eth0: 188.166.97.74
  Memory usage: 51%               IPv4 address for eth0: 10.18.0.5
  Swap usage:   0%                IPv4 address for eth1: 10.110.0.2
  Processes:    140

62 updates can be applied immediately.
38 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable


Last login: Wed Jun  1 14:34:04 2022 from 188.217.79.109
[email protected]:~$ composer self-update 1.10.16
Upgrading to version 1.10.16 (stable channel).


In SelfUpdateCommand.php line 493:

  Filesystem exception:
  Composer update failed: "/usr/local/bin/composer" could not be written.
  rename(/home/magento/.cache/composer/composer-temp7116477.phar,/usr/local/bin/composer): Permission denied


self-update [-r|--rollback] [--clean-backups] [--no-progress] [--update-keys] [--stable] [--preview] [--snapshot] [--1] [--2] [--2.2] [--set-channel-only] [--] [<version>]

[email protected]:~$