Amazon Elastic Compute Cloud
User Guide for Linux Instances

Preparing to Compile Software

There is a wealth of open-source software available on the Internet that has not been pre-compiled and made available for download from a package repository. You may eventually discover a software package that you need to compile yourself, from its source code. For your system to be able to compile software, you need to install several development tools, such as make, gcc, and autoconf.


These procedures are intended for use with Amazon Linux. For more information about other distributions, see their specific documentation.

Because software compilation is not a task that every Amazon EC2 instance requires, these tools are not installed by default, but they are available in a package group called "Development Tools" that is easily added to an instance with the yum groupinstall command.

[ec2-user ~]$ sudo yum groupinstall "Development Tools"

Software source code packages are often available for download (from web sites such as and as a compressed archive file, called a tarball. These tarballs will usually have the .tar.gz file extension. You can decompress these archives with the tar command.

[ec2-user ~]$ tar -xzf software.tar.gz

After you have decompressed and unarchived the source code package, you should look for a README or INSTALL file in the source code directory that can provide you with further instructions for compiling and installing the source code.

To retrieve source code for Amazon Linux packages

Amazon Web Services provides the source code for maintained packages. You can download the source code for any installed packages with the get_reference_source command.

  • Run the get_reference_source -p package command to download the source code for package. For example, to download the source code for the htop package, enter the following command.

    [ec2-user ~]$ get_reference_source -p htop Requested package: htop Found package from local RPM database: htop-1.0.1-2.3.amzn1.x86_64 Corresponding source RPM to found package : htop-1.0.1-2.3.amzn1.src.rpm Are these parameters correct? Please type 'yes' to continue: yes Source RPM downloaded to: /usr/src/srpm/debug/htop-1.0.1-2.3.amzn1.src.rpm

    The command output lists the location of the source RPM, in this case /usr/src/srpm/debug/htop-1.0.1-2.3.amzn1.src.rpm.