1

I am currently working on upgrading PHP installation on Amazon Linux 2 instance. As all the PHP 8 modules are not available in the default EPEL repo I have planned to use the REMI repository. However when I am trying to install some of the modules they are being pulled from EPEL repo. In order to resolve this I found that one of the option is to use yum priorities plugin. However there are some posts on the web stating issues with this plugin, for instance with updates. Should I invoke "yum update" before REMI repos are added? Please advice if it is ok use this plugin.

Also after adding the new repos I have invoked commands to clean metadata and update the packages. Should I do any thing apart from that? Thanks in advance.

- name: "Install EPEL"
  become: true
  command: "amazon-linux-extras install epel=stable"

- name: install yum priorities
  become: true
  command: yum install yum-plugin-priorities

- name: Add REMI repository
  become: true
  ansible.builtin.yum_repository:
    name: remi
    description: REMI YUM repo
    file: external_repos
    baseurl: http://rpms.remirepo.net/enterprise/7/remi/$basearch/
    gpgcheck: true
    gpgkey: http://rpms.remirepo.net/RPM-GPG-KEY-remi

- name: Add PHP8.0 REMI repository
  become: true
  ansible.builtin.yum_repository:
    name: remi-php80
    description: REMI PHP8.0 repo
    file: php80_remi_repo
    baseurl: http://rpms.remirepo.net/enterprise/7/php80/$basearch/
    mirrorlist: http://cdn.remirepo.net/enterprise/7/php80/httpsmirror
    priority: 1
    gpgcheck: true
    gpgkey: http://rpms.remirepo.net/RPM-GPG-KEY-remi

- name: Add REMI Safe repository
  become: true
  ansible.builtin.yum_repository:
    name: remi-safe
    description: REMI Safe repo
    file: remi_safe_repo
    baseurl: http://rpms.remirepo.net/enterprise/7/safe/$basearch/
    mirrorlist: https://rpms.remirepo.net/enterprise/7/safe/httpsmirror
    priority: 2
    gpgcheck: true
    gpgkey: http://rpms.remirepo.net/RPM-GPG-KEY-remi

- name: clean yum metadata
  command: yum clean metadata

- name: yum update
  become: true
  command: yum -y update
Rob Wilkinson
  • 1,131
  • 5
  • 18
  • 34
  • 1
    Yes "pritority" is fine if properly configured. Also note that EL-7 is old, terribly old, and close to its end of life in a few months. For modern feature (PHP 8) use a modern distro (EL-8 or EL-9) – Remi Collet Apr 04 '23 at 05:46
  • @RemiCollet: Thanks for your response. For PHP8.0 repo, I should use the below URLs. Is it correct? baseurl: http://rpms.remirepo.net/enterprise/8/php80/$basearch/ mirrorlist: http://cdn.remirepo.net/enterprise/8/php80/httpsmirror – Rob Wilkinson Apr 04 '23 at 15:14
  • Use the mirrorlist OR the baseurl to a mirror close to you (not both) – Remi Collet Apr 05 '23 at 06:02
  • Using "remi-php80' is fine for EL-7, for EL-8 you need the "remi-modular" and command installation is different, see the wizard https://rpms.remirepo.net/wizard/ – Remi Collet Apr 05 '23 at 06:04

0 Answers0