How to Set Up Solana for Development on Ubuntu

I've been building on Solana for a while now — three Anchor smart contracts for Moonly, a full stack NFT staking platform, and an in-browser Solidity IDE that compiles to Solana. Getting the development environment right was the first step for all of it.
This guide covers everything you need to go from a fresh Ubuntu machine to a working Solana development setup. It includes the toolchain (Rust, Solana CLI, Anchor), keypair generation, devnet configuration, and running a local validator. Although this guide targets Ubuntu, most of it works on other Linux distributions too.
System Prerequisites
Before installing anything, make sure your system has the build tools and libraries that the Solana toolchain depends on:
sudo apt-get update
sudo apt-get install -y build-essential pkg-config libudev-dev llvm libclang-dev protobuf-compiler libssl-devThese packages provide the C linker, USB device support, LLVM for compilation, Protocol Buffers for serialization, and SSL libraries. Skipping this step is the most common reason for cryptic build failures later.
Quick Install: One Command
The Solana team now provides a single installer that sets up Rust, the Solana CLI, and the Anchor framework all at once. This is the fastest way to get started:
curl --proto '=https' --tlsv1.2 -sSfL https://solana-install.solana.workers.dev | bashAfter it finishes, restart your terminal (or run source ~/.bashrc / source ~/.zshrc) and verify everything installed:
rustc --version && solana --version && anchor --versionIf all three commands print version numbers, you're good — skip ahead to the Install Node.js and Yarn section. If you prefer to install each tool separately (or already have Rust installed), read on.
Manual Installation (Alternative)
If you already have some tools installed or want more control over versions, you can install each component individually.
Install Rust
Solana smart contracts (called "programs" in Solana) are written in Rust, and the toolchain itself is built with Rust. Install it via rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -yRestart your terminal, then verify with rustc --version.
Install Solana CLI
The Solana CLI handles building programs, managing keypairs, deploying to networks, and running a local validator. The CLI is now maintained by Anza as part of the Agave validator client:
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"Restart your terminal and verify with solana --version. You should see something like solana-cli 3.x.x (src:...; feat:..., client:Agave).
Install Anchor Framework (AVM)
Anchor is the standard framework for Solana program development — it handles account validation, serialization, and testing. I recommend installing it through AVM (Anchor Version Manager) so you can switch versions per project:
cargo install --git https://github.com/coral-xyz/anchor avm --forceThen install and activate the latest Anchor version:
avm install latest
avm use latestVerify with anchor --version. The avm use step is important — installing alone doesn't activate the version.
Install Node.js and Yarn
Node.js is needed for writing client-side tests and interacting with your Solana programs from JavaScript/TypeScript. Anchor's default test runner uses Mocha with TypeScript. Install Node.js via NVM (Node Version Manager):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bashRestart your terminal, then install Node.js and Yarn:
nvm install node
npm install --global yarnGenerate a Wallet Keypair
Every interaction with Solana requires a keypair — deploying programs, signing transactions, receiving airdrops. Generate your development keypair:
solana-keygen newThis creates a keypair file at ~/.config/solana/id.json and shows you the public key (your wallet address). You can optionally set a passphrase, but for a local development keypair I usually skip it.
To see your public key later, run solana address. Keep this keypair for development only — never use it with real funds on mainnet.
Configure for Devnet
By default, the Solana CLI might point to mainnet. For development, you want to work on devnet — a test network where SOL has no real value and you can request free tokens:
solana config set --url devnetSolana has three networks you'll use:
Localnet — a validator running on your machine. Fastest iteration, no network latency, unlimited SOL. Use this during active development.
Devnet — a public test network. Free SOL via airdrops, transactions behave like mainnet. Use this for integration testing before going live.
Mainnet — the production network. Real SOL, real money. Only deploy here when your program is audited and tested.
Verify Your Setup
Run these commands to confirm everything is installed and configured:
rustc --version
solana --version
anchor --version
node --version
yarn --version
solana address
solana config getThe last command shows your current configuration — make sure the RPC URL points to devnet (or localhost if you're about to start a local validator).
Run a Local Validator
For local development, you can run a single-node Solana cluster on your machine. This gives you instant transactions and unlimited SOL for testing:
solana-test-validatorLeave this running in a separate terminal. Then in another terminal, point your CLI to localhost and give yourself some SOL:
solana config set --url localhost
solana airdrop 5You now have 5 SOL on your local validator to deploy and test programs with. When you run anchor test in a project, Anchor automatically starts a local validator, deploys your program, runs tests, and shuts it down — so you don't always need to run the validator manually.
What's Next
Your machine is now set up for Solana development. From here you can scaffold a new Anchor project with anchor init my-project, write your first program, and deploy it to devnet.
If you want to see this setup in action, I've written a follow-up guide on deploying a Solana smart contract — from writing the program to getting it live on devnet. That's where the real fun starts.