Install Rust on OpenSUSE

This guide will take you through how to install Rust on OpenSUSE. Rust is a general-purpose programming language with a focus on performance, type safety, and concurrency. As opposed to other memory-safe languages that need the employment of a garbage collector or reference counting, Rust enforces memory safety, ensuring that all references point to valid memory.

How to Install Rust on OpenSUSE

  • Update your OpenSUSE system.
sudo zypper update
  • Next, install the dependencies below.
sudo zypper install cmake gcc make curl clang

Sample output

Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following package is going to be upgraded:
  curl

The following 5 recommended packages were automatically selected:
  clang-tools gcc glibc-devel libstdc++-devel make-lang

The following package is suggested, but will not be installed:
  clang-doc

The following 30 NEW packages are going to be installed:
  clang clang13 clang-tools cmake cmake-full cmake-man gcc gcc7
  glibc-devel libasan4 libatomic1 libcilkrts5 libclang13 libclang-cpp13
  libitm1 libjsoncpp19 libLLVM13 liblsan0 libmpx2 libmpxwrappers2
  librhash0 libstdc++6-devel-gcc7 libstdc++-devel libtsan0 libubsan0
  libxcrypt-devel linux-glibc-devel make make-lang site-config

1 package to upgrade, 30 new.
Overall download size: 77.9 MiB. Already cached: 0 B. After the operation,
additional 409.5 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
  • Then install Rust using the following command.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Sample output

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

info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2022-08-11, rust version 1.63.0 (4b91a6ea7 2022-08-08)
info: downloading component 'cargo'
  6.6 MiB /   6.6 MiB (100 %) 841.6 KiB/s in  8s ETA:  0s
info: downloading component 'clippy'
  2.8 MiB /   2.8 MiB (100 %) 780.1 KiB/s in  3s ETA:  0s
info: downloading component 'rust-docs'
 18.3 MiB /  18.3 MiB (100 %) 825.6 KiB/s in 22s ETA:  0s
info: downloading component 'rust-std'
 26.1 MiB /  26.1 MiB (100 %) 844.8 KiB/s in 32s ETA:  0s
info: downloading component 'rustc'
 54.3 MiB /  54.3 MiB (100 %) 838.4 KiB/s in  1m  7s ETA:  0s
info: downloading component 'rustfmt'
  4.1 MiB /   4.1 MiB (100 %) 841.1 KiB/s in  5s ETA:  0s
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 18.3 MiB /  18.3 MiB (100 %)   2.3 MiB/s in  7s ETA:  0s
info: installing component 'rust-std'
 26.1 MiB /  26.1 MiB (100 %)   9.7 MiB/s in  2s ETA:  0s
info: installing component 'rustc'
 54.3 MiB /  54.3 MiB (100 %)  10.7 MiB/s in  5s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu installed - rustc 1.63.0 (4b91a6ea7 2022-08-08)


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"
  • Add Rust to the OpenSUSE environment.
source $HOME/.cargo/env
  • Check the Rust version.
rustc -V

Sample Rust Application

  • Create a directory where you will store your files.
mkdir project
  • Navigate to the created directory.
cd project
  • Run the following command to create the sample app.
sudo nano helloguys.rs
  • Paste the code below into the created file above then save(ctrl+s) and close(ctrl+x) the file.
fn main() {
    println!("Hello from itnixpro.com!");
}
  • Compile the application.
rustc helloguys.rs
  • Next, run the application using the following command.
./helloguys

Update Rust on OpenSUSE

  • Update Rust using the command below.
rustup update

Uninstall Rust on OpenSUSE

  • Remove Rust by running the command below.
rustup self uninstall
  • You have reached the end of our tutorial. We have gone through how to install Rust on OpenSUSE.

Read more about Rust

Other Tutorials

Install Nodejs on Rocky Linux 9

Install PHP 8 on Rocky Linux 9

Install Django on Rocky Linux 9

System administrator | Software Developer | DevOps

Leave a Comment