Chapter 1: Installation of Go Lang in Linux
Note: For Windows and Mac also we can visit the official website and follow the instructions.
- Visit Go Lang official website and download tar file of go lang.
- If this is first time installation then you can skip this step else you can clear the previous go lang installation from user directory as.
rm -rf /usr/local/go
3. Then untar the download file and install go lang in user directory as.
$ sudo tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
here -C
just copies the untar data to /usr/local
directory.
4. Setup PATH environment variable by adding the following line to your $HOME/.profile
or /etc/profile
export PATH=$PATH:/usr/local/go/bin
To apply the changes either relogin or source the .profile
file this way
source $HOME/.profile
In the end the PATH
should look something like this in .profile
file or /etc/environment
file.
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/usr/local/go/bin"
5. Verify Go installation
$ go version
go version go1.18.3 linux/amd64
Read the comprehensive Go Lang course Here.
Feel free to reach Himanshu Patel, to connect checkout author about section.