Skip to content

Instantly share code, notes, and snippets.

@nestorwheelock
Forked from fabiotatsuo/rust.md
Created October 10, 2021 03:10
Show Gist options
  • Save nestorwheelock/5387c5f1c72b7202c01942a059598bfb to your computer and use it in GitHub Desktop.
Save nestorwheelock/5387c5f1c72b7202c01942a059598bfb to your computer and use it in GitHub Desktop.
Install Rust, Cargo and Rustup Toolchain inside FreeBSD 12 Jail
  1. Install rust

    jail-app is name of jail.

    $ jexec jail-app
    $ pkg install curl
    

    Download and install rustup
    $ curl https://sh.rustup.rs -sSf | sh

    root@jail-app:~ # curl https://sh.rustup.rs -sSf | 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.
    
    It will add the cargo, rustc, rustup and other commands to Cargo's bin
    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
    
    You can uninstall at any time with rustup self uninstall and these changes will
    be reverted.
    
    Current installation options:
    
       default host triple: x86_64-unknown-freebsd
         default toolchain: stable
      modify PATH variable: yes
    
    1) Proceed with installation (default)
    2) Customize installation
    3) Cancel installation
    >1
    
    info: installing component 'cargo'
    info: default toolchain set to 'stable'
    
      stable installed - rustc 1.37.0 (eae3437df 2019-08-13)
    
    
    Rust is installed now. Great!
    
    To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
    environment variable. Next time you log in this will be done automatically.
    
    To configure your current shell run source $HOME/.cargo/env
    
  2. Set path $HOME/.cargo/bin

    $ vim /home/jail/jail-app/.cshrc
    set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/bin $HOME/.cargo/bin)
    

    Reload
    $ source .cshrc

    Check version and default

    $ rustc --version
    rustc 1.37.0 (eae3437df 2019-08-13)
    
    $ rustup default
    stable (default)
    

    Rustup folder

    $ jexec jail-app
    $ cd /home/.rustup
    

    Install other versions

    $ rustup install nightly
    $ rustup install stable
    $ rustup install 1.7
    

    Test new install

    $ rustup run nightly rustc --version
    rustc 1.39.0-nightly (521d78407 2019-08-25)
    

    List Rust toolchains and Show active
    $ rustup show

    Uninstall
    $ rustup toolchain uninstall nightly

    Update
    $ rustup update

    Cargo nightly

    $ cargo +nightly build
    $ cargo +nightly run
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment