Centos7安装Golang1.6,并配置vim环境

来源:互联网 发布:mmd成人动作数据 编辑:程序博客网 时间:2024/06/10 06:03

http://icsmile.com/2016/03/31/centos7_go1.6/

在CentOS7下安装golang1.6版本,并进行vim高亮配置

安装

  • 卸载之前的版本
 yum remove golang
  • 下载Golang1.6
 wget http://www.golangtc.com/static/go/1.6/go1.6.linux-amd64.tar.gz tar -zxvf  go1.6.linux-amd64.tar.gz
修改环境变量文件和工作环境

由于个人喜好,我的工作目录都在opt下,故设置golang的工作目录为/opt/golang

 mkdir /opt/golang vim ~/.bash_profile export GOPATH=/opt/golang export GOROOT=/root/golang export PATH=$PATH:$GOROOT/bin
  • 重载环境变量
 source ~/.bash_profile
  • 确认版本
 go version #go version go1.6 linux/amd64

配置vim

  • 首先安装Vundle
 git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  • 配置.vimrc

以下是我的配置环境,仅供参考

 vim ~/.vimrc    set nocompatible              " be iMproved, required      filetype off                  " required      set rtp+=~/.vim/bundle/Vundle.vim      call vundle#begin()      Plugin 'gmarik/Vundle.vim'      Plugin 'fatih/vim-go'      call vundle#end()            " required      filetype plugin indent on    " required      syntax on
  • 安装vim-go
 git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go

安装完成!

0 0
原创粉丝点击