How To Install GO Language On Linux/Debian Based Systems

0
3770
views

How To Install GO Language On Linux/Debian Based Systems

Step 1: Download GO

GO to this link https://golang.org/dl/
Click on Linux/Debian, and download will start automaticcally.

Step 2: Extract Go and Install

Extract Go from that tar.gz file.
tar -xzf
or go to Downloads double click and extract the go folder.

Move Go to the install location.

sudo mv go /usr/local/go
Don’t forget to use sudo while moving.

Now change owner to root and alter permissions.

cd /usr/local
sudo chown root:root /usr/local/go
sudo chmod 755 go
cd

Create workspace folder.

where you want your go should be working!

mkdir {,/bin,/pkg,/src}
For Example: mkdir gocode{,/bin,/pkg,/src}
src(Where you will write your code)
pkg( Where library or third party package will go )
bin(Where will be execution file from your compiled code)

Step 3: Edit System Environment Variable

Edit environment variables.
sudo nano /etc/profile
Add
export PATH=$PATH:/usr/local/go/bin
Save and exit
Open
nano .profile
Add

export GOPATH=$HOME/gocode
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
Save and exit
sudo chmod -R 777 ~/gocode

You are now all set to GO!
Happy Coding!