Install Rust on Linux – InApps is an article under the topic Software Development Many of you are most interested in today !! Today, let’s InApps.net learn Install Rust on Linux – InApps in today’s post !

Read more about Install Rust on Linux – InApps at Wikipedia

You can find content about Install Rust on Linux – InApps from the Wikipedia website

An open source programming language, Rust has grown quite popular over the last few years. Developed as a pet project by one-time Mozilla developer Graydon Hoare in 2006 and backed by the LLVM, Rust is extremely fast, prevents segfaults, and guarantees thread and memory safety. Rust also supports zero-cost abstractions, move semantics, threads without data races, trait-based generics, type inference, efficient C bindings, minimal runtime, and pattern matching.

Used by companies like Dropbox, Red Hat, and NPM, Rust is a multiparadigm language that is focused on performance and safety. The Rust language is similar to C++ and can run on numerous platforms.

If you’re looking to write extremely fast code with a very low memory footprint, you would have typically defaulted to C or C++. The problem with those languages is, using them in production code meant you’d have to manage memory manually and understand exactly how you might cause undefined behavior.

The Rust compiler, however, ensures you’re using memory safely, so you can concentrate on the problem you’re trying to solve, not the problem your programming language might introduce. Case in point, the Rust compiler checks every variable you use and every memory address you reference. In fact, according to this chart, half the Linux CVEs in 2018 would have been avoided using Rust.

Read More:   CNCF Rescues the Orphaned RethinkDB Database from Copyleft Oblivion – InApps Technology 2022

If you’re curious as to what applications might make for good Rust applications, consider anything that would benefit from a very low overhead:

  • Embedded systems
  • Appliances
  • Industrial machines
  • Internet of Things/Edge Computing
  • Web apps
  • Bare metal development

The only caveat to Rust is that it does have a rather steep learning curve. This is mostly due to the fact that developers must be very aware of basic computing principles regarding memory allocation and concurrency. If, however, you’re willing to take the time to invest in learning Rust, the payoff will be worth the effort.

With that said, I want to walk you through the process of installing Rust on Linux. I’ll be demonstrating the process on both Debian- and Red Hat-based systems. The only things you’ll need are a running instance of Linux and a user with sudo privileges.

Let’s install.

Taking Care of the Dependencies

The first thing we must do is install the necessary dependencies for Rust. Like Rust, these dependencies are found in the standard repository, so the installation can be taken care of with a single command.

On a Debian-based system (such as Ubuntu), the dependency can be installed with the command:

sudo apt-get install build-essential -y

On a Red Hat-based system (such as CentOS), the dependencies can be taken care of with the command:

sudo dnf install cmake gcc -y

Installing Rust

The installation of Rust is actually quite simple. To do this, we’ll make use of the curl command. On the off-chance your distribution doesn’t include curl, you can install it from the standard repository.

On a Debian-based system, you can install curl with the command:

sudo apt-get install curl -y

On a Red Hat-based system, you can install curl with the command:

sudo dnf install curl -y

With curl installed, you can now install Rust, using the same command, regardless of the distribution you are using. That command is:

Read More:   WP Engine Goes ‘Headless,’ Jumps into the Jamstack – InApps Technology 2022

curl https://sh.rustup.rs -sSf | sh

When prompted (Figure 1), type 1 and hit Enter on your keyboard.

Figure 1: Installing Rust on Pop!_OS Linux.

The installer does take a bit of time (no more than 2-5 minutes — depending on your network connection). Once it completes, you’ll be informed of the success (Figure 2).

Figure 2: Rust has been successfully installed.

You will notice, in the output, it states that as soon as you log out and log back in the Cargo bin directory will be added to your $PATH. That might fail. So instead, we’ll help it along manually. To do this, issue the command:

source $HOME/.cargo/env

After you’ve done that, source your user .profile so it will use the modified $PATH and ensure your shell functions properly with the Rust environment. To do this, issue the command:

source ~/.profile

Testing your Installation

With Rust installed, let’s run a test. We’ll use the tried and true “Hello, World!” example, with a twist. Create a new directory with the command:

mkdir ~/rustexample

Change into that directory with the command:

cd ~/rustexample

Next, we’ll create a new rust file with the command:

nano testingrust.rs

In that new file, paste the following:

Save and close the file.

Now, we’ll create the Rust executable for our Hello, World! program with the command:

rustc testingrust.rs

You should see no output.

To run the newly compiled program, issue the command (from within the ~/rustexample directory):

./testingrust

You should see Hello, InApps! printed in the output (Figure 3).

Figure 3: Our Hello, World! example runs just fine.

If you wanted, you could copy that executable into a directory that’s in your $PATH, so you could run the program from any directory. To do that, issue the command:

Read More:   All Aboard the Kotlin Train – InApps 2022

sudo mv testingrust /usr/local/bin

With the program moved, you can now run it, from any directory, with the command:

testingrust

And that’s all there is to installing and using Rust on Linux. At this point, you should probably take the time to read the Rust core documentation, in order to get up to speed on how to get most out of the language.

Red Hat is a sponsor of InApps.

Feature image by Herbert Aust from Pixabay.

Source: InApps.net

List of Keywords users find our article on Google:

rust game linux
rust mongodb
elasticsearch jobs
rust wikipedia
rust mongodb example
rust game on linux
opensearch github
rust for linux
rust installation
re zero wikipedia
debian wikipedia
rustc
install llvm ubuntu
hire cmake developers
mongodb c++ client
hire linux centos developers
rust trait
rust path
rust linux
dropbox rust
elasticsearch range
aws elasticsearch icon
make an os in rust
software
install rust
rust install ubuntu
linkedin c programming for embedded applications
pop os rust
linux wikipedia
wikipedia rust
rust on linux
rust wiki
metal as a service wikipedia
c++ data types wikipedia
rust hello world
rustc llvm
rust repository
rust shell command
red hat rust
rust llvm
rust gcc
rust process command
poetry linux
wikipedia debian
opensearch runtime fields
rust get environment variable
greyden dog
rust segfault
cargo test dependencies
elasticsearch npm
rust c compiler
ssf net
cargo partner wikipedia
cargo install dependencies
hire debian developer
zero jupyterhub
rust from trait
rust build time
“gcc”: executable file not found in $path
embedded rust
linux aws jobs
linkedin learning rust
rust embedded
hello poetry app
rust in memory database
rust documentation
zero rust
/usr/share linux
curl aws elasticsearch
curl c++
rust by example
rust command
open distro for elasticsearch consulting
rust supported platforms
rustup
Rate this post
Content writer

Let’s create the next big thing together!

Coming together is a beginning. Keeping together is progress. Working together is success.

Let’s talk

Get a custom Proposal

Please fill in your information and your need to get a suitable solution.

    You need to enter your email to download

      Success. Downloading...