Rust
Installing Rust
The officially recommended way of installing Rust is using a curlpipe to install rustup
..
I really dislike curlpipes, and installing software outside of package
managers. And cargo
is a really good package manager, but unfortunately
there's a lack of good Rust packages in Linux bistro repos. The
official Rust Forge documentation
(supplementary docs for Rust, a lot of interesting stuff there around how
they manage the project, infrastructure, build channels, design decisions
and such)doesn't really mention any good packages in Linux bistros or
particularly recommend using the ones that do exist..
Fedora
Fedora provides up-to-date Rust packages in their standard repos.
$ sudo dnf install rust cargo
$ cargo --version
cargo 1.75.0
Same version as in the rust:latest
Docker image.
$ docker run --rm -it rust:latest cargo --version
cargo 1.75.0(1d8b05cdd 2023-11-20)
They also have an up-to-date rustup
package:
$ sudo dnf install rustup
$ rustup-init
If you had already installed the cargo
and rust
packages with dnf
, you
should remove them before running rustup-init
to avoid confusing conflicts.
$ rustup --version
rustup 1.26.0
$ cargo --version
cargo 1.75.0 (1d8b05cdd 2023-11-20)
The instructions for installing Rust and cargo
are in the
Rust section in the Fedora Developer portal,
where they also provide a pretty good and concise docs on how to structure
a cargo project.
Debian and Ubuntu
The Debian repos seem to have somewhat up to date packages (and they have a RustPackaging team).
And Ubuntu isn't too far behind, I will try that out soon and update:
$ apt-cache policy rust-all
rust-all:
Installed: (none)
Candidate: 1.70.0+dfsg0ubuntu1~bpo2-0ubuntu0.22.04.2
There is also a rustlang PPA on Launchpad with stable and nightly builds that I've seen mentioned.
Local docs with rustup
To load the local copy of the Rust docs:
$ rustup doc
You can pass a --toolchain
argument if you want docs for a specific
toolchain (which must be installed).
The docs are stored in
$RUSTUP_HOME/toolchains/$toolchain/share/doc/rust/html
.
$ rustup doc --path
Will print the path to where the docs are stored.