{"id":14106,"date":"2024-06-17T10:59:47","date_gmt":"2024-06-17T07:59:47","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=14106"},"modified":"2024-06-17T10:59:49","modified_gmt":"2024-06-17T07:59:49","slug":"how-to-install-rust-programming-language-on-rocky-linux-8-10-systems","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/how-to-install-rust-programming-language-on-rocky-linux-8-10-systems\/","title":{"rendered":"How to Install Rust Programming Language on Rocky Linux 8.10 Systems"},"content":{"rendered":"\n
Rust is a modern programming language known for its performance and reliability, making it a popular choice for system-level programming and web development. This guide will walk you through the steps to install Rust on Rocky Linux 8.10.<\/p>\n\n\n\n
Before you begin, ensure you have:<\/p>\n\n\n\n
First, update your system to ensure all existing packages are up to date.<\/p>\n\n\n\n
$ sudo dnf update -y<\/code><\/pre>\n\n\n\nStep 2: Install Required Dependencies<\/h3>\n\n\n\n
Rust requires some dependencies to be installed on your system. Install the necessary development tools and libraries.<\/p>\n\n\n\n
$ sudo dnf groupinstall "Development Tools" -y\n$ sudo dnf install curl -y<\/code><\/pre>\n\n\n\nStep 3: Install Rust using Rustup<\/h3>\n\n\n\n
Rustup is the recommended way to install Rust, as it allows you to easily manage multiple Rust versions and keep them updated.<\/p>\n\n\n\n
Download and Run Rustup Script<\/h4>\n\n\n\n
Download and run the Rustup installation script.<\/p>\n\n\n\n
$ curl --proto '=https' --tlsv1.2 -sSf https:\/\/sh.rustup.rs | sh<\/code><\/pre>\n\n\n\nDuring the installation, you will be prompted to proceed with the installation. Press 1<\/code> to proceed with the default installation.<\/p>\n\n\n\nConfigure the Environment<\/h4>\n\n\n\n
After Rustup is installed, you need to configure your current shell environment to include Cargo’s bin directory (where Rust binaries are installed).<\/p>\n\n\n\n
$ source $HOME\/.cargo\/env<\/code><\/pre>\n\n\n\nTo make this change permanent, add the following line to your .bashrc<\/code> or .bash_profile<\/code> file:<\/p>\n\n\n\n$ echo 'source $HOME\/.cargo\/env' >> ~\/.bashrc<\/code><\/pre>\n\n\n\nThen, reload the shell configuration:<\/p>\n\n\n\n
$ source ~\/.bashrc<\/code><\/pre>\n\n\n\nStep 4: Verify the Installation<\/h3>\n\n\n\n
To confirm that Rust is installed correctly, check the version of Rust and Cargo (Rust’s package manager).<\/p>\n\n\n\n
$ rustc --version\n$ cargo --version<\/code><\/pre>\n\n\n\nYou should see output similar to:<\/p>\n\n\n\n
plaintextCopy coderustc 1.55.0 (c8dfcfe04 2021-09-06)\ncargo 1.55.0 (32da73ab1 2021-08-23)\n<\/code><\/pre>\n\n\n\n$ rustc 1.55.0 (c8dfcfe04 2021-09-06)\n$ cargo 1.55.0 (32da73ab1 2021-08-23)<\/code><\/pre>\n\n\n\nStep 5: Update Rust (Optional)<\/h3>\n\n\n\n
Rust is frequently updated with new features and improvements. To update Rust to the latest version, use Rustup:<\/p>\n\n\n\n
$ rustup update<\/code><\/pre>\n\n\n\nStep 6: Create and Run a Simple Rust Program<\/h3>\n\n\n\n
To verify that everything is working correctly, you can create and run a simple Rust program.<\/p>\n\n\n\n
Create a New Project<\/h4>\n\n\n\n
First, create a new directory for your project and navigate into it.<\/p>\n\n\n\n
$ mkdir ~\/rust-projects\n$ cd ~\/rust-projects<\/code><\/pre>\n\n\n\nCreate a new Rust project using Cargo:<\/p>\n\n\n\n
$ cargo new hello_world\n$ cd hello_world<\/code><\/pre>\n\n\n\nThis command creates a basic “Hello, world!” program. The main file is located in src\/main.rs<\/code>.<\/p>\n\n\n\nRun the Program<\/h4>\n\n\n\n
To run the program, use:<\/p>\n\n\n\n
$ cargo run<\/code><\/pre>\n\n\n\nYou should see the output:<\/p>\n\n\n\n
Compiling hello_world v0.1.0 (\/home\/user\/rust-projects\/hello_world)\n Finished dev [unoptimized + debuginfo] target(s) in 0.97s\n Running `target\/debug\/hello_world`\nHello, world!<\/code><\/pre>\n\n\n\nConclusion<\/h3>\n\n\n\n
You have successfully installed Rust on your Rocky Linux 8.10 system. Rust is now ready for you to start developing robust and high-performance applications. For more information on using Rust, check out the official Rust documentation<\/a>.<\/p>\n\n\n\nHappy coding!<\/p>\n\n\n\n
References<\/h3>\n\n\n\n\n- Rust Official Website<\/a><\/li>\n\n\n\n
- Rocky Linux Official Website<\/a><\/li>\n\n\n\n
- Rustup Installation Guide<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"
Rust is a modern programming language known for its performance and reliability, making it a popular choice for system-level programming and web development. This guide will walk you through the…<\/p>\n","protected":false},"author":1,"featured_media":14284,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,24,25,27,28,16,18],"tags":[193,354,424,433,449,1268,515,531,572,573,591],"yoast_head":"\n
How to Install Rust Programming Language on Rocky Linux 8.10<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n\n\n\n\n\n\t\n\t\n\t\n