Otu esi etinye nchara na AlmaLinux 8

nchara na- bụ asụsụ mmemme sistemụ mepere emepe nke na-elekwasị anya na ọsọ, nchekwa nchekwa, na myirịta. Ndị mmepe na-eji nchara mepụta ọtụtụ ngwa sọftụwia ọhụrụ, dị ka injin egwuregwu, sistemu arụ ọrụ, sistemu faịlụ, ihe nchọgharị, na injin simulation maka eziokwu mebere. Nchara yiri C++ n'ụzọ ọ bụla mana ọ nwere ike ịkwado nchekwa ebe nchekwa site na iji ihe nrịba ego maka ịkwado ntụnyere aka.

Maka ndị ọrụ, ọkachasị ndị mmepe chọrọ ịnwale asụsụ Rust Programming, ị ga-ama Otu esi etinye Asụsụ Programming Rust na AlmaLinux 8.

Prerequisites

  • OS akwadoro: AlmaLinux 8.
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo ihe ùgwù or ohere mgbọrọgwụ (su Command).

Na-emelite Sistemụ Ọrụ

Melite gi AlmaLinux Sistemụ arụmọrụ iji hụ na ngwugwu niile dị adị adịla ugbu a:

sudo dnf upgrade --refresh -y

Nkuzi a ga-eji ya sudo iwu na na-eche na ị nwere ọnọdụ sudo. Iji nyochaa ọkwa sudo na akaụntụ gị:

sudo whoami

Ihe atụ na-egosi ọkwa sudo:

[joshua@localhost ~]$ sudo whoami
root

Ọ bụrụ na ịtọbeghị akaụntụ onye ọrụ sudo ma ọ ga-amasị gị, gaa na nkuzi anyị Otu esi etinye onye ọrụ na Sudoers na AlmaLinux.

Iji mgbọrọgwụ akaụntụ, jiri iwu na-esonụ na paswọọdụ mgbọrọgwụ banye.

su

Advertisement


Wụnye ngwugwu achọrọ

Nzọụkwụ mbụ bụ ibubata ebe nchekwa site na EPEL (Ngwugwu ndị ọzọ maka Linux Enterprise); ihe a ga-etinye ndabere emelitere na ekwesịrị iji ya mee ihe n'agbanyeghị belụsọ na ịnọ n'ọnọdụ nrụpụta siri ike.

Mezue iwu dị ka ndị a:

sudo dnf install epel-release

Ihe atụ mmepụta:

Otu esi etinye nchara na AlmaLinux 8

Ụdị Y, wee pịa Tinye igodo ịga n'ihu na nwụnye.

N'aka ozo, jiri -y ọkọlọtọ ịgafe nke a na ịmanye nrụnye.

Na-esote, wụnye CMake, GCC, na Make, nke a ga-achịkọta mgbe ị na-emepụta ngwa nchara.

sudo dnf install cmake gcc make curl -y

Wụnye Asụsụ Mmemme nchara

Ozugbo ịmechara ntinye nke ngwugwu achọrọ na ihe ndị a chọrọ, ị nwere ike iji ugbu a (curl) ka ibudata edemede nrụnye Rust site na ime iwu a:

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

Ị ga-ahụ mmepụta dị ka ihe atụ n'okpuru. pịnye 1 ma tie Tinye na-aga n'ihu.

Ihe Nlereanya:

Otu esi etinye nchara na AlmaLinux 8

Nrụnye niile kwesịrị iwere n'etiti nkeji 1 ruo 5, dabere na ọsọ ịntanetị na ngwaike nke sava gị. Ozugbo emechara, ị ga-ahụ nsonaazụ ndị a:

Na-esote, ị ga-mkpa ịgbalite (Gburugburu nchara) maka shei gị ugbu a. A na-eme nke a site na iji iwu na-esonụ iji malite gburugburu nchara:

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

Nyochaa ụdị arụrụ arụrụ nchara, nke ga-egosikwa gị na etinyere ya nke ọma. Pịnye iwu a wee pịa tinye:

rustc -V

Mmepụta ihe atụ (Nke a ga-agbanwe na oge na ụdị ọhụrụ):

rustc 1.55.0 (c8dfcfe04 2021-09-06)

Advertisement


Mepụta ngwa ihe nlele nchara

Yabụ ị tinyela nchara ma kwenye na ọ kwesịrị ịdị na-arụ ọrụ nke ọma. Mgbe ị na-etinye asụsụ mmemme na sistemụ arụmọrụ gị, ụzọ kachasị mma iji nyochaa bụ ịmepụta ngwa ule ngwa ngwa. Maka onye ndu, ị ga-eme ka ama ama (Ndewo Ụwa) mmepụta na-eji nchara.

Mbụ, ịkwesịrị ịmepụta ndekọ nke ga-eje ozi dị ka a (Oghere ọrụ):

mkdir path/to/rust-projects

Nke abuo, gbanwee ndekọ aha na Workspace wee mepụta ngwa nlele na iwu a:

cd rust-projects && nano helloworld.rs

Ọzọ, tinye koodu a maka ule ndewo ụwa:

fn main() {
    println!("Hello World, this is a test provided by LinuxCapable.com");
}

Zọpụta ma mechie (CTRL+O) wee pụọ (CTRL+X) wee chịkọta mmemme na iwu a:

rustc helloworld.rs

Nke a ga-emepụta ngwa nwere ike ime ka ọ chịkọtachara. Ngwa a ga-adị na ndekọ ndekọ aha gị ugbu a dị ka ihe atụ dị n'okpuru:

Ọ bụrụ na achịkọtala ngwa ule nke ọma, ị ga-ahụ ya Ndewo Ụwa faịlụ n'akụkụ nke mbụ ndewo.rs faịlụ.

Ihe Nlereanya:

Otu esi etinye nchara na AlmaLinux 8

Iji mee ngwa ị mepụtara site na iji Rust, mee usoro ihe omume ahụ na-eme iwu:

./helloworld

Ihe atụ sitere na ngwa ule dị ka n'okpuru:

Otu esi etinye nchara na AlmaLinux 8

Otu esi emelite nchara

Imelite Rust dị mfe ma jiri iwu dị mfe mee ya na ọdụ gị. Tinye ihe ndị a:

rustup update

Ihe atụ mmepụta:

Otu esi etinye nchara na AlmaLinux 8

Advertisement


Otu esi ewepu (wepụ) nchara

Ọ bụrụ n'ọdịnihu ị chọghịkwa nchara na sistemụ arụmọrụ gị, mee iwu a:

rustup self uninstall

Ihe atụ mmepụta:

Otu esi etinye nchara na AlmaLinux 8

Iji wepụ ụdị nke ọma (NA) wee pịa igodo ntinye. Ị ga-enweta nsonaazụ na-esote na ewepụrụ nchara nke ọma na sistemụ gị.

Okwu na mmechi

N'ime nkuzi a, ị mụtala otu esi etinye asụsụ mmemme Rust na sistemu arụ ọrụ AlmaLinux 8 gị wee mepụta ngwa nnwale mbụ. N'ozuzu, nchara dị egwu, karịsịa na ọ na-ekwe nkwa nchekwa nchekwa. Ị nweghị ike ide ihe njupụta njupụta, ihe nrịbama na-akụda mmụọ, ma ọ bụ ahụhụ na-enweghị okpukpu abụọ na Rust nke, kama C/C++, na-ewepụ otu klas nchekwa nchekwa na ngwanrọ gị.

Ahapụ a Comment