Skip to content

Instantly share code, notes, and snippets.

@bindiry
Last active September 3, 2016 17:11
Show Gist options
  • Save bindiry/e737ea3554505ea80e9b to your computer and use it in GitHub Desktop.
Save bindiry/e737ea3554505ea80e9b to your computer and use it in GitHub Desktop.
ubuntu setup

Ubuntu Desktop

change sources.list

$ sudo apt-get update
$ sudo apt-get install vim vpnc network-manager-vpnc build-essential gcc g++ git autoconf libtool libssl-dev

install marlin

$ sudo add-apt-repository ppa:noobslab/apps
$ sudo apt-get update
$ sudo apt-get install marlin

ubuntu server

$ apt-get install vim tmux build-essential gcc g++ git mercurial autoconf libtool libssl-dev cmake python-dev

mount cdrom

$ mkdir -p /mnt/cdrom
$ mount /dev/cdrom /mnt/cdrom 
$ cd /mnt

enable root login

$ vim /etc/ssh/sshd_config
# set PermitRootLogin yes
$ service ssh restart

Change IP and DNS

$ vim /etc/network/interfaces

iface eth0 inet static
address 192.168.80.129
netmask 255.255.255.0
gateway 192.168.80.2

$ vim /etc/resolvconf/resolv.conf.d/head

nameserver 8.8.8.8
nameserver 8.8.4.4

$ sudo resolvconf -u

use vpnc on ubuntu server

$ apt -get install vpnc
$ vim /etc/vpnc/default.conf

add

IPSec gateway <ip or domain>
IPSec ID <group name>
IPSec secret <group password>
Xauth username <username>
Xauth password <password>

start

$ vpnc

close

$ vpnc-disconnect
  • 安装Vim 和 Golang
apt-get install vim build-essential cmake python-dev mercurial
cd ~
wget https://storage.googleapis.com/golang/go$VERSION.$OS-$ARCH.tar.gz
tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
echo "export GOROOT=/usr/local/go" >> ~/.bashrc
echo "export GOPATH=/root/workspace/go" >> ~/.bashrc
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
  • 安装插件管理
mkdir -p ~/.vim/bundle
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  • 创建 .vimrc 并设置
set nocompatible
filetype off
colorscheme wombat256

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'gmarik/Vundle.vim'
Plugin 'fatih/vim-go'
Plugin 'Valloric/YouCompleteMe'
Plugin 'SirVer/ultisnips'

call vundle#end()
filetype plugin indent on

" taggle paste
set pastetoggle=<F9>

" set mapleader
let mapleader = ","

" vim-go custom mappings
au FileType go nmap <Leader>s <Plug>(go-implements)
au FileType go nmap <Leader>i <Plug>(go-info)
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <Leader>gv <Plug>(go-doc-vertical)
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <leader>c <Plug>(go-coverage)
au FileType go nmap <Leader>ds <Plug>(go-def-split)
au FileType go nmap <Leader>dv <Plug>(go-def-vertical)
au FileType go nmap <Leader>dt <Plug>(go-def-tab)
au FileType go nmap <Leader>e <Plug>(go-rename)

" vim-go settings
let g:go_fmt_command = "goimports"

" YCM settings
let g:ycm_key_list_select_completion = ['', '']
let g:ycm_key_list_previous_completion = ['']
let g:ycm_key_invoke_completion = '<C-Space>'

" UltiSnips setting
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
  • 安装 .vimrc 中设置好的插件
vim ~/.vimrc
:PluginInstall
  • 安装 go tools binaries
vim ~/.vimrc
:GoInstallBinaries

安装过程中如果有无法进行的情况,可执下如下命令手动安装

go get github.com/kisielk/errcheck
go get github.com/nsf/gocode
go get -v code.google.com/p/rog-go/exp/cmd/godef
go get golang.org/x/tools/cmd/goimports
go get github.com/golang/lint/golint
go get github.com/jstemmer/gotags
go get golang.org/x/tools/oracle

安装完成后 $GOPATH/bin 下的文件列表

errcheck  gocode  godef  goimports  golint  gorename  gotags  oracle
  • 安装YCM实现实时代码补齐
cd ~/.vim/bundle/YouCompleteMe
./install.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment