Golang installation problems

Has anyone any experience of installing Golang onto a VPS server?

If you have some free time I would be grateful and give free access to a sub-domain for development of your own applications.

Wiredree is the host running Apache.

Many thanks for your reply.

Is it possible to close this thread and to start a new thread "Has any member successfully installed Golang onto an online Apache server? "

I do not know which forum would attract interested posters.

John,

What OS are you running?

Go is stand alone and does not get installed with Apache.

The server is Apache and Wiretree Technical Support has confirmed that it is possible to install Golang onto their server.

I think that it can run concurrently with Apache and will check the message when I am back on the desktop.

There is no benefit to running it beside apache.

What OS is this on?

All WiredTree Managed Dedicated Servers run the latest release of CentOS Enterpise Linux 6 x86_64 with cPanel/WHM and include full root access

Please check Wiretree site for further details.

Go for linx amd64: http://code.google.com/p/go/downloads/detail?name=go1.2.linux-amd64.tar.gz&can=2&q=

extract to where youd like using tar xfv command. also run:


export PATH=$PATH:/path/to/go/bin

After this you should be able to use the command ‘go’ on the terminal. It should be noted that Go only needs to be install on your development machine. You will use Go to compile a binary, and you will only deploy the binary to your prod machine. So what I recomend over the link I just gave you, is to develop on ubuntu, and to very easily install on ubuntu, use godeb (http://blog.labix.org/2013/06/15/in-flight-deb-packages-of-go). As long as you compile on a 64 bit linux distro, and deploy to a 64 bit linux distro, your good (you can also cross compile, but well get into that later)

Once your to this point we can work on building a hello world http server that DOES NOT use apache.

Apache is a bad thing when you want to enter the world of Go, apache will cause problems and kill the real benefit of using go (concurrecy)

EDIT: I got HAWK to create a hidden subforum for Go. I am currently getting ready to write some startup content for it (such as instructions for installing on Windows / Linux, explanation of what Go is, and some examples. I look forward to you gaining knowledge on Go so that you can potentially help me out with that new subforum

@Mittineague;, Many thanks for the time taken to research the additional info.

>>> So what you are trying to do is install Golang alongside whatever else is in place at WiredTree?
Yes, The server is Apache, I have root access and Wiretree Technical Support has confirmed that it is possible to install Golang onto their server and recommended the following link:

Some background info:
Introduced to main frame punch-card programming while following an electrical engineering course, first home computer was TRS-80, learnt Basic and Assembler. After I saw a compiled Basic program I was hooked and soon learnt C, C++, Clipper, Pascal, Delphi and lastly PHP. The latter as you well know is compiled. Golang seems an ideal opportunity to once again produce fast executables.

The Golang.org online Tutorial has been completed, installed the Windows Golang.msi (it was very easy) and produced several small programs which output basic HTML.

I tried installing Golang onto the WiredTree server without success. I believe an in depth knowledge of Linux is required.

I tried following http://golang.org/help/ and also the Golang Community where an unfortunate guy has the same problems. I got the distinct impression that it was like asking for directions in English and all responses were in a foreign language. The lengthy thread grew quite heated and the original frustrated poster never resolved the installation.

I tried the Golang App Engine and their Playground, modified and compiled a demo but when calling the executable (PHP header(…) ) email verification was required and Google Reported a Phishing Problem.

Just before Christmas requested help from a Sitepoint member who started but unfortunately cannot continue because of other commitments. He recommended starting a new thread in this forum…

I have an old blog and short story site that I would like to convert to Golang. I think it would be quite easy to parse the URI and include the relevant content into a template. Also if I am lucky I will be able to compile on the LocalHost and upload the executable to WiredTree.

I had been trying to help John with this before life got in the way with vacation and now that I’m back work has me swamped. Plus, Kyle seems to have a lot more knowledge of GoLang than I :slight_smile: So I’ll let Kyle work out most of the details as it looks like he has done this before, whereas, I was trying to learn as I helped John :smiley:

You could of course run go alongside apache and serve it through a reverse proxy on Apache. That way you can still run go via port 80 and don’t have to fuss with weird port numbers. Concurrency will still work as it should that way.
I can’t remember how to set up a reverse proxy in Apache, but Google should be able to provide help in that regard.

As for installing go, you indeed don’t have to do that. Just install it on a Dev machine, compile, and then ship it to the production machine.

If you don’t have a Linux Dev machine and would like to install go on production, please explain what’s going wrong. All I can gather so far is “it doesn’t work”

I have a local Windows Dev machine where I have successfully compiled “hello.go” and run “hello.exe”.

Unfortunately when uploading “hello.exe” to the Apache server it does not work.

Tomorrow I will try and install a local Linux Golang Dev, compiling “hello.go” and uploading “hello.exe”.

You have to compile on the same archicture as where you are deploying to, So if you are deploing to amd 64 bit linux, you have to compile on the same (can be any dsitro though). Theres tools out there for cross compiling (compile for linux while on a windows mahcine)

So your options here are to either install a virtual machine thats the same as where you are deploying to or do a cross compile. Heres a neat tool (that I havent used yet) for cross compiling: https://github.com/mitchellh/gox

In regards to your PM, I’d recomend just removing the insatllation from your server as you shouldn’t need Go there anyway (unless you really want to do your development there, which I dont recomend)

EDIT: Let me know which route you want to take and I will help you out, but I think you would benefit most by installing a vm with ubuntu 64 bit on your windows machine

So is Golang something that I need to add to my list of things to learn? Oh my! :lol:

Update:
I already have a Virtual Machine running Ubuntu but it is like treacle. The allocated 8 Gig is full and updating is not straight forward so decided on a fresh Ubuntu install on a 16 Gig partition. Ubuntu Software Center has a version of Golang with sparse information regarding setup and still unable to get Golang to compile “Hello World”.

My knowledge of Linux is slim so will plough my way through some tutorials and try to discover where to type the “just run commands”, etc

Don’t use software centers Go package. it is out of date most of the time. Use godeb to install.

Run the following:


wget https://godeb.s3.amazonaws.com/godeb-amd64.tar.gz
tar xfv godeb-amd64.tar.gz
chmod +x godeb #makes godeb executable
./godeb list #lists available versions
sudo ./godeb install #installs latest version in header as root

EDIT: to open a terminal in ubuntu, find app named ‘terminal’ in start menu

Another small step for John :slight_smile:

@K. Wolfe

I have managed to:

  1. install Ubuntu 12.04 32bit
  2. installed latest Golang from their site.
  3. created “hello” which runs fine on LocalHost
  4. uploaded “hello” file does not run but available for download.
  5. also tried “hello” in the “hello” folder and it would not run.

http://www.johns-jokes.com/go/go-install/hello

@ScallioXTX looks like I will have to Google for the “Reverse Proxy” :frowning:

You seem to be treating Go as if it were PHP. Of course with PHP you can just upload a file, call it in a Web browser, and get the response.

With Go this is not the case, since Apache doesn’t know how to execute Go, nor is there any way to teach it how to execute Go. Instead, you have to a Web Server in Go yourself, that takes a request and sends back a response. Take a look at their wiki tutorial here http://golang.org/doc/articles/wiki/ to get an idea of how that works.
Once you have a Web server running in Go you can access it via a specific port on your server, but not port 80, because that is used by Apache. So if you want it to be reachable via port 80 you’d have to add a reverse proxy to Apache, so that when Apache is called it will proxy the call to the Go Webserver and serve the response it gets back to the user who requested it.
Or alternatively you could disable apache and run your Go Web server on port 80, but I would recommend against that as it won’t be as easy to implement multiple websites on the same port (virtual hosts)

Back agan folks and still feeling very weak after a lengthy and severe bout of food poisoning which has left me drained. I lost nearly 4 kg and do not recommmend this as a diet technique :frowning:

@K_Wolfe;
Updated now:

Desktop
Localhost: Ubuntu 12304 LTS, 4Gig, Intel® Pentium(R) 4 CPU 3.00GHz × 2, 64 bit
Golang: go1.2.linux-amd64.tar.gz - go1.2 Linux (x86 64-bit) tarball

Online:
System: linux, 2.6.32-042stab078.27
Machine: i686
Apache ver: 2.2.22

I now have two brand new 64bit “Hello World” versions online, both do not work and give the options to download the files.

Server error log:
[client 61.90.25.37] SoftException in Application.cpp:601:
Directory “/home/johnsGolang/public_html/go/hello” is writeable by group

The latter version is a copy with the “.ggg” extension because I had an inspiration that the file required a MIME type of “application/golang” which I created and was most disappointed that it did not work:(

If your Desktop setup is the same then feel free to download the online files and see if they work on your localhost.

@ScallioXTX;
I tried the Golang tutorial about the Web Server and it worked fine on LocalHost and browsed the designated port.

If I upload the files then the compiled Golang App will once again prompt for the Golang App to be downloaded.

Is it possible use a .htaccess file or call a PHP file with script disabling Apache and calling the Golang App?

Ive tried conveying this several times, I’m not sure how else to explain it. Golang compiles into a binary, what you are doing is that same thing as trying to serve firefox_install.exe and expect it to somehow run some code for you. The golang net/http package gives you the ability to spool up a http server (which is exactly what apache is) and from there you can manage the requests inside your code… This means you need your code to startup a http server, and then from the command line of your server, start your binary as a service (liek you would apache) not try to serve it through apache.

Even if you decide to use apache as a reverse proxy, it stays the same, you must launch your binary as an httpd service. Heres a code example: http://blog.roomanna.com/05-20-2011/simple-go-server

You will start your service by running ./my_binary wherever you have your binary saved to on your server.

I’m sorry I’ve had some things come up and have not been able to write my intro content for the new Go subforum yet to help you out further, hopefully that will be soon.

@John_Betong,
You know I am a big fan of Nitrous.IO .
I recommend you create an account. It is FREE! Then you can instance a GO ‘box’ (an Ubuntu instance) which will have the latest version already provisioned.
Once set up, you can use SSH to exchange files with your server host; like the compiled GO project(s) you create.

With the Nitrous box you have ready access to the development environment from anywhere and anytime (regardless of what device you happen to have on-hand). I have done work on Rails sites with an iPad !!