How to install the Rust programming language on Linux?

Rust

C and C ++ have been undoubtedly one of the most popular programming languages and used by the vast majority of applications and operating systems and without saying that they are one of the first recommended programming languages ​​to learn and take as a basis.

Rust is a programming language compiled, general purpose and multiparadigm that is being developed by Mozilla and supported by LLVM. This language has been designed to be «A safe, concurrent and practical language» and above all to be a replacement for the C and C ++ languages.

Rust is an open source programming language that supports pure functional programming, procedural, imperative and object-oriented.

This programming language works extremely fast, avoids segfaults, and ensures thread safety. Supports zero cost abstractions, motion semantics, guaranteed memory security, thread-free data races, generic-based trait and pattern matching.

As well supports type inference, minimal execution time, as well as efficient C bindings.

Rust can be run on a large number of platforms and it is being used in the production of companies / organizations like Dropbox, CoreOS, NGP and many more.

The goal of Rust is to be a good language for creating great client-side and server-side programs that run on the Internet.

This has led to a set of features with an emphasis on security, memory allocation control, and concurrency.

Safe code performance is expected to be slower than C ++, if performance is the only consideration, but when compared to C ++ code made to take precautions comparable to Rust, the latter may be even faster.

Rust syntax is similar to C and C ++, with brace-delimited code blocks and flow control structures such as if, else, do, while, and for.

Rest 1

Not all C and C ++ structures are present, and others (such as the match keyword for multidirectional branching) will be less familiar to programmers who come from these languages.

Installing Rust on Linux

Si you want to install this programming language on your system, We can do it by downloading the installer which will help us to get Rust on our system

Just open a terminal and run on it:

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

When running this command the installer will be downloaded and it will run almost immediately, you need to press 1 to continue with the installation with the default values ​​and it will download all the necessary packages.

If you want a custom installation you must type 2 and you will define your environment variables among other things.

At the end of the installation of Rust in our system, the Cargo bin directory will be added immediately in the following path ( ~ / .cargo / bin) where all tools are installed) in your PATH environment variable, in ~ / .profile.

Done this we must proceed to configure the Shell, we do this by modifying the ~ / .profile file to use the modified PATH to work with the Rust environment, running these commands in the terminal:

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

Now only we must proceed to verify that Rust was installed correctly in our system, we do this by typing the following command on the terminal

rustc --version

And with it we should receive the Rust version on the screen that we have installed in our system.

And that's it, we can start using this language and be able to install applications that use it on our system.

To test the language we can create a simple file print us a message on the screen, we do this by typing the following:

nano prueba.rs

And inside the file we paste the following:

fn main() {
println!("Prueba exitosa de Rust");
}

We turn it into an executable:

rustc prueba.rs

And we run it to test:

./prueba.rs


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   kissy said

    And it would not be easier to tell people to install it, look for it in the repositories of its distribution ... Because like this, as you say ... how do you uninstall it? How do you update it? ...

    I use Debian stable, and it seems that it does not need more than: sudo apt-get install rustc.

    As you can see in this link, it is in the Debian repositories since the last stable version:
    https://packages.debian.org/search?keywords=rustc
    and in Ubuntu from Trusty (14.04LTS):
    https://packages.ubuntu.com/search?keywords=rustc&suite=default&section=all&arch=any&searchon=names

    Be careful what you recommend, that any novice user can easily screw up without need!