It is important to keep software up-to-date. Many packages in a Linux distribution are updated frequently to fix bugs, add features, and protect against security exploits. When you first launch and connect to an Amazon Linux instance, you may see a message asking you to update software packages for security purposes. This section shows how to update an entire system, or just a single package.
These procedures are intended for use with Amazon Linux. For more information about other distributions, see their specific documentation.
(Optional) Start a screen session in your shell window. Sometimes you may experience a network interruption that can disconnect the SSH connection to your instance. If this happens during a long software update, it can leave the instance in a recoverable, although confused state. A screen session allows you to continue running the update even if your connection is interrupted, and you can reconnect to the session later without problems.
Execute the screen command to begin the session.
If your session is disconnected, log back into your instance and list the available screens.
Reconnect to the screen using the screen -r command and the process ID from the previous command.
When you are finished using screen, use the exit command to close the session.
Run the yum update command. Optionally, you can add the --security flag to apply only security updates.
Review the packages listed, type y, and press Enter to accept the updates. Updating all of the packages on a system can take several minutes. The yum output shows the status of the update while it is running.
(Optional) Reboot your instance to ensure that you are using the latest packages and libraries from your update; kernel updates are not loaded until a reboot occurs. Updates to any glibc libraries should also be followed by a reboot. For updates to packages that control services, it may be sufficient to restart the services to pick up the updates, but a system reboot ensures that all previous package and library updates are complete.
Use this procedure to update a single package (and its dependencies) and not the entire system.
Run the yum update command with the name of the package you would like to update.
Review the package information listed, type y, and press Enter to accept the update or updates. Sometimes there will be more than one package listed if there are package dependencies that must be resolved. The yum output shows the status of the update while it is running.