There are four major ways to install the Solidity compiler:
- Install Solidity Compiler via npm
- Install Solidity Compiler via Docker on Ubuntu
- Install Solidity Compiler via Source Code Compilation
- Install Solidity Compiler via Static Binary and Linux Packages
In this tutorial, we’ll have a quick look at each of them and give you a link to a more detailed resource so you can set up your Solidity compiler as quickly and efficiently as possible.
▶️ Video: For your convenience, I embedded the video tutorial provided by our Solidity expert Matija so you don’t even need to leave this page.
Without further ado, let’s get started! 👉
Method 1: Install Solidity Compiler via npm
As you watch the video or go through this tutorial, feel free to download the following slides as well — for your convenience:
👉 Full Tutorial: How to Install the Solidity Compiler via npm?
Method 2: Install Solidity Compiler via Docker on Ubuntu
Before we go into details about the Docker installation of
solc, let’s first get introduced to what Docker is.
💡 Docker is an open platform for developing, shipping, and running applications… Docker provides the ability to package and run an application in a loosely isolated environment called a container… Containers are lightweight and contain everything needed to run the application, so you do not need to rely on what is currently installed on the host.
There are some parts of the description I’ve deliberately left out (separated by the symbol …) because they’re not essential to our understanding of the technology.
👉 Full Tutorial: How to Install the Solidity Compiler via Docker on Ubuntu?
Method 3: Install Solidity Compiler via Source Code Compilation
⚡ This is a very complex way to install the Solidity compiler and I wouldn’t recommend it for most people. Due to the complexity, I’ll only give a quick overview of the associated article (tutorial).
Feel free to dive into it after scanning through these three contributions:
- First, we listed and explained the software prerequisites needed for compiling a Solidity compiler. In some cases, we reached a complete explanation, and in others, we just gave a brief introductory explanation and announced an entire topic, such as in the case of the Satisfiability Modulo Theorem, SMT.
- Second, we installed the prerequisites by following the first part of a step-by-step tutorial. All the examples have been checked and validated at the time of writing the article, so I expect that we’ll be able to follow them without issues. We also concluded that a compilation process can in some cases take a substantial amount of time; it took almost 40 minutes to compile the z3 SMT solver on my machine.
- Third, we compiled a Solidity compiler following a step-by-step tutorial. I explained for each command example to broaden our learning process even outside of the strict scope of Solidity, to Linux (as far as we needed to go). Finally, when the compilation ended, we confirmed that our home-compiled Solidity compiler works at least as charming as the ones we’ve simply downloaded or installed in a precompiled state.
👉 Full Tutorial: How to Install the Solidity Compiler via Source Code Compilation?
Method 4: Install Solidity Compiler via Static Binary and Linux Packages
You’ll just download the compiler’s static binary, or in short, binary, and simply run it, without any additional prerequisites or preparations required.
First, downloading the file
solc-static-linux and giving it an executable privilege:
$ cd ~ && wget https://github.com/ethereum/solidity/releases/download/v0.8.16/solc-static-linux $ chmod +x ~/solc-static-linux
$ ~/solc-static-linux 1_Storage.sol -o output --abi --bin Compiler run successful. Artifact(s) can be found in directory "output".
When checking our
solidity_src directory, we’ll discover a new directory output, created by the Solidity compiler, containing both
👉 Full Tutorial: How to Install the Solidity Compiler via Static Binary and Linux Packages?
This tutorial is part of our extended Solidity documentation with videos and more accessible examples and explanations. You can navigate the series here (all links open in a new tab):
Learn Solidity Course
Solidity is the programming language of the future.
It gives you the rare and sought-after superpower to program against the “Internet Computer”, i.e., against decentralized Blockchains such as Ethereum, Binance Smart Chain, Ethereum Classic, Tron, and Avalanche – to mention just a few Blockchain infrastructures that support Solidity.
In particular, Solidity allows you to create smart contracts, i.e., pieces of code that automatically execute on specific conditions in a completely decentralized environment. For example, smart contracts empower you to create your own decentralized autonomous organizations (DAOs) that run on Blockchains without being subject to centralized control.
NFTs, DeFi, DAOs, and Blockchain-based games are all based on smart contracts.
This course is a simple, low-friction introduction to creating your first smart contract using the Remix IDE on the Ethereum testnet – without fluff, significant upfront costs to purchase ETH, or unnecessary complexity.
While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com that has taught exponential skills to millions of coders worldwide. He’s the author of the best-selling programming books Python One-Liners (NoStarch 2020), The Art of Clean Code (NoStarch 2022), and The Book of Dash (NoStarch 2022). Chris also coauthored the Coffee Break Python series of self-published books. He’s a computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.