Aliyun Linux 2 is a next-generation operating system developed by Alibaba Cloud. It provides a safe, stable, and high-performance running environment for applications on ECS instances. Aliyun Linux 2 is a Linux distribution that is deeply optimized for cloud infrastructure to offer unparalleled runtime experience. You can create an instance by using the Aliyun Linux 2 public image for free, and obtain long-term technical support for operating systems from Alibaba Cloud.

For more information about the features of Aliyun Linux 2, visit Aliyun Linux 2 product page.

Scope of application

Aliyun Linux 2 is suitable for the following scenarios:
  • Various workloads in cloud environments, such as databases, cloud native containers, data analytics, web applications, and workloads in the production environment.
  • Various instance families including ECS Bare Metal Instance families. For more information, see Instance families.
    • Aliyun Linux 2 supports instance types that have 1 to 160 vCPUs.
    • Aliyun Linux 2 supports instance types that have memory of 0.5 GiB to 3,840 GiB.
    • Aliyun Linux 2 does not support instances in classic networks or non-I/O optimized instances.

Benefits

Compared with other Linux distributions, Aliyun Linux 2 has the following benefits:
  • It is optimized for ECS instances, and features faster system startup and better runtime performance.
  • It provides the latest enhanced features of the Linux community to power cloud-based application environments.
  • It provides richer operating system features through the updated Linux kernel, user-mode applications, and toolkits.
  • It has streamlined the kernel and reduced potential security risks.
  • It is free to use and provided with Alibaba Cloud technical support.

Features

  • Aliyun Linux 2 is equipped with the latest version of the Alibaba Cloud kernel. The kernel provides the following features:
    • Customization based on the 4.19.24 kernel that has been supported by the kernel community, more new features for cloud scenarios, improved performance, and bug fixes.
    • Customized and optimized kernel startup parameters and system configuration parameters for the ECS instance environment.
    • Kdump. You can enable or disable this feature without the need to reboot the operating system.
    • Kernel Live Patching (KLP).
  • The software package has a pre-installed item and changes as follows:
    • Aliyun Linux 2 is pre-installed with Alibaba Cloud CLI.
    • The network module is changed to systemd-networkd from network.service .
    • The user-mode package is compatible with CentOS 7.6.1810 and can run on Aliyun Linux 2.
    • Fixes for Common Vulnerabilities and Exposures (CVEs) are continuously updated until the end of life (EOL) of Aliyun Linux 2.
  • Aliyun Linux 2 speeds up the boot process and improves system performance at runtime in the following ways:
    • It has an optimized startup speed to better fit in with ECS instance environments.
    • It is optimized for multi-threaded scenarios in ECS instance environments and delivers improved multi-threaded performance for high-specification instances.
    • It is optimized holistically to better fit in with MySQL database scenarios and can be used in combination with enhanced SSDs to deliver significantly improved performance.

Obtain Aliyun Linux 2

You can use the following methods to obtain Aliyun Linux 2:
  • Create an ECS instance or replace the system disk of an existing ECS instance:
  • Download Aliyun Linux 2 to an on-premises environment:

    Download the Aliyun Linux 2 image to an on-premises environment such as a local server or virtualization environment, and then install and start the image. For more information, visit GitHub to see Aliyun Linux 2 On Premise Image.

Use Aliyun Linux 2

  • View or modify system parameters

    Aliyun Linux 2 has updated the following kernel configuration parameters in the/etc/sysctl.d/50-aliyun.conf file. You can run the sysctl command to view or modify the system parameters of Aliyun Linux 2 at runtime.

    System parameter setting Description
    kernel.hung_task_timeout_secs = 240 Increases the kernel hung_task timeout seconds to avoid frequent hung_task prompts.
    kernel.panic_on_oops = 1 Throws the kernel panic exception when the kernel is experiencing an Oops error. Crash details are automatically captured if Kdump is configured.
    kernel.watchdog_thresh = 50 Increases the thresholds for events such as hrtimer, NMI, soft lockup, and hard lockup to avoid possible kernel false positives.
    kernel.hardlockup_panic = 1 Throws the kernel panic exception when the kernel is experiencing a hard lockup error. Crash details are automatically captured if Kdump is configured.
  • View kernel parameters

    Aliyun Linux 2 has updated the following kernel parameters. You can run the cat /proc/cmdline command to view the kernel parameters of Aliyun Linux 2 at runtime.

    Kernel parameter setting Description
    crashkernel=0M-2G:0M,2G-8G:192M,8G-:256M Reserves memory space for the Kdump feature.
    cryptomgr.notests Disables crypto self-check during kernel startup to speed up startup.
    cgroup.memory=nokmem Disables the kernel memory statistics function of Memory Cgroup to avoid potential kernel instability.
    rcupdate.rcu_cpu_stall_timeout=300 Increases the timeout threshold of RCU CPU Stall Detector to 300 seconds to avoid kernel false positives.
  • Roll back the kernel version
    Aliyun Linux 2 is equipped with the 4.19.y version of Alibaba Cloud kernel. You can run the following commands to install and switch to a V3.10 series kernel that is compatible with CentOS 7.6.1810 as needed.
    Note Replacing the kernel version may result in a boot failure. Use caution when you perform this operation.
    To roll back to a V3.10 kernel, run the following commands:
    # Install a V3.10 kernel.
    sudo yum install -y kernel-3.10.0
    # Configure the GRUB driver.
    sudo grub2-set-default "$(grep ^menuentry /boot/grub2/grub.cfg | grep 3.10.0 | awk -F\' '{ print $2 }')"
    # Update the changes into the configuration file.
    sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    # Restart the operating system for the new configurations to take effect.
    sudo reboot
  • Enable or disable Kdump

    Aliyun Linux 2 provides the Kdump service. After this service is enabled, kernel errors can be captured, helping you analyze kernel crashes.

    Note If the memory of the selected instance type is less than or equal to 2 GiB, the Kdump service cannot be used.
    • Run the following commands to enable the Kdump service:
      # Enable the Kdump service first.
      sudo systemctl enable kdump.service
      # Restart the Kdump service.
      sudo systemctl restart kdump.service
    • Run the following commands to return the memory address space reserved by the Kdump service to the operating system and disable the Kdump service:
      # Change the configuration in the /sys/kernel/kexec_crash_size file.
      sudo sh -c 'echo 0 > /sys/kernel/kexec_crash_size'
      # Disable the Kdump service.
      sudo systemctl disable kdump.service
      # Stop the Kdump service.
      sudo systemctl stop kdump.service
      Note After the memory address space reserved by the Kdump service is returned to the operating system, the operating system must be rebooted to re-enable the Kdump service.
  • Configure the network
    By default, Aliyun Linux 2 uses systemd-networkd to configure the network. The configuration file for DHCP or static IP addresses is located in the /etc/systemd/network/ directory.
    # Restart the network.
    sudo systemctl restart systemd-networkd
  • Obtain the Debuginfo package and the source code package
    • Run the following commands to obtain the Debuginfo package:
      # Install yum-utils.
      sudo yum install -y yum-utils
      # Install the Debuginfo package by replacing packageName with the name of the target software package in the following command:
      sudo debuginfo-install -y <packageName>
    • Run the following commands to obtain the source package:
      # Install the source code.
      sudo yum install -y alinux-release-source
      # Install yum-utils.
      sudo yum install -y yum-utils
      # Install the source code package by replacing sourcePackageName with the name of the target software package in the following command:
      sudo yumdownloader --source <sourcePackageName>
  • Use experimental software packages
    Experimental software packages are provided by Alibaba Cloud, but are not rigorously tested. Alibaba Cloud does not guarantee the quality of these packages. Aliyun Linux 2 provides the following types of experimental packages:
    • Experimental software packages that serve common purposes
      • Python 3.6
      • Golang 1.11 and Golang 1.12

      Run the following commands to install an experimental software package that serves common purposes:

      # Enable YUM repositories.
      sudo yum install -y alinux-release-experimentals
      # Install an experimental software package that serves common purposes by replacing packageName with the name of the target software package in the following command:
      sudo yum install -y <packageName>
    • Experimental software packages that support SCL plug-ins
      • GCC 7.3.1
      • GDB 8.0.1
      • Binutils 2.28
      • Make 4.2.1

      Run the following commands to install an experimental software package that supports SCL plug-ins:

      # Install scl-utils.
      sudo yum install -y scl-utils
      # Enable YUM repositories.
      sudo yum install -y alinux-release-experimentals
      # Install the packages you need from the YUM source. This command installs GCC, GDB, Binutils, and Make tools.
      sudo yum install -y devtoolset-7-gcc devtoolset-7-gdb devtoolset-7-binutils devtoolset-7-make
      After the installation is completed, you can use the later version of GCC and related tools. The sample code is as follows:
      # Specify the repository name to view an existing SCL. The following command uses repository devtoolset-7 as an example:
      scl -l devtoolset-7
      #Run the related SCL software.
      scl enable devtoolset-7 'gcc --version'

Change history

For more information, see Release notes.

Technical support

Alibaba Cloud provides the following technical support for Aliyun Linux 2:
  • The version support period is three years, and the version lifecycle ends on March 31, 2022.
  • Security updates are provided from the YUM source. You can run the yum update command to update to the latest version.