-->

DEVOPSZONES

  • Recent blogs

    How do I install a package (php 7.4 or 7.3 or 7.2) from the Extras Library on an EC2 instance running Amazon Linux 2?

    How do I install a package (php 7.4 or 7.3 or 7.2) from the Extras Library on an EC2 instance running Amazon Linux 2 

    1.    Connect to your EC2 Linux instance using SSH.

    2.    Use the which command to confirm that the amazon-linux-extras package is installed:

    # which amazon-linux-extras
    /usr/bin/amazon-linux-extras

    If the amazon-linux-extras package isn't installed, use yum to install it:

    # yum install -y amazon-linux-extras

    3.    List the available topics.


    Myserver #amazon-linux-extras  0  ansible2                 available    \
            [ =2.4.2  =2.4.6  =2.8  =stable ]
      2  httpd_modules            available    [ =1.0  =stable ]
      3  memcached1.5             available    \
            [ =1.5.1  =1.5.16  =1.5.17 ]
      5  postgresql9.6            available    \
            [ =9.6.6  =9.6.8  =stable ]
      6  postgresql10             available    [ =10  =stable ]
      9  R3.4                     available    [ =3.4.3  =stable ]
     10  rust1                    available    \
            [ =1.22.1  =1.26.0  =1.26.1  =1.27.2  =1.31.0  =1.38.0
              =stable ]
     11  vim                      available    [ =8.0  =stable ]
     18  libreoffice              available    \
            [ =5.0.6.2_15  =5.3.6.1  =stable ]
     19  gimp                     available    [ =2.8.22 ]
     20  docker=latest            enabled      \
            [ =17.12.1  =18.03.1  =18.06.1  =18.09.9  =stable ]
     21  mate-desktop1.x          available    \
            [ =1.19.0  =1.20.0  =stable ]
     22  GraphicsMagick1.3        available    \
            [ =1.3.29  =1.3.32  =1.3.34  =stable ]
     23  tomcat8.5                available    \
            [ =8.5.31  =8.5.32  =8.5.38  =8.5.40  =8.5.42  =8.5.50
              =stable ]
     24  epel                     available    [ =7.11  =stable ]
     25  testing                  available    [ =1.0  =stable ]
     26  ecs                      available    [ =stable ]
     27  corretto8                available    \
            [ =1.8.0_192  =1.8.0_202  =1.8.0_212  =1.8.0_222  =1.8.0_232
              =1.8.0_242  =stable ]
     28  firecracker              available    [ =0.11  =stable ]
     29  golang1.11               available    \
            [ =1.11.3  =1.11.11  =1.11.13  =stable ]
     30  squid4                   available    [ =4  =stable ]
     32  lustre2.10               available    \
            [ =2.10.5  =2.10.8  =stable ]
     33  java-openjdk11           available    [ =11  =stable ]
     34  lynis                    available    [ =stable ]
     35  kernel-ng                available    [ =stable ]
     36  BCC                      available    [ =0.x  =stable ]
     37  mono                     available    [ =5.x  =stable ]
     38  nginx1                   available    [ =stable ]
     39  ruby2.6                  available    [ =2.6  =stable ]
     40  mock                     available    [ =stable ]
     41  postgresql11             available    [ =11  =stable ]
     42  php7.4=latest            enabled      [ =stable ]
     43  livepatch                available    [ =stable ]
     44  python3.8                available    [ =stable ]
     45  haproxy2                 available    [ =stable ]
     46  collectd                 available    [ =stable ]
     47  aws-nitro-enclaves-cli   available    [ =stable ]
     48  R4                       available    [ =stable ]
     49  kernel-5.4               available    [ =stable ]
     50  selinux-ng               available    [ =stable ]
      _  php8.0                   available    [ =stable ]
     52  tomcat9                  available    [ =stable ]
     53  unbound1.13              available    [ =stable ]
     54  mariadb10.5              available    [ =stable ]
     55  kernel-5.10              available    [ =stable ]
     56  redis6                   available    [ =stable ]
     57  ruby3.0                  available    [ =stable ]
     58  postgresql12             available    [ =stable ]
     59  postgresql13             available    [ =stable ]
     60  mock2                    available    [ =stable ]
     61  dnsmasq2.85              available    [ =stable ]
    Myserver #

    4.    Enable the desired topic. The output shows the commands required for installation. For example, to enable the PHP 7.4 topic, use the following command:


    # amazon-linux-extras enable php7.4

    5.    Install the topic using yum. For example, to install the PHP 7.2 topic, use the following command:

    # yum clean metadata && sudo yum install php-cli php-pdo php-fpm php-json php-mysqlnd

    6.    Use the following commands to verify the installation and confirm the software version:

    Myserver #yum list installed php-cli php-pdo php-fpm php-json php-mysqlnd
    Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
    Installed Packages
    php-cli.x86_64                                                                  7.4.28-1.amzn2                                                               @amzn2extra-php7.4
    php-fpm.x86_64                                                                  7.4.28-1.amzn2                                                               @amzn2extra-php7.4
    php-json.x86_64                                                                 7.4.28-1.amzn2                                                               @amzn2extra-php7.4
    php-mysqlnd.x86_64                                                              7.4.28-1.amzn2                                                               @amzn2extra-php7.4
    php-pdo.x86_64                                                                  7.4.28-1.amzn2                                                               @amzn2extra-php7.4
    Myserver #
    $ which php
    /usr/bin/php        
    
    Myserver #php --version
    PHP 7.4.28 (cli) (built: Feb 28 2022 23:38:08) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
    Myserver #


    No comments