github.com/spotify/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/doc/install.html (about)

     1  <!--{
     2  	"Title": "Getting Started",
     3  	"Path":  "/doc/install"
     4  }-->
     5  
     6  <h2 id="download">Download the Go distribution</h2>
     7  
     8  <p>
     9  <a href="http://code.google.com/p/go/downloads" id="start" class="download" target="_blank">
    10  <span class="big">Download Go</span>
    11  <span class="desc">Click here to visit the downloads page</span>
    12  </a>
    13  </p>
    14  
    15  <p>
    16  <a href="http://code.google.com/p/go/downloads" target="_blank">Official binary
    17  distributions</a> are available for the FreeBSD, Linux, Mac OS X (Snow Leopard
    18  and above), and Windows operating systems and the 32-bit (<code>386</code>) and
    19  64-bit (<code>amd64</code>) x86 processor architectures.
    20  </p>
    21  
    22  <p>
    23  If a binary distribution is not available for your combination of operating
    24  system and architecture, try
    25  <a href="/doc/install/source">installing from source</a> or
    26  <a href="/doc/install/gccgo">installing gccgo instead of gc</a>.
    27  </p>
    28  
    29  
    30  <h2 id="requirements">System requirements</h2>
    31  
    32  <p>
    33  The <code>gc</code> compiler supports the following operating systems and
    34  architectures. Please ensure your system meets these requirements before
    35  proceeding. If your OS or architecture is not on the list, it's possible that
    36  <code>gccgo</code> might support your setup; see
    37  <a href="/doc/install/gccgo">Setting up and using gccgo</a> for details.
    38  </p>
    39  
    40  <table class="codetable" frame="border" summary="requirements">
    41  <tr>
    42  <th align="middle">Operating system</th>
    43  <th align="middle">Architectures</th>
    44  <th align="middle">Notes</th>
    45  </tr>
    46  <tr><td colspan="3"><hr></td></tr>
    47  <tr><td>FreeBSD 7 or later</td> <td>amd64, 386, arm</td> <td>Debian GNU/kFreeBSD not supported; FreeBSD/ARM needs FreeBSD 10 or later</td></tr>
    48  <tr><td>Linux 2.6.23 or later with glibc</td> <td>amd64, 386, arm</td> <td>CentOS/RHEL 5.x not supported; no binary distribution for ARM yet</td></tr>
    49  <tr><td>Mac OS X 10.6 or later</td> <td>amd64, 386</td> <td>use the gcc<sup>&#8224;</sup> that comes with Xcode<sup>&#8225;</sup></td></tr>
    50  <tr><td>Windows 2000 or later</td> <td>amd64, 386</td> <td>use mingw gcc<sup>&#8224;</sup>; cygwin or msys is not needed</td></tr>
    51  </table>
    52  
    53  <p>
    54  <sup>&#8224;</sup><code>gcc</code> is required only if you plan to use
    55  <a href="/cmd/cgo">cgo</a>.<br/>
    56  <sup>&#8225;</sup>You only need to install the command line tools for
    57  <a href="http://developer.apple.com/Xcode/">Xcode</a>. If you have already
    58  installed Xcode 4.3+, you can install it from the Components tab of the
    59  Downloads preferences panel.
    60  </p>
    61  
    62  
    63  <h2 id="install">Install the Go tools</h2>
    64  
    65  <p>
    66  If you are upgrading from an older version of Go you must
    67  first <a href="#uninstall">remove the existing version</a>.
    68  </p>
    69  
    70  <h3 id="tarball">Linux, Mac OS X, and FreeBSD tarballs</h3>
    71  
    72  <p>
    73  <a href="http://code.google.com/p/go/downloads/list?q=OpSys-FreeBSD+OR+OpSys-Linux+OR+OpSys-OSX+Type-Archive">Download the archive</a>
    74  and extract it into <code>/usr/local</code>, creating a Go tree in
    75  <code>/usr/local/go</code>. For example:
    76  </p>
    77  
    78  <pre>
    79  tar -C /usr/local -xzf go1.2.1.linux-amd64.tar.gz
    80  </pre>
    81  
    82  <p>
    83  The name of the archive may differ, depending on the version of Go you are
    84  installing and your system's operating system and processor architecture.
    85  </p>
    86  
    87  <p>
    88  (Typically these commands must be run as root or through <code>sudo</code>.)
    89  </p>
    90  
    91  <p>
    92  Add <code>/usr/local/go/bin</code> to the <code>PATH</code> environment
    93  variable. You can do this by adding this line to your <code>/etc/profile</code>
    94  (for a system-wide installation) or <code>$HOME/.profile</code>:
    95  </p>
    96  
    97  <pre>
    98  export PATH=$PATH:/usr/local/go/bin
    99  </pre>
   100  
   101  <h4 id="tarball_non_standard">Installing to a custom location</h4>
   102  
   103  <p>
   104  The Go binary distributions assume they will be installed in
   105  <code>/usr/local/go</code> (or <code>c:\Go</code> under Windows),
   106  but it is possible to install the Go tools to a different location.
   107  In this case you must set the <code>GOROOT</code> environment variable
   108  to point to the directory in which it was installed.
   109  </p>
   110  
   111  <p>
   112  For example, if you installed Go to your home directory you should add the
   113  following commands to <code>$HOME/.profile</code>:
   114  </p>
   115  
   116  <pre>
   117  export GOROOT=$HOME/go
   118  export PATH=$PATH:$GOROOT/bin
   119  </pre>
   120  
   121  <p>
   122  <b>Note</b>: <code>GOROOT</code> must be set only when installing to a custom
   123  location.
   124  </p>
   125  
   126  <h3 id="osx">Mac OS X package installer</h3>
   127  
   128  <p>
   129  <a href="http://code.google.com/p/go/downloads/list?q=OpSys-OSX+Type-Installer">Download the package file</a>,
   130  open it, and follow the prompts to install the Go tools.
   131  The package installs the Go distribution to <code>/usr/local/go</code>.
   132  </p>
   133  
   134  <p>
   135  The package should put the <code>/usr/local/go/bin</code> directory in your
   136  <code>PATH</code> environment variable. You may need to restart any open
   137  Terminal sessions for the change to take effect.
   138  </p>
   139  
   140  <h3 id="windows">Windows</h3>
   141  
   142  <p>
   143  The Go project provides two installation options for Windows users
   144  (besides <a href="/doc/install/source">installing from source</a>):
   145  a zip archive that requires you to set some environment variables and an
   146  MSI installer that configures your installation automatically.
   147  </p>
   148  
   149  <h4 id="windows_msi">MSI installer</h4>
   150  
   151  <p>
   152  Open the <a href="http://code.google.com/p/go/downloads/list?q=OpSys-Windows+Type%3DInstaller">MSI file</a>
   153  and follow the prompts to install the Go tools.
   154  By default, the installer puts the Go distribution in <code>c:\Go</code>.
   155  </p>
   156  
   157  <p>
   158  The installer should put the <code>c:\Go\bin</code> directory in your
   159  <code>PATH</code> environment variable. You may need to restart any open
   160  command prompts for the change to take effect.
   161  </p>
   162  
   163  <h4 id="windows_zip">Zip archive</h4>
   164  
   165  <p>
   166  <a href="http://code.google.com/p/go/downloads/list?q=OpSys-Windows+Type%3DArchive">Download the zip file</a> and extract it into the directory of your choice (we suggest <code>c:\Go</code>).
   167  </p>
   168  
   169  <p>
   170  If you chose a directory other than <code>c:\Go</code>,
   171  you must set the <code>GOROOT</code> environment variable to your chosen path.
   172  </p>
   173  
   174  <p>
   175  Add the <code>bin</code> subdirectory of your Go root (for example, <code>c:\Go\bin</code>) to your <code>PATH</code> environment variable.
   176  </p>
   177  
   178  <h4 id="windows_env">Setting environment variables under Windows</h4>
   179  
   180  <p>
   181  Under Windows, you may set environment variables through the "Environment
   182  Variables" button on the "Advanced" tab of the "System" control panel. Some
   183  versions of Windows provide this control panel through the "Advanced System
   184  Settings" option inside the "System" control panel.
   185  </p>
   186  
   187  
   188  <h2 id="testing">Test your installation</h2>
   189  
   190  <p>
   191  Check that Go is installed correctly by building a simple program, as follows.
   192  </p>
   193  
   194  <p>
   195  Create a file named <code>hello.go</code> and put the following program in it:
   196  </p>
   197  
   198  <pre>
   199  package main
   200  
   201  import "fmt"
   202  
   203  func main() {
   204      fmt.Printf("hello, world\n")
   205  }
   206  </pre>
   207  
   208  <p>
   209  Then run it with the <code>go</code> tool:
   210  </p>
   211  
   212  <pre>
   213  $ go run hello.go
   214  hello, world
   215  </pre>
   216  
   217  <p>
   218  If you see the "hello, world" message then your Go installation is working.
   219  </p>
   220  
   221  
   222  <h2 id="gopath">Set up your work environment</h2>
   223  
   224  <p>
   225  You're almost done.
   226  You just need to do a little more setup.
   227  </p>
   228  
   229  <p>
   230  <a href="/doc/code.html" class="download" id="start">
   231  <span class="big">How to Write Go Code</span>
   232  <span class="desc">Learn how to set up and use the Go tools</span>
   233  </a>
   234  </p>
   235  
   236  <p>
   237  The <a href="/doc/code.html">How to Write Go Code</a> document
   238  provides <b>essential setup instructions</b> for using the Go tools.
   239  </p>
   240  
   241  
   242  <h2 id="uninstall">Uninstalling Go</h2>
   243  
   244  <p>
   245  To remove an existing Go installation from your system delete the
   246  <code>go</code> directory. This is usually <code>/usr/local/go</code>
   247  under Linux, Mac OS X, and FreeBSD or <code>c:\Go</code>
   248  under Windows.
   249  </p>
   250  
   251  <p>
   252  You should also remove the Go <code>bin</code> directory from your
   253  <code>PATH</code> environment variable.
   254  Under Linux and FreeBSD you should edit <code>/etc/profile</code> or
   255  <code>$HOME/.profile</code>.
   256  If you installed Go with the <a href="#osx">Mac OS X package</a> then you
   257  should remove the <code>/etc/paths.d/go</code> file.
   258  Windows users should read the section about <a href="#windows_env">setting
   259  environment variables under Windows</a>.
   260  </p>
   261  
   262  
   263  <h2 id="help">Getting help</h2>
   264  
   265  <p>
   266  For real-time help, ask the helpful gophers in <code>#go-nuts</code> on the
   267  <a href="http://freenode.net/">Freenode</a> IRC server.
   268  </p>
   269  
   270  <p>
   271  The official mailing list for discussion of the Go language is
   272  <a href="http://groups.google.com/group/golang-nuts">Go Nuts</a>.
   273  </p>
   274  
   275  <p>
   276  Report bugs using the
   277  <a href="http://code.google.com/p/go/issues/list">Go issue tracker</a>.
   278  </p>
   279  
   280