Cheat Sheets › Amazon Linux 1

Amazon Linux 1: Keeping It Running

Checking and managing software with yum on Amazon Linux 1 servers, which no longer get updates. For Ubuntu servers, see Software on Ubuntu 24.04.

READ-ONLY only looks; safe CHANGES THINGS be careful ON THE SERVER type it after logging in to the server $ = you type this

Know where you stand

#1The situation

⚠ END OF LIFEAmazon Linux 1 reached end of life on December 31, 2023. Since January 1, 2024, AWS provides no security updates or bug fixes for it.
What that means in practice
  • yum update brings no new fixes. At most it offers the last versions released before end of life.
  • No newer PHP or Apache. Amazon's own repositories stop at PHP 7.3. If a server runs a newer PHP (Moodle 4.x needs 7.4 or later), it was installed another way, for example built by hand or from an outside repository. Check with php -v and section 2.
  • Security holes found from 2024 on stay open, in the operating system, OpenSSL, Apache, and PHP.
  • The servers keep running normally. Nothing switches off; they just stop getting fixed.
The goal for these servers

Keep them stable, change as little as possible, and move each site to an Ubuntu 24.04 server when you can. This sheet is about the first part: look a lot, change little, and change carefully.

Confirm a server is Amazon Linux 1 (read-only)
cat /etc/system-release Amazon Linux AMI release 2018.03

Amazon Linux AMI = Amazon Linux 1. (Amazon Linux 2 says Amazon Linux release 2; Ubuntu has no such file.)

↑ Back to top

#2What's installed?

READ-ONLYON THE SERVER

All of these only look. Useful before moving a site to Ubuntu: they tell you exactly what the new server needs.

QuestionCommand
Which PHP version?php -v
Which Apache version?httpd -v
Which PHP packages are installed?yum list installed | grep -i php
Everything installedyum list installed
Details on one packageyum info httpd24
Which package owns a file?rpm -qf /usr/bin/php
Which kernel is running?uname -r
Example: the PHP packages (Amazon's own PHP 7.3)
yum list installed | grep -i php php73.x86_64 7.3.33-1.35.amzn1 @amzn-updates php73-cli.x86_64 7.3.33-1.35.amzn1 @amzn-updates php73-gd.x86_64 7.3.33-1.35.amzn1 @amzn-updates php73-intl.x86_64 7.3.33-1.35.amzn1 @amzn-updates php73-mysqlnd.x86_64 7.3.33-1.35.amzn1 @amzn-updates
php73-gdPackage name. On Amazon Linux 1, the PHP and Apache version is part of the name: php73, httpd24.
.x86_64The type of processor it's built for.
7.3.33-1.35.amzn1The exact version. amzn1 = built for Amazon Linux 1.
@amzn-updatesWhich repository it came from.

If php -v shows a newer PHP than this list, or the list is empty, PHP wasn't installed from Amazon's repository. which php shows where it lives.

MOODLE NOTEBefore moving a site to Ubuntu, save this server's PHP package list (yum list installed | grep -i php > ~/php-packages.txt) and its php -v. Together with the Moodle version, it tells you which PHP the new server needs (see the PHP table).
↑ Back to top

Changing things

#3Installing & updating, carefully

CHANGES THINGSON THE SERVER

On a system that no longer gets fixes, every change is a risk with little reward. Only install or update something when you have a specific reason, and have a snapshot first.

0. Before any change

Take an EBS snapshot or AMI of the server in the AWS console. If something breaks, that's your way back.

1. See what updates are offered (read-only)
yum check-update
  • Lists any package with a newer version available. No list = nothing to update, which is normal now.
  • If a long list appears, this server missed updates from before end of life. Don't install them all on a live server; read the list and decide.
2. Install or update one package
sudo yum install PACKAGE
sudo yum update PACKAGE

Replace PACKAGE with the name. Always name the package; a plain sudo yum update updates everything at once.

3. Read the summary, then answer
Transaction Summary ================================================ Install 1 Package (+2 Dependent packages) Total download size: 1.2 M Installed size: 4.1 M Is this ok [y/d/N]:
  • y = go ahead. N = cancel. d = download only, don't install.
  • The capital N means pressing Enter cancels. That's the opposite of Ubuntu's [Y/n].
  • Look for Remove or Erasing in the summary. If anything you rely on would be removed, answer N.
⚠ OUTSIDE REPOSITORIESSome servers may already use an outside repository or a hand-built PHP, especially those running Moodle 4.x. Leave that setup as it is. Don't add new ones: guides online suggest repositories (like EPEL or Remi) built for other systems, which can replace core packages and break Apache or PHP in ways that are hard to undo. Moving the site to Ubuntu is the real fix.
↑ Back to top

#4History: what changed, and when?

READ-ONLYON THE SERVER
List past yum runs
sudo yum history ID | Login user | Date and time | Action(s) | Altered ------------------------------------------------------------- 12 | ec2-user | 2023-06-14 10:02 | Install | 3 11 | ec2-user | 2023-02-01 09:15 | Update | 41

Newest first. ID is the run's number; Altered is how many packages it changed.

Details of one run
sudo yum history info 12

Shows the exact command and every package installed, updated, or removed in run 12.

The plain log
sudo less /var/log/yum.log

One line per package change, with the date. G jumps to the newest, q quits.

↑ Back to top

Reference

#5yum ↔ apt translation

Same jobs, different words. Handy when moving between your Amazon Linux 1 and Ubuntu servers.

JobAmazon Linux 1Ubuntu 24.04
Refresh the catalog(automatic)sudo apt update
See available updatesyum check-updateapt list --upgradable
Update everythingsudo yum updatesudo apt upgrade
Installsudo yum install NAMEsudo apt install NAME
Removesudo yum remove NAMEsudo apt remove NAME
Searchyum search WORDapt search WORD
Package detailsyum info NAMEapt show NAME
List installedyum list installedapt list --installed
Historysudo yum history/var/log/apt/history.log
Apache packagehttpd24apache2
PHP packagesphp73-…php8.3-…
"Continue?" prompt[y/d/N] Enter = no[Y/n] Enter = yes
↑ Back to top

#6Troubleshooting

READ-ONLYON THE SERVER
Another app is currently holding the yum lock; waiting for it to exit...Another yum is running. Let it finish; it waits on its own. Ctrl+C if you'd rather try later.
Cannot retrieve repository metadata / Could not retrieve mirrorlistyum can't reach a repository. The server's network may be blocked, or the old repository may no longer answer. Nothing to fix on an end-of-life system; you just can't install from there.
No package NAME available.Typo, or not offered for Amazon Linux 1. Check with yum search NAME. Package names include versions here (php73-…).
Error: Package: … Requires: …A version conflict. Answer N and leave it; forcing it can break PHP or Apache.
Exiting on user cancelYou pressed Enter at [y/d/N], which means no. Run it again and type y.
WHEN IN DOUBTOn these servers, the safe answer is usually don't change it. Note what you wanted to fix, and make it part of moving that site to Ubuntu.
↑ Back to top