Hi Everyone! Ever heard of the Go programming language? Go or commonly called GoLang is a programming language created by Google in 2009. If you are getting bored with the same programming languages, maybe you can try GoLang. For this reason, this guide will explain what GoLang is, the advantages of GoLang and how to install GoLang on Hosting.

What is GoLang?

Go or commonly called GoLang is a free and open source programming language owned by Google. Go is an open source programming language used to create simple, reliable and efficient systems. Quoted from Wikipedia, GoLang is a programming language created by Google in 2009 by Robert Griesemer, Rob Pike, and Ken Thompson. Initially, GoLang was only used for Google production systems, open source projects, and a few companies that needed it. GoLang was created with reference to the C and C ++ programming languages. The development of the Go programming language has the aim of covering all the shortcomings of several programming languages. The three of them want to create a programming language that is easy to learn, has high scalability for a fairly large system, does not require a specific environment, is multiprocessing and is easily accessible on other systems. In March 2012, the first version of GoLang was introduced to the public.

GoLang's strengths

The advantages of GoLang compared to other programming languages ​​are:
1. Open source
2. Support dynamic language
3. Fast compilation process
4. Can be used to create multiprocessor shared memory programs
5. Safe
6. Can be used for cloud programming (Go Cloud)
7. Fast, productive and fun
8. Support several cloud service providers such as (Amazon Web Service, Azure, Digital Ocean, Heroku, IBM Bluemix and OpenStack)
9. Continuous integration and continuous deployment

According to the GoLang 2017 user survey , around 61% of GoLang is used to develop website applications. Followed by 37% of the GoLang programming language used to build a system. Then followed by DevOps, Network programming and Databases. This proves that GoLang can be used to build various systems and applications. Not limited to just making certain applications.

how to install golang on hosting
Source: blog.golang.org

Remember, to do a minimum GoLang installation you have a Super Hosting Package !

How to Install GoLang on Hosting

Now, it's time to install GoLang on Hosting. As for how to install GoLang on Hosting, namely,

1. Determine the Domain or Subdomain

The first thing you have to do is determine the domain or subdomain that will be used for the GoLang application.
If you don't have a domain and hosting yet, please order a Cheap Domain and Cheap Hosting at KincaiHosting. You can also order Domain Saving Packages and Cheap Hosting .
If you already have a domain, please specify the domain or subdomain you want. If you want to create a subdomain, please read How to Create a Subdomain on Hosting .

2. Create a GoLang Application Folder

Now it's time to create the GoLang application folder. So usually, website files are placed in a subdomain folder. However, how to install GoLang on Hosting this time is different. Please create a GoLang application folder outside the subdomain folder. You can create a GoLang application folder by:
- directly through the File Manager.
Please login cPanel Hosting then look for the Menu File Manager. Then specify a location and click+Folder

how to install golang on hosting

- via SSH to Hosting
Please do SSH access to Hosting first. If you don't know, please read How to SSH Access to Hosting . We recommend only accessing Hosting via SSH to make it more flexible.

sudo ssh usercPanel @ controlpanelURL –p 64000

Then write the command,

 

mkdir /home/namauser/namafoldergolang

example:

mkdir / home / websites / goapp

3. Creating a Simple GoLang File

Now it's time to create a simple GoLang file. Please write the command:

Then enter the following script:

 

package main

import (

"fmt"

"net/http"

)

func main() {

http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {

fmt.Fprintf(w, "Hello World... I am Golang", )

})

http.ListenAndServe("127.0.0.1:47000", nil)

}

For those of you who use the nano editor, to save the edited file, ctrl+xthen press Y on the keyboard then Enter. Hello.go is the name of the created GoLang file. You can give the file name as you wish.

If so, please run the following command so that the script can be executed. Customize it namauserwith your cPanel username.

 

export TMPDIR=/home/namauser/tmp

4. Running the GoLang Script

Now it's time to run the GoLang script with the following command:

After that run the following command:

Note: hello.go is the name of the GoLang file that was created earlier.

5. See GoLang Run Script Results

To make sure the GoLang script can be executed properly or not, please write the following command in the terminal:

Then you will see 2 files, namely the first is the GoLang script ( hello.go ). While the second file is the build file of the GoLang script ( hello )

how to install golang on hosting

6. Running the Script as a Daemon

Daemon is a process in the system so that the script can run in the background process (behind the scenes). This script can run without the user realizing it so that it can run continuously without having to repeatedly set it. To run the GoLang script as a daemon, please do the following command:

 

god /home/namauser/namafoldergolang/bin/namafilehasilbuild

example:
god / home / websites / go / bin / main

If you can't, please use the command

7. Changing the .htaccess file

To make it accessible, please change the .htaccess file in the subdomain folder. To find out the location of folders in a subdomain, please read How to Find Out where a Folder is in a Domain or Subdomain . Click the subdomain folder then edit the .htaccess file. As for how to edit, right click on the .htaccess file then select Edit.

Then write the following script:

 

Options +FollowSymLinks -Indexes

IndexIgnore *

DirectoryIndex

<IfModule mod_rewrite.c>

RewriteEngine on

# Simple URL redirect:

RewriteRule ^(.*)$ http://127.0.0.1:47000/$1 [P]

</IfModule>

Don't forget to click Save ChangesOK! If there is no .htaccess file in the domain / subdomain folder, please read How to Access Htaccess Files in cPanel .

8. GoLang Script Run Successfully!

Yeay! GoLang script has run successfully! Now it's time to open your web browser and write down the domain name or subdomain that was used (according to step 1). If it appears like the following image, it means that how to install GoLang on Hosting is complete.

how to install golang on hosting

Conclusion

How? How to install GoLang on Hosting is tricky, huh? Take it easy! GoLang has complete documentation and Github that anyone can access. GoLang can be one of the preferred programming languages ​​that you can try! Besides being flexible, reliable, scalable and efficient, GoLang is also easy and simple to learn. Apart from GoLang, all hosting at KincaiHosting supports several programming languages, you know, such as PHP, Ruby, Python and NodeJS. To find out how to set up NodeJS, please read How to Set Up NodeJS on Hosting . For those of you who are lovers of the PHP framework, you can read How to Install Laravel on Hosting . Greetings, KincaiHosting!

What is Safelink Asia?

Safelink.asia is a completely free tool where you can create short links. URL security with cryptographic algorithm. Protect your web visitors with a secure link, to avoid viruses, malware, thief, etc. Apart from being free, you get paid! Register now!


Shorten URLs & earn money

So, now you can make money from home, when managing and protecting your links with Safelink Asia. Signup for an account in just 1 minutes. Once you've completed your registration just start creating short URLs and sharing the links with your family and friends. See our proof of payment and publisher rate.


Our partners and network

Here are some of our partners and networks that have collaborated on advertising: 401XD Group, MC Project, Kincai Media, Kartu Nama Digital, SEO Secret Indonesia, Safelink Asia, Media Bisnis, Blackexpo, Adigunawan.net.