30% Therapy – 40% Practice – 30% Work project

Solidity – Environment Setup



This chapter explains how we can setup Solidity compiler on CentOS machine. If you do not have a Linux machine then you can use our Online Compiler for small contracts and for quickly learning Solidity.

Method 1 – npm / Node.js

This is the fastest way to install Solidity compiler on your CentoS Machine. We have following steps to install Solidity Compiler −

Install Node.js

First make sure you have node.js available on your CentOS machine. If it is not available then install it using the following commands −

# First install epel-release
$sudo yum install epel-release

# Now install nodejs
$sudo yum install nodejs

# Next install npm (Nodejs Package Manager )
$sudo yum install npm

# Finally verify installation
$npm --version

If everything has been installed then you will see an output something like this −

3.10.10

Install solc

Once you have Node.js package manager installed then you can proceed to install Solidity compiler as below −

$sudonpm install -g solc

The above command will install solcjs program and will make it available globally through out the system. Now you can test your Solidity compiler by issuing following command −

$solcjs-version

If everything goes fine, then this will print something as follows −

0.5.2+commit.1df8f40c.Emscripten.clang

Now you are ready to use solcjs which has fewer features than the standard Solidity compiler but it will give you a good starting point.

Method 2 – Docker Image

You can pull a Docker image and start using it to start with Solidity programming. Following are the simple steps. Following is the command to pull a Solidity Docker Image.

$docker pull ethereum/solc:stable

Once a docker image is downloaded we can verify it using the following command.

$docker run ethereum/solc:stable-version

This will print something as follows −

$ docker run ethereum/solc:stable -version

solc, the solidity compiler commandlineinterfaceVersion: 0.5.2+commit.1df8f40c.Linux.g++

Method 3: Binary Packages Installation

If you are willing to install full fledged compiler on your Linux machine, then please check official website Installing the Solidity Compiler.

Translate »