Solana Development Environment Setup (CLI Tools Guide)
Set up the Solana development environment: install the CLI, manage keypairs, switch clusters, verify config, and get ready to build programs.
Before you start writing smart contracts or building dApps on Solana, you need to set up your development environment. This means getting comfortable with the Solana CLI, creating wallets, switching clusters, and understanding how everything connects.
We’ll walk through everything you need to get started, even if this is your first blockchain project.
You don’t need to understand every Solana concept yet. For now, just focus on setting up your tools and learning how to inspect your environment.
What You’ll Learn
By the end of this lesson, you’ll be able to:
- Install and verify the Solana CLI on your system
- Understand the role of keypairs and where they’re stored
- Switch between different Solana clusters (like devnet and mainnet)
- Use CLI commands to inspect your account and balance
- Prepare your environment for smart contract development
Installing the Solana CLI
The Solana Command Line Interface (CLI) is your main tool for interacting with the blockchain from your terminal.
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"After installation, restart your terminal or update your path manually:
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"You can verify the installation:
solana --versionIf you're on Windows, use WSL2 (Windows Subsystem for Linux) for a better experience with Solana tooling and Rust.
Keypairs: Your Identity on Solana
In Solana, your wallet is a keypair: a public key (your address) and a private key (used to sign transactions).
Create a New Wallet
solana-keygen newThis saves your wallet to a file, usually at ~/.config/solana/id.json. Treat this file like a password. If you lose it, you lose access to your funds.
View Your Wallet Address
solana addressThis prints your public key - the address you’ll use to send, receive, and test SOL.
Understanding Solana Clusters
A cluster is a running version of the Solana network. Developers typically use devnet or localnet, not mainnet.
Switch Between Clusters
solana config set --url https://api.devnet.solana.comCheck your current config at any time:
solana config getAirdrop SOL for Devnet Testing
You need SOL to pay for transactions, even on devnet. Luckily, you can request it for free:
solana airdrop 2This gives you 2 devnet SOL. You can check your balance like this:
solana balanceCLI-First Workflow
Here’s what your typical Solana dev setup will look like once the CLI is ready:
Step 1: Generate a Wallet
Use solana-keygen new to create your wallet, then request devnet SOL.
Step 2: Select a Cluster
Set the cluster URL to devnet or localnet using solana config set.
Step 3: Start Building
Use frameworks like Anchor or solana-program to write and test smart contracts.
Step 4: Use CLI Commands
Interact with your programs using commands like solana program deploy, solana transfer, or solana logs.
We’ll cover Anchor workflows in future lessons. For now, focus on using the CLI confidently.
Common Pitfalls
Losing your keypair
If you delete or lose id.json, you lose access to your wallet. Always back it up securely and add it to .gitignore if using version control.
Forgetting your cluster
Always double-check which cluster you're on. If you deploy to the wrong one, your program won't behave as expected.
Using mainnet too soon
Avoid deploying anything to mainnet until your contract is fully tested on devnet and localnet.
Summary
You now have a working Solana CLI setup. You can:
- Create and manage wallets using keypairs
- Connect to devnet, testnet, and localnet clusters
- Request devnet SOL for free
- Use basic CLI commands to check your account and send transactions
This foundation will support all your future Solana development.
Solana Architecture Explained (Beginner Friendly)
Understand Solana’s architecture: validators, epochs, slots, Proof of History, Sealevel, and more to grasp how Solana achieves speed and scalability.
Solana Accounts and Lamports Exercise (Hands-On)
Create wallets, transfer lamports, inspect account layout, and learn rent thresholds to build confidence with Solana accounts using the CLI.