Installing rust does not work

I have Ubuntu 14 and 18 I tried installing Rust on both machines. I am running the machines via digitalocean.

Everytime I try to install rust ( or do this command line: curl https://sh.rustup.rs -sSf | sh; source $HOME/.cargo/env) it keeps giving an error, so how do I make it work correctly?

Can you post the error you are seeing?

I see this error line;

-bash: /root/.cargo/env: No such file or directory

Skip the | sh; source $HOME/.cargo/env part

Also, I’m not sure it’s good to run as root.

The error I get when trying