Install PHP8.2 version on ubuntu18.04
1. Replace the domestic source and use the agent of the University of Science and Technology of China
/etc/apt/sources.list.d needs the warehouse address of the proxy,
- 1. Replace http://ppa.launchpad.net with https://launchpad.proxy.ustclug.org
- 2. Change http to https
If there is no ppa source address in /etc/apt/sources.list, then search for ppa source address in /etc/apt/sources.list.d and replace it according to the search result
Step 1: Find the ppa source address
root@apig:/etc/apt/sources.list.d# find ./ | xargs grep "launchpad"
grep: ./: 是一个目录
./oisf-ubuntu-suricata-stable-bionic.list.save:deb http://ppa.launchpad.net/oisf/suricata-stable/ubuntu bionic main
./oisf-ubuntu-suricata-stable-bionic.list.save:# deb-src http://ppa.launchpad.net/oisf/suricata-stable/ubuntu bionic main
./ondrej-ubuntu-php-bionic.list:deb http://ppa.launchpad.net/ondrej/php/ubuntu bionic main
./ondrej-ubuntu-php-bionic.list:# deb-src http://ppa.launchpad.net/ondrej/php/ubuntu bionic main
./oisf-ubuntu-suricata-stable-bionic.list:deb http://ppa.launchpad.net/oisf/suricata-stable/ubuntu bionic main
./oisf-ubuntu-suricata-stable-bionic.list:# deb-src http://ppa.launchpad.net/oisf/suricata-stable/ubuntu bionic main
./ondrej-ubuntu-php-bionic.list.save:deb http://ppa.launchpad.net/ondrej/php/ubuntu bionic main
./ondrej-ubuntu-php-bionic.list.save:# deb-src http://ppa.launchpad.net/ondrej/php/ubuntu bionic main
Step 2, replace the source in turn
vi ./oisf-ubuntu-suricata-stable-bionic.list.save
vi ./oisf-ubuntu-suricata-stable-bionic.list
deb https://launchpad.proxy.ustclug.org/linuxuprising/shutter/ubuntu focal main
# deb-src https://launchpad.proxy.ustclug.org/linuxuprising/shutter/ubuntu focal main
Install php8.2
sudo apt install software-properties-common
sudo apt update
sudo apt install php8.2
php -v
install composer
# 安装----安装时,请看以下说明
apt install composer
# 替换国内源
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
Note: If you directly apt-get install composer, the php7 version of composer will be installed directly. When the higher version of PHP is updated, the composer update will show Command “self-update” is not defined
I am using the ubuntu18.04 version. The reason for this problem is that the composer in the ubuntu library cannot complete self-update.
So we have to remove the original composer first:
sudo apt-get remove composer
After the removal is successful, download composer in the official way of composer:
curl -sS https://getcomposer.org/installer | php
And move the downloaded composer.phar to the directory specified by the following command, so that all users can use composer globally:
sudo mv composer.phar /usr/bin/composer
chmod +x /usr/local/bin/composer
Finish typing:
composer
You will get a new version of the complete composer, you can use it normally