Hi everyone, noob question here.
I'm excited to manage my very first VPS and start playing around. I've got root access to a linux machine and I just installed cargo rustc and rustup with the allmighty command :
curl https://sh.rustup.rs -sSf | sh
So the installer tells me :
directory, located at:
/root/.cargo/bin
This path will then be added to your PATH environment variable by modifying the
profile file located at:
/root/.profile
And now I'm wondering : should I install such stuff from root privileges, or should I do it from a user account + sudo ?
this ^^ the suggested way is to install as user,
there is no point installing rustup as root (either through sudo or directly) because there is no system-wide install that way, .rustup cannot be shared between users
Also, depending on the specs of the VPS you chose, building Rust code on your server might fill up the available disk space in no time (not even speaking of the usually abysmal CPU performance when compiling and the limited RAM which might run out during linking).
I have had nothing but pain compiling Rust code on my VPS, so I build the code locally in a Docker container instead (such that the resulting binary is linked against the same library versions as are available on the VPS, independent of the local machine I'm running it on) and copy the resulting binary over to the server.
Also keep in mind, that installing rust as a root user will not add the rust components (rustc, rustup, cargo, etc) to your personal $PATH but to the root $PATH.
Then you can't just run cargo build but have to type /root/.cargo/bin/cargo.
I assume, this isn't what you intend, so just install it as a regular user. The whole rust stack will be installed to your home directory, which does not require any super permissions.