Atlantic.Net Blog

How to Install Rust Programming Language on Oracle Linux 8

Hitesh Jethva
by Atlantic.Net (429 posts) under Tutorials, VPS Hosting
0 Comments

Rust is a free and open-source, multi-paradigm, general-purpose programming language developed by Mozilla. It is a server-side programming language designed for performance and safety, especially safe concurrency and memory management. It has direct access to hardware and memory, so it is an ideal language for embedded and bare-metal development. It is used to create a wide range of applications including game engines, operating systems, file systems, browser components, and more.

In this post, we will show you how to install Rust programming language on Oracle Linux 8.

Prerequisites

  • A server running Oracle Linux 8 on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Oracle Linux 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install Required Dependencies

First, you will need to install some required dependencies on your server. You can install all of them by running the following commands:

dnf install epel-release -y
dnf install cmake gcc make curl clang -y

Once all the dependencies are installed, you can proceed to the next step.

Step 3 – Install Rust on Oracle Linux 8

Rust provides an installation script to make the installation process easier.
You can run the following command to download and run the Rust installation script:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

You will be asked to select the installation option as shown below:

home directory, located at:

  /root/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory located at:

  /root/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /root/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

  /root/.profile
  /root/.bash_profile
  /root/.bashrc

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

Type 1 and hit Enter to start the installation. Once the installation is complete, you will get the following output:

  stable-x86_64-unknown-linux-gnu installed - rustc 1.61.0 (fe5b13d68 2022-05-18)

Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source $HOME/.cargo/env

After the installation, activate the Rust system path variable using the following command:

source ~/.profile
source ~/.cargo/env

Next, verify the Rust version with the following command:

rustc -V

You should see the Rust version in the following output:

rustc 1.61.0 (fe5b13d68 2022-05-18)

Step 4 – Create Your First Rust Application

At this point, Rust is installed. Now, let’s create a sample application to test the Rust.

First, create a directory named project with the following command:

mkdir project

Next, change the directory to the project and create a sample Rust application with the following command:

cd project
nano helloworld.rs

Add the following code:

fn main() {
    println!("Welcome to Rust!");
}

Save and close the file, then compile the program using the following command:

rustc helloworld.rs

This command will create an executable file in your current directory.

Now, run the program with the following command:

./helloworld

You should see the following output:

Welcome to Rust!

Step 5 – How to Update Rust Version

It is always a good idea to use the latest version of Rust. You can update it using the rustup command:

rustup update

Step 6 – How to Uninstall Rust

If you want to remove the Rust from your system, run the following command:

rustup self uninstall

After the successful uninstall, you will get the following output:

Thanks for hacking in Rust!

This will uninstall all Rust toolchains and data, and remove
$HOME/.cargo/bin from your PATH environment variable.

Continue? (y/N) y

info: removing rustup home
info: removing cargo home
info: removing rustup binaries
info: rustup is uninstalled

Conclusion

In this post, you learned how to install Rust programming language on Oracle Linux 8. You also learned how to create a sample application using Rust. You can now install Rust in your development environment and start creating your application using the Rust language. Try it on VPS hosting from Atlantic.Net!

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

How to Install Sails.js Framework with Nginx on Oracle Linux 8
How to Install OTRS on Oracle Linux 8
How to Install and Configure Caddy Web Server with PHP on Oracle Linux 8
How to Install and Use PIP Python Package Manager on Oracle Linux 8
How to Install FTP Server with ProFTPD on Oracle Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Dallas, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources