How to install Golang on existing Ubuntu server with multiple VPS

I have a DigitalOcean Ubuntu server running half a dozen sites currently using PHP and MySql.

Golang go1.6rc2.linux-amd64 is also installed, compiles and runs no problem.

I would like to be able to use Golang on one of the sites and have had tremendous difficulty in trying to find suitable working examples, tutorials, demos, etc. that will enable me to use Golang.

I would be grateful for a very basic and simple solution just to get me started so I can experiment.

Do you want to build the Go compiler toolchain on your Ubuntu server, or deploy a program written in Go (and possibly compiled elsewhere) onto your Ubuntu server ?

Go is not like Java or PHP or Node or Python, you don’t need a runtime installed on the target machine to deploy a Go program.


Many thanks for replying so quickly!

I have compiled a Golang program locally and uploaded and it works fine. Also have Golang installed on the server and using a local Command window and SSH root@ to access the server and able to compile and run the program online. This is much quicker when developing because the scripts are very small and upload quickly rather having to upload the large Golang compiled executable.

I have nearly 4,000 Html files that I have managed to render using Golang but only on the localhost. I would like to use the same file structure and use Golang Online with an existing URL render the web-pages.

I have managed to call an Online Golang executable but only using port:8080 and the port is available on all the other five sites.

I would like to be able to be able to use Goalng exclusively on an existing site and not to affect the other sites.

To make your Go sites available to the outside I recommend to use the excellent Go webserver called Caddy:

It’s easy to set it up as a reverse proxy and its integration with makes it a snap to protect your users with SSL.

For example to make your 8080 site available on the public web you can use this simple entry in your caddyfile to reverse proxy to it: {
    proxy / localhost:8080
1 Like

I managed to install and was impressed, thank you.

I next moved on to, successfully got one of my sites on SSL but the other sites refused point blank. Unfotrunately I should have used the following Staging option:

My other sites have been accepted but there are now duplicates certficates, timing and limitation conflicts which I am unable to resolve.

I have decided to move on and concentrate on the new Golang version 1.6.

I’m glad you had success with Caddy but in my experience you need not deal with directly but rather let Caddy do the work of setting it up. It will automatically pull the certificates and set them up once your site is on the Internet and with a proper domain name. It will also renew the certificates when the time comes. That may explain why you had duplicates.

Automatic HTTPS - Caddy

The first time I setup Caddy from a shell and just ran it directly from the command line (important because it may ask for an email address that is needed for the letsencrypt registration). After that you will probably want to set Caddy to run from an upstart script:

Running Caddy as a Service


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.