All Products
Search
Document Center

Use scripts to automatically update software repositories in Linux instances

Last Updated: Dec 15, 2020

Overview

This article describes how to update the software repository of a Linux instance by using a script file.

Detail

Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.

The following steps describe how to use a script file to update the software repository.

Scenario

  • Can automatically detect the system and update the source.
  • This script automatically detects the system and updates the sources. You need to run this script once to automatically detect the system and update the sources.
  • The applicable systems are as follows:
    • Alibaba Cloud Linux 2
    • CentOS 5/6/7
    • Debian 6/7
    • OpenSUSE 13.1
    • Red Hat Enterprise Linux Server 5/6
    • Ubuntu 10/12.04/12.10/14.04
  • Certain sources (including official sources) may become unavailable because standard system versions are supported periodically.

Procedure

  1. Log on to the ECS instance and download the following update_source.tgz script from a directory.
  2. Switch to the root user and run the following commands in sequence:
    chmod +x update_source.sh
    sh update_source.sh
  3. Confirm that the system has updated the software source.

Application scope

  • Elastic Compute Service