See rustup.rs to install rustup. It is recommended to use a non-root user.
cargo, rustc, rustup and other commands will be installed to Cargo's bin directory. The default path is $HOME/.cargo/bin, and the following examples will use this. You need to add this directory to your PATH environment variable.
-
Bash
The setup script should have already added the following line to your $HOME/.profile:
source "$HOME/.cargo/env"
-
Fish
Run the following command:
set -U fish_user_paths $HOME/.cargo/bin $fish_user_paths
rustup self update
List all available components:
rustup component list
The following components is required and should have already been installed:
- rustc
- rust-std
- cargo
- rustfmt
- clippy
llvm-tools is also recommended to be installed:
rustup component add llvm-tools
Install nightly toolchains:
rustup toolchain install nightly
List components in nightly channel:
rustup component list --toolchain nightly
Run the following command to update the toolchains for all channel:
rustup update
To install:
cargo install <crate name>
To update:
cargo install -f <crate name>
The following plugins is recommended:
-
cargo-expand
Needed by IDE(at least JetBrains' rust plugin) to expand macros. The nightly toolchain is also required to run this.
-
cargo-audit
Audit Cargo.lock for crates with security vulnerabilities.
-
cargo-binutils
To run llvm-tools installed via rustup.
-
cargo-cache
To clean cargo caches.
There is an official rust plugin for JetBrains IDEs.
PyCharm Community Edition is recommended as we also use Python scripts in this repo. Clion is needed if you want the DEBUG feature.
It is recommended to use Debian based distro as your development platform.
apt-get install gcc pkgconf make capnproto
apt-get install curl jq xz-utils tar
apt-get install libssl-dev libc-ares-dev
# install lua5.4 or any other versions available on your system
apt-get install lua5.4-dev
apt-get install libpython3-dev
apt-get install python3-toml python3-requests python3-semver python3-socks python3-dnspyton
apt-get install python3-sphinx
apt-get install lsb-release dpkg-dev debhelper
The devel packages is contained in repos that is not enabled by default, you need to check the files under /etc/yum.repo.d/ and enable the corresponding repos. See EPEL Quickstart for more info.
Some scripting or testing tools may be unavailable.
# enable epel repo first
dnf install epel-release
dnf update
#
dnf install gcc pkgconf make capnproto
dnf install curl jq xz tar
dnf install openssl-devel c-ares-devel lua-devel
dnf install python3-devel
dnf install python3-toml python3-requests python3-semver
dnf install python3-sphinx
dnf install rpmdevtools rpm-build
brew install pkgconf capnp
brew install openssl c-ares
brew install lua
# install python, or you can use the one provided by XCode
brew install python
# install tools
choco install capnproto
# install libraries
vcpkg install --triplet=x64-windows-static-md openssl
# build, c-ares need to be vendored, lua and python feature need to be disabled
cargo build --no-default-features --features quic,vendored-c-ares,hickory
pkg install pkgconf capnproto
pkg install gmake # for vendored build of openssl
pkg install c-ares
# install lua5.4 or any other versions available on your system, and create a pkgconfig link
pkg install lua54
ln -s /usr/local/libdata/pkgconfig/lua-5.4.pc /usr/local/libdata/pkgconfig/lua5.4.pc
pkg install python3
# build, with vendored openssl
cargo build --vendored-openssl
pkgin install pkgconf capnproto
pkgin install libcares
# install lua5.4 or any other versions available on your system, and create a pkgconfig link
pkgin install lua54
ln -s /usr/pkg/lib/pkgconfig/lua-5.4.pc /usr/pkg/lib/pkgconfig/lua5.4.pc
# install python 3.11 or any other versions available on your system, and create links
pkgin install python311
ln -s /usr/pkg/bin/python3.11 /usr/pkg/bin/python3
For g3proxy:
openssl >= 1.1.1
c-ares >= 1.12.0
lua
python3 >= 3.7
The tools for C development should be installed, including but not limited to:
gcc
pkg-config
If the c-ares version in the OS repo is too old, the following tools is also required:
cmake
We use capnproto rpc in g3proxy:
capnproto
The following tools are needed to run testing scripts:
curl
The following tools are used in scripts under directory scripts/:
git
jq
tar
xz
We use python3 for more complicated scripts, the following packages are needed:
toml
requests
semver
PySocks
dnspython
We use sphinx to generate docs.
For all Debian based distributions:
lsb-release
dpkg-dev
debhelper
For all rhel based distributions:
rpmdevtools
rpm-build