Install Golang On Ubuntu Easy Way.

Install Golang


Step 1: Download the latest tar/zip from the official website
            https://golang.org/dl/
            
Step 2 : Extact it: sudo tar -c /usr/local -xzf  go1.14.4.linux-amd64.tar.gz


Step 3 : cd /usr/local/go


            Check All Files It is basically (GoTools)
            Files like: API, bin, lib,.......


Step 4: cd ~
              gedit .bashrc


             (This is the configuration file to set environment variables for the system)


Step 5: Set Environment Variables 
            go to the end of the file and type these lines
            after fi ->
           export GOROOT=/usr/local/go                                (where we installed our go)
           export PATH=$PATH:$GOROOT/bin
      export GOPATH = /home/your-username/code      (your own workspace directory)


Step 6: Save and exit 
             source ~/.bashrc    (save/reflect  changes in bashrc file )


Step 7: cd code (your workspace)
             Check Go version:- go version
             Check Go environment: - go env
            


Step 8: Create these 3 directories :
             mkdir src     (keep source code)
             mkdir bin    (binary created stored here)
             mkdir pkg   (intermediate binary stored)


Comments

Post a Comment

Popular posts from this blog

Golang Interview Questions Part 1 Theory Top 50 Question

Complete Golang Development setup on Linux (Ubuntu 20.04 )

Best GitHub repositories for Go