I install php8.1 following on this website
https://computingforgeeks.com/how-to-install-php-8-on-amazon-linux/
librenms on this website
https://docs.librenms.org/Installation/Installation-CentOS-7-Nginx/
And it did show the version with this command
php81 --version
but it will show "php command not found" on this command
php --version
after that I wanna install librenms and I follow the instructions on the librenms-documents and type this installation command
yum install composer cronie fping git ImageMagick jwhois mariadb mariadb-server mtr MySQL-python net-snmp net-snmp-utils nginx nmap php-fpm php-cli php-common php-curl php-gd php-mbstring php-process php-snmp php-xml php-zip php-memcached php-mysqlnd python-memcached rrdtool python3 python3-pip
the error will come out like this
Error: Package: php-pecl-memcached-3.2.0-1.el7.remi.8.1.x86_64 (remi-php81)
Requires: php(api) = 20210902-64
Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.1.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.2.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.3.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.4.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-45.amzn2.0.5.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-45.amzn2.0.6.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-46.amzn2.0.2.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-8.0.0-2.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.2-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.6-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.8-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.13-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.16-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.18-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Installing: php-common-8.0.20-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Error: Package: php-pecl-igbinary-3.2.9-1.el7.remi.8.1.x86_64 (remi-php81)
Requires: php(api) = 20210902-64
Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.1.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.2.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.3.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.4.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-45.amzn2.0.5.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-45.amzn2.0.6.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-46.amzn2.0.2.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-8.0.0-2.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.2-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.6-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.8-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.13-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.16-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.18-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Installing: php-common-8.0.20-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Error: Package: php-pecl-igbinary-3.2.9-1.el7.remi.8.1.x86_64 (remi-php81)
Requires: php(zend-abi) = 20210902-64
Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.1.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.2.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.3.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.4.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-45.amzn2.0.5.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-45.amzn2.0.6.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-46.amzn2.0.2.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-8.0.0-2.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.2-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.6-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.8-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.13-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.16-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.18-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Installing: php-common-8.0.20-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Error: Package: php-pecl-msgpack-2.2.0~RC2-1.el7.remi.8.1.x86_64 (remi-php81)
Requires: php(api) = 20210902-64
Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.1.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.2.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.3.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-43.amzn2.0.4.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-45.amzn2.0.5.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-45.amzn2.0.6.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-5.4.16-46.amzn2.0.2.x86_64 (amzn2-core)
php(api) = 20100412-64
Available: php-common-8.0.0-2.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.2-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.6-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.8-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.13-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.16-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Available: php-common-8.0.18-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Installing: php-common-8.0.20-1.amzn2.x86_64 (amzn2extra-php8.0)
php(api) = 20200930-64
Error: Package: php-pecl-msgpack-2.2.0~RC2-1.el7.remi.8.1.x86_64 (remi-php81)
Requires: php(zend-abi) = 20210902-64
Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.1.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.2.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.3.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.4.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-45.amzn2.0.5.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-45.amzn2.0.6.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-46.amzn2.0.2.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-8.0.0-2.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.2-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.6-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.8-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.13-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.16-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.18-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Installing: php-common-8.0.20-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Error: Package: php-pecl-memcached-3.2.0-1.el7.remi.8.1.x86_64 (remi-php81)
Requires: php(zend-abi) = 20210902-64
Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.1.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.2.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.3.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-43.amzn2.0.4.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-45.amzn2.0.5.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-45.amzn2.0.6.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-5.4.16-46.amzn2.0.2.x86_64 (amzn2-core)
php(zend-abi) = 20100525-64
Available: php-common-8.0.0-2.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.2-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.6-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.8-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.13-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.16-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Available: php-common-8.0.18-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
Installing: php-common-8.0.20-1.amzn2.x86_64 (amzn2extra-php8.0)
php(zend-abi) = 20200930-64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
php-fpm is available in Amazon Linux Extra topic "php7.4"
To use, run
# sudo amazon-linux-extras install php7.4
php-cli is available in Amazon Linux Extra topic "php7.4"
To use, run
# sudo amazon-linux-extras install php7.4
php-mysqlnd is available in Amazon Linux Extra topic "php7.4"
To use, run
# sudo amazon-linux-extras install php7.4
Learn more at
https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras
If I using the argument "--skip-broken" and install again,it will made php8.1 to php 8.0
And if I using the command below,it will also downgrade the version of php
sudo amazon-linux-extras install php7.4
I just want it to install normally and stay in the version of php8.1.
Also,want it to show the version 8.1 with the command
php --version (not php81 --version)
how could I do??
My Answer:
To install PHP 8.1 and LibreNMS on Amazon Linux 2 with Remi repository, follow these steps:
1. Enable the Remi repository on your Amazon Linux 2 instance by running the following commands:
bash
sudo amazon-linux-extras enable epel
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
2. Install PHP 8.1 and required PHP extensions using the following commands:
bash
sudo yum-config-manager --enable remi-php81
sudo yum install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json
3. Install MariaDB (or any other database server of your choice) and create a database for LibreNMS:
bash
sudo yum install mariadb-server
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
mysql -u root -p
CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
exit
4. Install required packages for LibreNMS:
bash
sudo yum install net-snmp fping git
5. Clone the LibreNMS repository and install dependencies:
bash
cd /opt
sudo git clone https://github.com/librenms/librenms.git
cd librenms
sudo ./scripts/composer_wrapper.php install --no-dev
6. Configure LibreNMS by copying the configuration file and setting permissions:
bash
sudo cp config.php.default config.php
sudo chown -R apache:apache /opt/librenms
sudo chmod -R 775 /opt/librenms
7. Set up a virtual host for LibreNMS in Apache:
bash
sudo vi /etc/httpd/conf.d/librenms.conf
Add the following configuration:
DocumentRoot /opt/librenms/html/
ServerName your_domain_or_ip
AllowOverride All
Options FollowSymLinks MultiViews
Require all granted
8. Restart Apache and start the LibreNMS poller service:
bash
sudo systemctl restart httpd
sudo systemctl enable librenms
sudo systemctl start librenms
9. Access LibreNMS in your web browser by navigating to `http://your_domain_or_ip` and follow the on-screen instructions to complete the setup.
That's it! You have successfully installed PHP 8.1 and LibreNMS on Amazon Linux 2 with Remi repository.
Rate this post
3 of 5 based on 1228 votesComments