# linux上运行StarkNet 主网节点教程(说不定有大毛) **Published by:** [zhanglu.eth](https://paragraph.com/@zhanglu/) **Published on:** 2022-08-11 **URL:** https://paragraph.com/@zhanglu/linux-starknet ## Content warning:本教程使用的是Ubuntu 20.04 LTS or 18.04 LTS的linux操作系统。非该系统不适用此教程。第一部分 更新系统,下载必要的工具一、更新Ubuntu,安装必备软件(依次执行下列命令)sudo apt update && sudo apt upgrade -ysudo apt install curl gitsudo apt install curl build-essential gcc make -y二、更新所需要的软件包(依次执行下列命令)sudo apt install -y python3-pipsudo apt install -y build-essential libssl-dev libffi-dev python3-devsudo apt-get install libgmp-devpip3 install fastecdsasudo apt-get install -y pkg-config三、安装 Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 执行到如下图,输入1,回车确认出现下图说明Rust 安装成功,根据提示执行 source "$HOME/.cargo/env"执行rustc --version 查看rust版本号是否是1.62以上rust版本不正确会无法运行最新的starkNet版本v0.3.0-alpha,运行后会报E0658错误(如果遇到这种情况需要重新安装Rust就好了)四、克隆对应的github代码库(黑体字为运行的代码版本) git clone --branch v0.3.0-alpha https://github.com/eqlabs/pathfinder.git 五、为节点创建虚拟环境(依次执行下列命令)sudo apt install python3.8-venvcd pathfinder/pypython3 -m venv .venvsource .venv/bin/activatePIP_REQUIRE_VIRTUALENV=true pip install --upgrade pipPIP_REQUIRE_VIRTUALENV=true pip install -r requirements-dev.txtpytest测试成功页面六、编译pathfinder cargo build --release --bin pathfinder (耗时较长,耐心等待) 七、创建 Infura 或 Alchemy 帐户(我用的是Alchemy) 参考这里 Part 7 八、运行节点(我运行的是Mainnet) cargo run --release --bin pathfinder -- --ethereum.url XXXXX XXX为下图中copy的地址出现这些说明你节点运行成功了。欢迎关注我的推特,lens,cyberconnect 参考文献: https://mirror.xyz/dzupp.eth/8HfjYCkbid2vlayxyPtSD9_wtb9a-wHb1uOENsAOwng https://github.com/eqlabs/pathfinder#readme ## Publication Information - [zhanglu.eth](https://paragraph.com/@zhanglu/): Publication homepage - [All Posts](https://paragraph.com/@zhanglu/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@zhanglu): Subscribe to updates - [Twitter](https://twitter.com/Craaie1): Follow on Twitter