In order to install Sui, I installed the Ubuntu 20.04 distribution of WSL2 on my Windows computer, which is the Linux version officially supported by Sui.
1. Configure System Environment#
In a fresh system, you need to install the necessary software before you can install Sui's binary files.
1. Set up Proxy for Terminal#
Whether it's WSL or any other system, it's important to ensure that your terminal goes through a proxy. A smooth network connection is the foundation for solving most problems.
2. Update System Packages#
Run sudo apt-get update
to update the system packages. Usually, Linux comes pre-installed with Git, but if it's not available, make sure to install it.
3. Install Rust#
Rust and Cargo are essential for installing Sui.
You can find the installation method that suits you on the Rust official website's Getting started page. Since I'm using WSL, I used the following command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
During the installation process, there will be prompts where you need to enter Y
.
After the installation is complete, restart the terminal and enter cargo -version
and rustc --version
to check if the installation was successful.
For example, if it displays cargo 1.73.0 (9c4383fb5 2023-08-26)
and rustc 1.73.0 (cc66ad468 2023-10-03)
, it means the installation was successful.
4. Install Node.js#
Although Node.js and npm are not required for installing Sui, they are needed for developing dApps later on, so you can install them now.
I personally use nvm to manage different versions of Node.js and npm. It also allows for quick installation and upgrading of Node.js.
-
Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
-
Restart the terminal and run
nvm --version
. If it returns a version number like0.39.5
, it means the installation was successful. -
Install Node.js:
nvm install node
. After the installation is complete, you can verify if Node.js and npm were installed successfully. -
Install pnpm. It may not be needed now, but it will likely be needed in the future.
corepack enable
corepack prepare pnpm@latest --activate
2. Install Sui Binary Files#
1. Install Required Dependencies#
sudo apt-get install curl git-all cmake gcc libssl-dev pkg-config libclang-dev libpq-dev build-essential
Run this command in the terminal. Answer "y" to all the questions that appear, and wait patiently for the dependencies required by Sui to be installed.
2. Install Sui Binary Files#
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui
This is the most important step. Enter the above command, and the installation should start theoretically.
This step also tests your network and computer's CPU. If your computer has a relatively ordinary configuration like mine, you can add -j*
to the parameters, where *
is a number. This allows Cargo to compile the files using *
CPU cores.
For example, my CPU has 6 cores, and I choose to use 4 cores for compilation:
cargo install -j4 --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui
Perhaps after a long wait, when you see the following content, Sui should have been successfully installed:
Finished release [optimized + debuginfo] target(s) in 17m 01s
Installing /home/user/.cargo/bin/sui
Still not sure? Confirm again:
$ sui --version
sui 1.14.0-8b46c5ed9
If you see the version number, it means Sui has been successfully installed!