Skip to content
Related Articles
Open in App
Not now

Related Articles

How to Install GoLang on GoDaddy Server?

Improve Article
Save Article
  • Last Updated : 30 Aug, 2022
Improve Article
Save Article

GoDaddy Server is a cloud-based hosting platform that consists of virtual and dedicated servers. The premium service includes weekly backups, 99% uptime, 24×7 Customer Support, a free encrypted SSL certificate, unlimited bandwidth, and SSD storage. For regular users, the latest generation is VPS Gen 4, which uses QEMU as the hypervisor to perform hardware virtualization. It offers a cheaper alternative to Amazon Web Service and Google Cloud Platform. Golang is an open-source, procedural, and statically typed programming language developed by Robert Griesemer, Rob Pike, and Ken Thompson. It is similar to the C programming language and provides a rich standard library. To know more, please visit Golang Tutorial. Let’s discuss how to install the latest version of Golang on GoDaddy VPS Gen 4 (Ubuntu).

Installing Golang

Step 1: Open your terminal/PowerShell and ssh into the GoDaddy Server.

$ ssh username@ip

Opening-terminal

 

Step 2: Update and upgrade the server by running.

$ sudo apt update -y

$ sudo apt upgrade -y

Upgrading-server

 

 Step 3: Visit https://go.dev/doc/install and copy the file path to the latest tar package for Linux.

Copying-the-Go-download-link

 

Step 4: Download the tarball by using wget tool.

$ wget https://go.dev/dl/go1.19.linux-amd64.tar.gz

Downloading-tarball

 

Step 5: Remove any pre-existing installation of golang by running.

$ sudo rm -rf /usr/local/go

Removing-pre-existing-golang-installation

 

Step 6: Now extract the archive you just downloaded into /usr/local.

$ sudo tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz 

Extracting-archive

 

Step 7: Now set the PATH environment variable open ~/.profile.

$ nano ~/.profile

Setting-the-path-environment

 

Step 8: Append the following line at the end of the file.

export PATH=$PATH:/usr/local/go/bin

 Step 9: Commit the changes by running.

$ source ~/.profile

Running-profile

 

Step 10: Verify the installation by checking the build version.

$ go version

Verifying-installation

 

Using Golang

Step 1: Create a basic go file that outputs ‘Geeks For Geeks’.

$ nano gfg.go

Creating-basic-go-file

 

Go




package main
    
import "fmt"
    
func main() {
    fmt.Println("Geeks For Geeks")
}


Step 2: Now, use the go compiler to build the executable file.

$ go build gfg.go

Using-go-compiler

 

Step 3: Execute the build file to view the output.

$ ./gfg

Executing-build-file

 

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!