{"id":2384,"date":"2016-08-03T15:43:01","date_gmt":"2016-08-03T19:43:01","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2384"},"modified":"2018-01-04T14:21:09","modified_gmt":"2018-01-04T19:21:09","slug":"install-go-1-6-ubuntu-14","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/","title":{"rendered":"How to Install Go 1.6 on Ubuntu 14"},"content":{"rendered":"<p><a rel=\"nofollow\" href=\"https:\/\/golang.org\/doc\/go1.6\">Go<\/a> is an open-source modern programming language that was first released by Google in 2009. The creators of Go sought to make it the first mainstream language characterized by efficient compilation, efficient execution, and ease of programming. Like scripting languages, Go uses syntax that is platform agnostic. Support for multiple processors and for networking are built into the language. Its efficiency, ease of use, and high-level syntax have led to Go&#8217;s use in a diverse set of applications and environments. Go has been deployed in over 130,000 GitHub repositories. This article will guide you through installing Go 1.6 on Ubuntu 14.04. <\/p>\n<h2>Getting Started<\/h2>\n<p>Confirm that you have the following before you follow this guide:<br \/>\n\u2022\tA node (<strong><a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\">cloud server<\/a><\/strong> or <strong><a href=\"https:\/\/www.globo.tech\/dedicated-server-hosting\">dedicated server<\/a><\/strong>) with Ubuntu 14.04 installed<br \/>\n\u2022\tRoot access to the node or one sudo non-root user<\/p>\n<p>Below, we assume that all commands are performed by the root user. However, we recommend that you run your scripts and applications from inside a regular user, using sudo privileges. <\/p>\n<p>The official repository for Ubuntu 14.04 contains Go 1.2.1. You may obtain the most recent version by installing Go 1.6 from the source code. <\/p>\n<h2>Step-by-Step Guide to Installing Go 1.6<\/h2>\n<p>Before you install Go, make sure that your system is up to date. Execute the commands apt-get update and apt-get dist-upgrade.<\/p>\n<p><code>apt-get update && apt-get upgrade -y<\/code><\/p>\n<p>The update ensures you will install the most recent packages available. The upgrade will install the most recent security patches and fixes.<\/p>\n<p>Once your system has been updated, you have two basic options for installing Go:<br \/>\n\u2022\tInstall Go 1.2.1 from the Ubuntu 14.04 repository<br \/>\n\u2022\tInstall Go 1.6 from source<\/p>\n<p>Installation from the repository is extremely simple and requires relatively little knowledge. If you are confident you have the necessary skills to do so, you may obtain a more recent version of Go by installing it from the source code.<\/p>\n<h2>Install From Repository<\/h2>\n<p>To install from the repository, use the apt-get install command as follows:<\/p>\n<p><code>apt-get install golang-go<\/code><\/p>\n<p>Check the version of Go that has been installed with the command:<\/p>\n<p><code>root@go-node:~# go version<br \/>\ngo version go1.6.2 linux\/amd64<\/code><\/p>\n<p>Go is installed. You may skip the sections entitled &#8220;Install from Source&#8221; and &#8220;Configure Go Paths&#8221; and go directly to the section entitled &#8220;Testing Go.&#8221;<\/p>\n<h2>Install From Source<\/h2>\n<p>To install from source navigate to the root folder and download the source code for Go using curl as follows:<\/p>\n<p><code>cd ~<br \/>\nwget https:\/\/storage.googleapis.com\/golang\/go1.6.linux-amd64.tar.gz<\/code><\/p>\n<p>The file you have downloaded will have the extension .tar.gz. Use tar with the -xvf extension to extract the contents of the downloaded file. The following command will expand the gzipped file, open the resulting tar file, and create a folder that will contain all the files that had been stored in the tar file: <\/p>\n<p><code>tar -zxvf go1.6.linux-amd64.tar.gz<\/code><\/p>\n<p>Use the following command to change the permissions associated with the Go folder and its contents before you place that folder in your $PATH:<\/p>\n<p><code>chown -R root:root go<\/code><\/p>\n<p>Move the resulting secure Go directory to \/usr\/local.<\/p>\n<p><code>mv go \/usr\/local<\/code><\/p>\n<h2>Configure Go Paths<\/h2>\n<p>By default, the Go package will be in \/usr\/local. Go will be in your $PATH for Linux. <\/p>\n<p>If you choose to install Go in another location, you will need to make sure that location is in your $PATH. When you set paths related to Go, replace \/usr\/local with whatever location you chose.<\/p>\n<p>Now, we will set the paths needed to make Go useable. <\/p>\n<p>Create a directory to which you will deploy your applications, e.g. ~\/go\/bin:<\/p>\n<p><code>mkdir \/root\/app<\/code><\/p>\n<p>Navigate to your Go folder and create a .profile file using a text editor such as nano:<\/p>\n<p><code>nano ~\/.profile<\/code><\/p>\n<p>At the end of the .profile file, set the Go root path and the path to the folder where you will deploy your applications by adding the following lines:<\/p>\n<p><code>export GOPATH=$HOME\/app<br \/>\nexport PATH=$PATH:\/usr\/local\/go\/bin:$GOPATH\/bin<\/code><\/p>\n<p>Save and close the file. Activate the changes you have made by running:<\/p>\n<p><code>source ~\/.profile<\/code><\/p>\n<p>Go is installed and all related paths have been set. <\/p>\n<h2>Testing Go<\/h2>\n<p>To test whether Go is functional, create a simple &#8220;Hello World&#8221; file. <\/p>\n<p><code>mkdir -p $GOPATH\/src\/hello<br \/>\nnano $GOPATH\/src\/hello\/hello.go<\/code><\/p>\n<p>Paste the content below into the &#8220;Hello World&#8221; file. <\/p>\n<p><code class=\"gris\">package main<br \/>\nimport \"fmt\"<br \/>\nfunc main() {<br \/>\nfmt.Printf(\"Hello, world.\\n\")<br \/>\n}<\/code><\/p>\n<p>Save and close the file. Invoke the Go command install to compile the program:<\/p>\n<p><code>go install $GOPATH\/src\/hello<\/code><\/p>\n<p>If the following command returns &#8220;Hello World,&#8221; Go is properly installed and ready to use. <\/p>\n<p><code>.\/root\/work\/bin<\/code><\/p>\n<h2>Conclusion<\/h2>\n<p>Go 1.6 is now installed on your server. You are free to develop using Go on Ubuntu 14.04. <\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Go is an open-source modern programming language that was first released by Google in 2009. The creators of Go sought to make it the first mainstream language characterized by efficient compilation, efficient execution, and ease of programming. Like scripting languages, Go uses syntax that is platform agnostic. Support for multiple processors and for networking are<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70],"tags":[],"class_list":["post-2384","post","type-post","status-publish","format-standard","hentry","category-web-hosting","operating_system-ubuntu-14-04"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Install Go 1.6 on Ubuntu 14 - Globo.Tech<\/title>\n<meta name=\"description\" content=\"Go is an open-source modern programming language that was first released by Google in 2009. Learn how to install Go 1.6 on Ubuntu 14.04.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Go 1.6 on Ubuntu 14 - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"Go is an open-source modern programming language that was first released by Google in 2009. Learn how to install Go 1.6 on Ubuntu 14.04.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-08-03T19:43:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-04T19:21:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"963\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"GloboTech Communications\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"GloboTech Communications\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-go-1-6-ubuntu-14\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-go-1-6-ubuntu-14\\\/\"},\"author\":{\"name\":\"GloboTech Communications\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"headline\":\"How to Install Go 1.6 on Ubuntu 14\",\"datePublished\":\"2016-08-03T19:43:01+00:00\",\"dateModified\":\"2018-01-04T19:21:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-go-1-6-ubuntu-14\\\/\"},\"wordCount\":684,\"commentCount\":0,\"articleSection\":[\"Web Hosting\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-go-1-6-ubuntu-14\\\/\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-go-1-6-ubuntu-14\\\/\",\"name\":\"How to Install Go 1.6 on Ubuntu 14 - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\"},\"datePublished\":\"2016-08-03T19:43:01+00:00\",\"dateModified\":\"2018-01-04T19:21:09+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"Go is an open-source modern programming language that was first released by Google in 2009. Learn how to install Go 1.6 on Ubuntu 14.04.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-go-1-6-ubuntu-14\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-go-1-6-ubuntu-14\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-go-1-6-ubuntu-14\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install Go 1.6 on Ubuntu 14\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\",\"name\":\"Globo.Tech\",\"description\":\"Welcome to the Official Globo.Tech Learning Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\",\"name\":\"GloboTech Communications\",\"sameAs\":[\"http:\\\/\\\/www.gtcomm.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install Go 1.6 on Ubuntu 14 - Globo.Tech","description":"Go is an open-source modern programming language that was first released by Google in 2009. Learn how to install Go 1.6 on Ubuntu 14.04.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/","og_locale":"en_US","og_type":"article","og_title":"How to Install Go 1.6 on Ubuntu 14 - Globo.Tech","og_description":"Go is an open-source modern programming language that was first released by Google in 2009. Learn how to install Go 1.6 on Ubuntu 14.04.","og_url":"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/","og_site_name":"Globo.Tech","article_published_time":"2016-08-03T19:43:01+00:00","article_modified_time":"2018-01-04T19:21:09+00:00","og_image":[{"width":1920,"height":963,"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png","type":"image\/png"}],"author":"GloboTech Communications","twitter_misc":{"Written by":"GloboTech Communications","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/#article","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/"},"author":{"name":"GloboTech Communications","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"headline":"How to Install Go 1.6 on Ubuntu 14","datePublished":"2016-08-03T19:43:01+00:00","dateModified":"2018-01-04T19:21:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/"},"wordCount":684,"commentCount":0,"articleSection":["Web Hosting"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/","url":"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/","name":"How to Install Go 1.6 on Ubuntu 14 - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-08-03T19:43:01+00:00","dateModified":"2018-01-04T19:21:09+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"Go is an open-source modern programming language that was first released by Google in 2009. Learn how to install Go 1.6 on Ubuntu 14.04.","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/install-go-1-6-ubuntu-14\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to Install Go 1.6 on Ubuntu 14"}]},{"@type":"WebSite","@id":"https:\/\/www.globo.tech\/learning-center\/#website","url":"https:\/\/www.globo.tech\/learning-center\/","name":"Globo.Tech","description":"Welcome to the Official Globo.Tech Learning Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87","name":"GloboTech Communications","sameAs":["http:\/\/www.gtcomm.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2384","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/comments?post=2384"}],"version-history":[{"count":6,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2384\/revisions"}],"predecessor-version":[{"id":4027,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2384\/revisions\/4027"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}