Manual global installation?

I'd like to try Rust as a programming language, but it seems that the recommended installation mechanism, Rustup, automatically creates a number of directories in my home directory and modifies my PATH via ~/.bashrc. This is unsuitable for multiple reasons:

  • I'm somewhat low on disk space, and it doesn't tell me how much disk space it is going to use
  • I manage my dot files with git, so I'd really appreciate it if could do the modifications manually
  • Because I'm low on disk space, I need to install Rust to an odd location.
  • I'd like to use the Rust compiler from multiple users on my system, and Rustup installs locally to my user account by default. This means that I'd potentially need to install it multiple times - further compounding my disk space problem.

Is there an installation guide that shows me the manual installation steps I need to undertake to get Rust installed globally for all user accounts? I'm using Ubuntu 19.04.

It would be really handy if there was an up-to-date apt repository :stuck_out_tongue:

My ~/.rustup is about 3Gb with three different toolchains installed, stable, nightly and armv7 cross-compile.

My ~/.cargo directory is about 600Mb.

dot files could probably be managed with .gitignore.

You could probably install it to an odd location by creating symlinks first.

You could probably allow other users to use it via symlinks as well.

Having Rust in the apt repositories would be terrible, perpetually way out of date as is node.js and the like. I love apt for maintaining stable OS components but it can be very annoying for other things.

Thanks for the info!

Wow, that's huge. I definitely don't have the space to spare to install Rust on my main partition then.

Is there a guide on how to do a manual installation or something? It strikes me that Rustup is just a pretty front-end on top of something.

Rust should be in your apt.

You can also set RUSTUP_HOME to install rustup in a different directory.

Yeah, it is - but it's 1.36 and the latest version of Rust I see on the website is 1.38. I was wonder if there's a more up-to-date repository somewhere?

Ah RUSTUP_HOME sounds like what I need. Is that an environment variable on the script I download with the curl command?

It'll still be a huge pain with sudo -u otherusername and other user accounts, but I can live with it (or simply the old version in the apt repository I guess :confused:).

I do have some packaging skills myself - I have a simple apt repository - so if there's some documentation on the installation process I could package the latest version of Rustup etc. to my liking myself.

1 Like

I'd update /etc/profile (or the equivalent for your shell) to contain something like this:

export RUSTUP_HOME=/mnt/path/to/.rustup
export CARGO_HOME=/mnt/path/to/.cargo
export PATH="$CARGO_HOME/bin:$PATH"

That way the rustup, rustc, and cargo binaries are available for all users, and you're telling rustup and cargo that the corresponding .cargo and .rustup directories actually lie somewhere else (e.g. on another partition/disk).

Some useful links:


I'd investigate what the rustup package on arch linux does, because it installs for all users somehow. You can see their install script here.


Thanks! That's helpful.

I'm a bit confused on CARGO_HOME though. The documentation you've linked to says that it's a cache directory, but in the command there you're adding $CARGO_HOME/bin to the PATH? Sounds like it's more than just a cache directory. I'm interested because I'm considering setting up automated cleaning that deletes said directory on a regular basis.

Yeah, it's everything-cargo-does directory, including config, cache for the index, downloaded crates, temporary directories where they're extracted, and installed binaries.

Ah, I see. I definitely shouldn't go deleting that then. In this case, I'd suggest that the documentation be updated to better reflect what it's used for, as it's rather misleading currently.

It only installs rustup for everyone, but each user has to download their toolchain on their own in the default setup.