Rust environment configuration under Linux

Time:2021-10-26
**Introduce some pits I have stepped on in the rust environment**

The previous windows 10 system encountered many problems in configuring rust, so it changed deepin (Debian based Linux system), and the interface still reported errors, which is somewhat similar to Mac OS. I won’t say more here. For details, please see the deepin official websiteDeepin official websiteMine is the latest official version 15.6. All operations are under the deepin15.6 system

The project targeted isLink descriptionWelcome to participate in the construction of ruster

  1. Configure curl (Baidu)
  2. Install rust

    Installation: $curlhttps://sh.rustup.rs-SSF | SH – > > rust is installed now. Great! The installation is successful
    Uninstall: $rustup self uninstall
    Details can be found atRust installation

  3. Source configuration of China University of science and technology

    1.vi ~/.bashrc
    2. Add at the end of the document:

      export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
      export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup

    3. Source ~ /. Bashrc makes the configuration just take effect
    Details can be found atConfigure China University of science and technology source

  4. Database PostgreSQL
    1. Install PostgreSQL

       sudo apt-get install postgresql

    2. Create a new Linux user with the name you want. Here is dbuser

    sudo adduser dbuser
      **Note: the user name / password should be the same as in step 5**

    3. Switch to Postgres user

       sudo su - postgres

    4> . log in to the PostgreSQL console using the PSQL command

       psql

    5> . create a database user dbuser (the Linux system user created in the above 2) and set the password

       create role dbuser with login createdb password 'password';
    

    6> . create database

       create database ruster owner dbuser;

    7> 2. Grant authority

       grant all privileges on database ruster to dbuser;

    8> . start service

       systemctl start postgresql;

    See the figure below for details:
    Can refer toPostgreSQL installation

Rust environment configuration under Linux

  1. Modify the path environment variable (environment variable of cargo and environment variable of PostgreSQL)

    1. Add the following at the end of ~ /. Bashrc file:
       Export path = $path: / usr / local /... (path to be added)
    My configuration is as follows:

Rust environment configuration under Linux

  1. Install libpq dev
    apt-get install libpq-dev

7. Development for the project

$ git clone https://github.com/ruster-xyz/ruster.git
$ cd ruster
$ cargo install diesel_cli --no-default-features --features postgres
$ diesel setup
$ cargo run

//Other shell nodejs (the node version of v10.1.0 project is above 10)

$ cd ruster/webapp
$ npm install
$ npm run serve