Fedora14 Linux system installation Golang development environment notes

  • 2020-05-05 11:22:40
  • OfStack

My environment is Fedora14, and Go can be installed in a variety of ways. Here are two of them:

1, Go source installation

Go USES Mercurial for version management. You must first install Mercurial before you can download it.

1. First install Mercurial(get the hg command)


[root@localhost ~]# yum install mercurial 

2. Set the environment variable GOROOT as

installation directory for Go


[root@localhost ~]# mkdir /home/go/ 
 
[root@localhost ~]# export GOROOT=/home/go/ 

3. Get the latest release of Go (now go1.0.3) source code


[root@localhost ~]# hg clone -r release http://go.googlecode.com/hg/ $GOROOT 

4. Set the environment variable PATH to point to the directory where Go's binaries are located so that shell can find them


[root@localhost ~]# export PATH=$PATH:$GOROOT/bin 

5. Start compiling Go


[root@localhost ~]# cd /home/go/src/  
[root@localhost src]# ./all.bash 

6. Perform go


[root@localhost src]# go version  
go version go1.0.3 

If the output gets the results above, the Go installation is successful!

Install

Download the installation package to Go website go1. 0.3. linux - 386. tar. gz

1. Unzip go1.0.3. linux-386.tar.gz to /usr/local/

below


[root@localhost share]# tar xzvf go1.0.3.linux-386.tar.gz -C /usr/local/ 

2. Set the environment variable PATH


[root@localhost ~]# export PATH=$PATH:/usr/local/go/bin 

3. Implement go


[root@localhost share]# go version  
go version go1.0.3 

If the output gets the above results, you can be sure that your Go installation is successful!


Related articles: