If you would prefer newer (though not as well-tested) packages, the Kubic project provides packages for active Ubuntu releases 18.04 and newer (it should also work with direct derivatives like Pop!OS). Ubuntu 17.04 Zesty Zapus is the first release of the year 2017 for one of the most popular Linux distribution in the world. Let's learn how to install it in 10 easy steps. This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS.
In this tutorial, I will take you through the steps to Install Golang on Ubuntu 18.04. It was created by small team in Google which consists of Robert Griesemar, Rob Pike and Ken Thompson. GO is a strong and statically type language.
Strong type means type of a variable cannot change over time. It means if you declare a variable to hold an integer, it will always hold an integer. You cannot put any boolean or string value in it. Static type means all of the variables has to be defined at the compile time.
Why GO Language?
At the time GO was created, we had few powerful languages available at that time i.e Python, Java and C/C++. But over the time, we had certain limitations with these languages. For e.g:-
a)Python is easy to use but it is little slow.
b)Java program has becoming increasingly complex type system.
c)C/C++ also becoming complex over the time and hence compile time is getting slower.
So GO language is created by optimizing the compiler and improving the compile time. You will know more about GOLANG in next few tutorials. Let's follow the steps to install GOLANG in this tutorial.
Install GOLANG On Ubuntu
Before going through the steps to install golang in your system, you need to ensure prerequisites are met.
Also Read:Networking in Docker with Best Examples
Step 1: Prerequisites
a)You must have a running Ubuntu 18.04 System.
b)You need to login as root user or user with sudo access to run below commands. You can visit How to add User into Sudoers on Ubuntu 18.04 to check the steps to add User into Sudoers.
Step 2: Update Your System
You need to update your system using sudo apt-get update
command.
Step 3: Download Golang Tar file
You can go to GOLANG Download Page and download tar file for Linux using wget command. This will download go1.13.6.linux-amd64.tar.gz in current directory.
Step 4: Extract Tar File
Once golang tar file is downloaded, you need to extract the compressed file by using tar
command as shown below.
Step 5: Setting Up the Directory
Move extracted go/ directory to /usr/local using below command.
Now you need to create a go/ directory in /home/test which will used as Project Workspace. Download chrome browser for pc offline installer. You can choose any name you want for creating workspaces. It really does not matter.
Set the Path at the end of ~/.profile. Access disk utility mac. You need to ensure that .profile is required to be set for all those users through which you want to build and run your GO Programs.
Once profile is edited and saved. You need to load the Profile Again by using below command.
Step 6: Check GO Version
Once GO Path is set, you can check the GO Version by running go version
command as shown below.
Step 7: Write Your First GO Program
Create another directory example under go directory. We will write our first GO Program in this directory.
Then, write a simple hello World program in hello.go
as shown below. We will use our favourite editor nano to open the file and write our code.
Step 8: Build Your GO Program
Install Golang Ubuntu 17 04 Download
Now build your program with go build
command as shown below.
If you don't receive any error after completing the build then you need to check if the executable got created or not by running ls
command. You can see your executable example
got created.
Install Golang Ubuntu 17 04 09
Step 9: Test Program Output
You need to update your system using sudo apt-get update
command.
Step 3: Download Golang Tar file
You can go to GOLANG Download Page and download tar file for Linux using wget command. This will download go1.13.6.linux-amd64.tar.gz in current directory.
Step 4: Extract Tar File
Once golang tar file is downloaded, you need to extract the compressed file by using tar
command as shown below.
Step 5: Setting Up the Directory
Move extracted go/ directory to /usr/local using below command.
Now you need to create a go/ directory in /home/test which will used as Project Workspace. Download chrome browser for pc offline installer. You can choose any name you want for creating workspaces. It really does not matter.
Set the Path at the end of ~/.profile. Access disk utility mac. You need to ensure that .profile is required to be set for all those users through which you want to build and run your GO Programs.
Once profile is edited and saved. You need to load the Profile Again by using below command.
Step 6: Check GO Version
Once GO Path is set, you can check the GO Version by running go version
command as shown below.
Step 7: Write Your First GO Program
Create another directory example under go directory. We will write our first GO Program in this directory.
Then, write a simple hello World program in hello.go
as shown below. We will use our favourite editor nano to open the file and write our code.
Step 8: Build Your GO Program
Install Golang Ubuntu 17 04 Download
Now build your program with go build
command as shown below.
If you don't receive any error after completing the build then you need to check if the executable got created or not by running ls
command. You can see your executable example
got created.
Install Golang Ubuntu 17 04 09
Step 9: Test Program Output
Ubuntu 18.04 Golang
Now you can run your Program and test the output as shown below.
Also Read:Top 15 tools to monitor disk IO Performance with Examples