Unable to install Go 1.9 on Ubuntu, please help

agolangf · · 464 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi I am on Ubuntu. I have installed Go 1.6 but I want to explore hyper ledger and they need go 1.9, so I followed all instructions from this post, but after doing everything when I enter go version, it again returns 1.6 and not 1.9. URL: <a href="https://medium.com/@patdhlk/how-to-install-go-1-9-1-on-ubuntu-16-04-ee64c073cd79" rel="nofollow">https://medium.com/@patdhlk/how-to-install-go-1-9-1-on-ubuntu-16-04-ee64c073cd79</a> </p> <p>I was guessing I was screwing up adding the path at the end of the .profile, but also looks ok to me. Please help if you have time</p> <hr/>**评论:**<br/><br/>shovelpost: <pre><pre><code>sudo rm -rf /usr/local/go wget https://dl.google.com/go/go1.9.4.linux-amd64.tar.gz ~/Downloads sudo tar -C /usr/local -xzf ~/Downloads/go1.9.4.linux-amd64.tar.gz </code></pre></pre>Indianrain: <pre><p>I did that, but still the version is 1.6</p> <p>~$ sudo tar -C /usr/local -xzf ~/Downloads/go1.9.4.linux-amd64.tar.gz</p> <p>[sudo] password for p: </p> <p>p@Enigma:~$ go version</p> <p>go version go1.6.2 linux/386</p></pre>robvdl: <pre><p>Because you never really install Go from apt, Go is very fast moving and the version from apt is always out of date, nobody really uses that in the Go world. Don&#39;t even bother looking for a repository, first uninstall the apt version of go, then go to golang.org, get the amd64 tar and use that instead. Make sure you add the bin folder to the path. Each to their own, but I just tend to untar Go in my homefolder, the only reason I do that is for easy replacement when new versions come out, but you can put it in /opt as well if you want to be more correct.</p></pre>robvdl: <pre><p>Actually it looks from your terminal paste you are still on i386? Or is that just Go 1.6 from apt that is a 32 bit version? Am I seeing this right? I mean you can still download the i386 tar for your platform if your platform isn&#39;t 64 bit, but can&#39;t you run a 64 bit OS on your CPU? As 32 bit operating systems are kinda getting phased out pretty quickly.</p></pre>Indianrain: <pre><p>Ok..my machine is 64 bit and I was installing 64 bit go, but by mistake I have installed a 32 bit version of Ubuntu. I will uninstall 32 and install 64 and check. </p></pre>shovelpost: <pre><p>Can you post the result of this command?</p> <pre><code>go env </code></pre></pre>Indianrain: <pre><p>I have since un installed it. But it is still present in the user folder with a lock icon on the folder name. </p> <p>The program &#39;go&#39; is currently not installed. You can install it by typing: sudo apt install golang-go</p></pre>shovelpost: <pre><p><a href="https://golang.org/doc/install?download=go1.9.4.linux-amd64.tar.gz" rel="nofollow">Here are the official instructions</a>.</p> <p>Install go again as I showed and then use <code>go version</code> and then <code>go env</code>.</p> <p>The problem most likely has to do with <code>$GOPATH</code> or <code>$GOROOT</code>.</p></pre>weberc2: <pre><p>Or perhaps his <code>$PATH</code> is finding another <code>go</code> installation before the one in <code>/usr/local</code>? Or maybe he&#39;s not adding <code>/usr/local/go/bin</code> to his <code>$PATH</code> at all?</p></pre>shovelpost: <pre><p>Yeah that actually sounds more likely.</p></pre>robvdl: <pre><p>Yes, sounds like it. What puzzles me is his apt version was reporting 32 bit but his tar is 64 bit. So what is his platform?</p></pre>Indianrain: <pre><p>His platform is Ubuntu 32 bit. Which is a mistake as the hardware is 64 bit. Changing that now. </p></pre>hell_0n_wheel: <pre><pre><code>which go </code></pre> <p>You don&#39;t even know what you&#39;re running... </p></pre>Indianrain: <pre><p>I guess you are referring to me running ubuntu 32. I will upgrade that now. </p></pre>_poq: <pre><p>Did you use apt to install Go the first time? Remember to --purge everything before installing the new version. Also check your $GOPATH</p></pre>drvd: <pre><p>Use the official installation instruction provided by golang.org and nothing else.</p></pre>scafander: <pre><p>Hi, try to use <a href="https://github.com/moovweb/gvm" rel="nofollow">https://github.com/moovweb/gvm</a> This is go version control automatization tool</p></pre>robvdl: <pre><p>Nice but I never really understood the need of such tools with Go, with me it&#39;s always &#34;just run the latest version of Go&#34;. If a new version comes out, within a week I am already using it and not looking back. Maybe that is a bit naive, but it&#39;s never caused any problems for me. All of the years I have used Go, I&#39;ve never had to go back to an older compiler to compile something.</p></pre>scafander: <pre><p>Purpose of those things is to update with one command in terminal. Also you might want to have LTS and beta versions installed both. </p></pre>PaluMacil: <pre><p>I find gvm to be the fastest way to get the newest version. It&#39;s also for people who might want to try a release candidate but keep developing in the stable version.</p></pre>PaluMacil: <pre><p>This is certainly what I use on Linux. It works very well and is simpler than even a ppa since you can switch versions back and forth with a single command. I have no clue why anyone would downvote you.</p></pre>hell_0n_wheel: <pre><blockquote> <p>I want to explore hyper ledger </p> </blockquote> <p>Sounds like you need to explore bash first. Gotta walk before you can run.</p> <p>Seriously, if you&#39;re getting lost just installing the toolchain, you&#39;re still going to be lost once you get installed.</p> <p>Please, stop wasting our time, and make better use of yours...</p></pre>Indianrain: <pre><p>Thanks for your kind words. I will explore bash. I have been a technical manager for some time and want to explore a use case in insurance on hyperledger, so I am trying my hands on this. I know I may not be doing this right, but over multiple iterations..I hope I will figure it out. As of now I am lost. But as a kind man once told me, it is better to be lost than be struck. </p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

464 次点击  
加入收藏 微博
1 回复  |  直到
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传