golang之git clone

Install Go1.6 from Source on CentOS 7 in China

  1. If there's old version of Go installed, unset $GOPATH, $GOROOT

  2. Make sure Git is installed.

    • Configure Git
      • git config --global user.email "email-for-github"
      • git config --global user.name "user name"
    • New SSH Key and Add Public Key to Github Account
      • ssh-keygen -t rsa -b 2048
      • fdipzone@ubuntu:~$ ssh-keygen -t rsa Generating public/private rsa key pair.
      • Enter file in which to save the key (/home/fdipzone/.ssh/id_rsa): 这里输入要生成的文件名
      • Enter passphrase (empty for no passphrase): 这里输入密码
      • Enter same passphrase again: 这里重复输入密码
      • Your identification has been saved in /home/fdipzone/.ssh/id_rsa. Your public key has been saved in /home/fdipzone/.ssh/id_rsa.pub. The key fingerprint is: f2:76:c3:6b:26:10:14:fc:43:e0:0c:4d:51:c9:a2:b0 fdipzone@ubuntu The key's randomart image is: +--[ RSA 2048]----+ | .+=*.. | | . += + | | o oo+ | | E . . o | | ..S. | | .o . | | .o + | | ...oo | | +. | +-----------------+
      • fdipzone@ubuntu:~$ ls -lt ~/.ssh
        总用量 12
        -rw------- 1 fdipzone fdipzone 1679 2015-08-07 00:28 id_rsa
        -rw-r--r-- 1 fdipzone fdipzone  397 2015-08-07 00:28 id_rsa.pub
      • https://github.com/settings/keys 设置 New Keys;(拷贝id_rsa.pub所有内容)
      • Copy the public key in ~/.ssh/id_rsa.pub and go to github SSH settings to add new SSH key.
  3. Install gcc and glibc-devel

  • sudo yum install gcc glibc-devel
  1. Build Go1.4 from source
  • cd ~/
  • git clone git@github.com:golang/go.git
  • cd go
  • git checkout -b 1.4.3 go1.4.3
  • cd src
  • ./all.bash
  1. Copy ~/go to $GOROOT_BOOTSTRAP(It's ~/go1.4 by default)`
  • cp ~/go ~/go1.4 -rf
  1. Build Go1.6 from source
  • cd ~/go
  • git clean -dfx
  • git checkout -b 1.6 go1.6
  • cd src
  • ./all.bash (默认当前环境的参数,如linux/amd64)
  • 但是如果编译需要linux/mipsle,此时不需要瞎搞,等待设置完环境变量后再搞;
  1. Set $GOPATH and add Go binary path to $PATH
  • sudo vi /etc/profile

        # Golang Env
        export PATH=$PATH:/home/xx/go/bin
        export GOPATH=/home/xx/go-projects
    
  1. Reboot and test
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值