メインコンテンツへスキップ
  1. ブログ/

【超入門】LinuxでRustをアップデートする方法

·
Linux Rust プログラム
目次

【超入門】LinuxでRustをアップデートする方法
【超入門】LinuxでRustをアップデートする方法

初めに
#

Rustは約6週間ごとに新しいバージョンが公開される、アップデート頻度の高いプログラミング言語です。

アップデートには新機能の追加だけでなく、バグ修正や脆弱性(セキュリティ)への対応も含まれているため、定期的な更新が推奨されています。

本記事ではLinux環境でRustを最新バージョンにアップデートする方法を初心者向けにわかりやすく解説します。

バージョンの確認
#

現在使用している Rust コンパイラ(rustc)や Cargo のバージョンは、以下のコマンドで確認できます。

rustc --version
cargo --version

以下は実行結果の例となります。

$ rustc --version
rustc 1.91.1 (ed61e7d7e 2025-11-07)
$ cargo --version
cargo 1.91.1 (ea2d97820 2025-10-10)

rustupを使ったRustのアップデート
#

初心者に最もおすすめの方法は、Rust公式のバージョン管理ツールである rustup を使う方法です。

rustupを使えばワンコマンドでコンパイラ(rustc)やパッケージマネージャ(cargo)などを最新化することができます。

まずは、Rustの管理ツールである rustup の更新を確認してください。

以下のコマンドは rustup 自体に更新がないかを確認し、あればアップデートを実施してくれます。

rustup self update

更新がない場合は以下のように表示されます。

rustup self update
info: checking for self-update
  rustup unchanged - 1.28.2

次にRustツールチェーンを最新の安定版(stable) に更新します。

以下のコマンドにてアップデートが可能です。

rustup update stable

上記にて指定している stable は “安定版” を意味しております。

rustup update によるアップデートはデフォルトで stable を指定する仕様となっています。

そのため、以下のように省略し実行することも可能です。

rustup update

上記を実行すると以下のように更新された主要コンポーネントがログとして出力されます。

$ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2025-11-10, rust version 1.91.1 (ed61e7d7e 2025-11-07)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: removing previous version of component 'cargo'
info: removing previous version of component 'clippy'
info: removing previous version of component 'rust-docs'
info: removing previous version of component 'rust-std'
info: removing previous version of component 'rustc'
info: removing previous version of component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 20.4 MiB /  20.4 MiB (100 %)   5.0 MiB/s in  3s         
info: installing component 'rust-std'
 27.9 MiB /  27.9 MiB (100 %)  13.0 MiB/s in  2s         
info: installing component 'rustc'
 74.5 MiB /  74.5 MiB (100 %)  15.9 MiB/s in  4s         
info: installing component 'rustfmt'
info: checking for self-update

  stable-x86_64-unknown-linux-gnu updated - rustc 1.91.1 (ed61e7d7e 2025-11-07) (from rustc 1.87.0 (17067e9ac 2025-05-09))

info: cleaning up downloads & tmp directories

また、以下のように指定することでベータ版やナイトリー版へアップデートする事も可能です。

rustup update beta
rustup update nightly

パッケージマネージャーでインストールしたRustのアップデート
#

AlmaLinuxのようなRHEL系のディストリビューションでは、システムのパッケージマネージャー(dnfやyum)を用いてRustをインストールしている場合があります。

このようなインストール形式を取っている場合は通常のシステムアップデートと同様にアップデートを行う事が可能です。

以下は dnf コマンドにてrustパッケージをアップデートするコマンドとなります。

dnf update rust*

ただし、Linuxディストリビューション(RHEL / Ubuntu / Debian など)が標準リポジトリで提供している Rust パッケージを利用している場合は、配布側が用意しているバージョンに留まる点に留意してください。

関連記事

【初心者向け】PythonでCIDR表記からIPアドレス一覧を取得する方法
Linux Python ネットワーク プログラム
AlmaLinux8でruby2.6以上をインストールする方法
Linux プログラム AlmaLinux
Linuxでディレクトリ内の容量を表示する方法
Linux プログラム
Linuxでメモリのスワップ使用率を表示する方法
Linux プログラム
【簡単ガイド】AlmaLinuxでNginxをインストールする方法
Linux AlmaLinux Nginx Webサーバー
lsofとは?Linuxでファイルオープン数を調べる基本コマンド解説
Linux コマンド Lsof