0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OCI-Oracle Linuxで複数ユーザで共用できるRust開発環境を構築する

0
Posted at

前の記事

構築編

Rust導入前(単一ユーザーと共通)

1.Development Toolsの導入確認

1.1.事前確認

Development Toolsの導入確認コマンドの実行 dnf group listで確認。

インストールされていない

[opc@test-server ~]$ sudo dnf group list
Last metadata expiration check: 0:22:23 ago on Xxx 99 Xxx 2099 99:99:99 XX XXX.
Available Environment Groups:
   Server with GUI
   Server
   Minimal Install
   Workstation
   Custom Operating System
   Virtualization Host
Available Groups:
   Legacy UNIX Compatibility
   Console Internet Tools
   Container Management
   Development Tools
   .NET Development
   Graphical Administration Tools
   Headless Management
   Network Servers
   RPM Development Tools
   Scientific Support
   Security Tools
   Smart Card Support
   System Tools

Development Toolsは、Available Groups:にあるのでインストール可能
※インストールされていない

インストール済み

[opc@test-server ~]$ sudo dnf group list
Last metadata expiration check: 0:22:23 ago on Xxx 99 Xxx 2099 99:99:99 XX XXX.
Available Environment Groups:
   Server with GUI
   Server
   Minimal Install
   Workstation
   Custom Operating System
   Virtualization Host
Installed Groups:
   Development Tools
Available Groups:
   Legacy UNIX Compatibility
   Console Internet Tools
   Container Management
   .NET Development
   Graphical Administration Tools
   Headless Management
   Network Servers
   RPM Development Tools
   Scientific Support
   Security Tools
   Smart Card Support
   System Tools

Development Toolsは、Installed Groups:にあるのでインストール可能
※インストールされていない

1.2.Development Toolsのインストール

1.2.Development Toolsのインストール
[opc@test-server ~]$ sudo dnf group listinstall "Development Tools"
Last metadata expiration check: 0:22:23 ago on Xxx 99 Xxx 2099 99:99:99 XX XXX.
Dependencies resolved.
================================================================================
 Package                   Arch   Version               Repository         Size
================================================================================
Upgrading:
 ****                     ***
(中略)
Installing group/module packages:
 ****                     ***
(中略)
Installing dependencies:
 ****                     ***
(中略)
Installing weak dependencies:
 ****                     ***
(中略)
Installing Groups:
 Development Tools                                                             

Transaction Summary
================================================================================
Install  999 Packages
Upgrade    9 Packages

Total download size: 999 M
Is this ok [y/N]: 

インストールするなら、y

Downloading Packages:
(1/999): **** 
(中略)
--------------------------------------------------------------------------------
Total                                            99 MB/s | 999 MB     99:99     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
(中略)
Complete!
[opc@test-server ~]$

導入の確認

[opc@test-server ~]$ sudo dnf group list
Last metadata expiration check: 0:22:23 ago on Xxx 99 Xxx 2099 99:99:99 XX XXX.
Available Environment Groups:
   Server with GUI
   Server
   Minimal Install
   Workstation
   Custom Operating System
   Virtualization Host
Installed Groups:
   Development Tools
Available Groups:
   Legacy UNIX Compatibility
   Console Internet Tools
   Container Management
   .NET Development
   Graphical Administration Tools
   Headless Management
   Network Servers
   RPM Development Tools
   Scientific Support
   Security Tools
   Smart Card Support
   System Tools

2.Rustの導入

2.1.Rustの確認

Rustの確認コマンドの実行 rustcで確認。

インストールされていない

[opc@test-server ~]$ rustc --version
-bash: rustc: command not found

※インストールされていない

2.2.Rustの共通ディレクトリの作成

Rustの共通ディレクトリの作成コマンドの実行

ディレクトリ作成

[opc@test-server ~]$ sudo mkdir /usr/local/rust
[opc@test-server ~]$ sudo mkdir /usr/local/rust/rustup
[opc@test-server ~]$ sudo mkdir /usr/local/rust/cargo
[opc@test-server ~]$ sudo chmod 755 /usr/local/rust
[opc@test-server ~]$ sudo chmod 755 /usr/local/rust/rustup
[opc@test-server ~]$ sudo chmod 755 /usr/local/rust/cargo

権限変更作成(インストールするように777:全アクセス可能にする)

[opc@test-server ~]$ sudo chmod 755 /usr/local/rust
[opc@test-server ~]$ sudo chmod 777 /usr/local/rust/rustup
[opc@test-server ~]$ sudo chmod 777 /usr/local/rust/cargo

rust用グループ作成

[opc@test-server ~]$ sudo groupadd rustusers

rust用グループ作成

[opc@test-server ~]$ sudo groupadd rustusers

rust用グループ用

[opc@test-server ~]$ sudo chown :rustusers /usr/local/rust
[opc@test-server ~]$ sudo chown :rustusers /usr/local/rust/rustup
[opc@test-server ~]$ sudo chown :rustusers /usr/local/rust/cargo

2.3.Rustの共通ディレクトリのパス設定

Rustの共通ディレクトリの作成コマンドのパス設定

ディレクトリのパス設定

[opc@test-server ~]$ export RUSTUP_HOME=/usr/local/rust/rustup
[opc@test-server ~]$ export CARGO_HOME=/usr/local/rust/cargo

ディレクトリのパス設定確認

[opc@test-server ~]$ echo  $RUSTUP_HOME
/usr/local/rust/rustup
[opc@test-server ~]$ echo  $CARGO_HOME
/usr/local/rust/cargo

2.4.Rustのインストール

Rustのインストール

Rustのインストール

[opc@test-server ~]$  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /usr/local/rust/rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /usr/local/rust/cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /usr/local/rust/cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

  /home/opc/.profile
  /home/opc/.bash_profile
  /home/opc/.bashrc

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


    default host tuple: x86_64-unknown-linux-gnu
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>

1を選びましょう

>1
info: profile set to default
info: default host tuple is x86_64-unknown-linux-gnu
info: syncing channel updates for stable-x86_64-unknown-linux-gnu
info: latest update on 2026-10-15 for version 1.99.1 (58cf8f9c3 2026-10-13)
info: downloading 6 components
        cargo downloading [####           ]   10.45 MiB (9.93 MiB/s, ETA: 1s)          clippy pending installation             5.01 MiB                         warn: using single-threaded unpacking due to low memory (ram budget: 298.9 MiB <        cargo pending installation            10.45 MiB                                clippy installed                        5.01 MiB                             rust-docs downloading [#########      ]   23.15 MiB (3.60 MiB/s, ETA: 3s)           cargo unpacking   [###############]   10.45 MiB (2.67 MiB/s, ETA: 0s)          clippy installed                        5.01 MiB                             rust-docs pending installation            23.15 MiB                                 cargo installed                       10.45 MiB                                clippy installed                        5.01 MiB                             rust-docs unpacking   [####           ]   23.15 MiB (1.05 MiB/s, ETA: 17s)       rust-std downloading [###############]   30.10 MiB (2.78 MiB/s, ETA: 0s)           rustc downloading [####           ]   80.20 MiB (3.10 MiB/s, ETA: 19s)      rust-docs unpacking   [####           ]   23.15 MiB (935.02 KiB/s, ETA: 20s)     rust-std pending installation            30.10 MiB                                 rustc downloading [#####          ]   80.20 MiB (2.96 MiB/s, ETA: 19s)      rust-docs unpacking   [####           ]   23.15 MiB (284.43 KiB/s, ETA: 64s)     rust-std pending installation            30.10 MiB                                 rustc downloading [###############]   80.20 MiB (4.18 MiB/s, ETA: 0s)       rust-docs installed                       23.15 MiB                              rust-std installed                       30.10 MiB                                 rustc installed                       80.20 MiB                               rustfmt installed                        2.37 MiB                         info: default toolchain set to stable-x86_64-unknown-linux-gnu

  stable-x86_64-unknown-linux-gnu installed - rustc 1.99.1 (58cf8f9c3 2026-10-13)


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 (/usr/local/rust/cargo/bin).

To configure your current shell, you need to source the
corresponding env file under /usr/local/rust/cargo.

Consider running the right command for your shell (note the leading DOT):
. "/usr/local/rust/cargo/env" # For sh/ash/dash/pdksh/bash
cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
CC_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
CC_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CC
HOST_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
CFLAGS_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
CFLAGS_x86_64-unknown-linux-gnu = None
[opc@test-server local]

2.5.Rustの動作確認

Rustの動作確認

パスを通す

[opc@test-server ~]$ rustc --version
rustc 9.99.9 (xxxxxxxxx 2099-99-99)
[opc@test-server ~]$ cargo --version
cargo 9.99.9 (xxxxxxxxx 2099-99-99)

2.6.Rustupの確認

rustupの確認

rustupの確認

[opc@test-server ~]$ rustup --version
rustup 9.99.9 (xxxxxxxxx 2099-99-99)
[opc@test-server ~]$

2.7.Rustの更新

rustの更新

rustの更新

[opc@test-server ~]$ rustup update

  stable-x86_64-unknown-linux-gnu unchanged - rustc 9.99.9 (xxxxxxxxx 2099-99-99)

info: checking for self-update (current version: 9.99.9)
info: cleaning up downloads & tmp directories
[opc@test-server ~]$

最後に

記事の内容はCC BY-SA 4.0(著作者の情報とCCライセンス継承はお願いします。商用利用・改変・再配布は問題なし)です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?