搭建一个优雅的ubuntu开发环境
2016-07-29 00:02
99 查看
源设置
cp /etc/apt/sources.list /etc/apt/sources.list.backup gedit /etc/apt/sources.list
163源地址
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
阿里云服务器
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
阿里云kali源
deb http://mirrors.aliyun.com/kali sana main non-free contrib deb http://mirrors.aliyun.com/kali-security/ sana/updates main contrib non-free deb-src http://mirrors.aliyun.com/kali-security/ sana/updates main contrib non-free
系统更新
apt-get update update-manager -c -d *(查看是否有最新系统版本可以升级)* apt-get dist-upgrade *(开始检测并升级所有可升级的系统软件资源【不包括系统版本】)* apt-get upgrade *(进行普通正常的升级检测,如果有可以升级的就可以进行升级)*
设置桌面图标
[Desktop Entry] Version=1.0 Type=Application Name=RubyMine Icon=/usr/lib/RubyMine-7.1.4/bin/rubymine.png Exec="/home/lamb/work/xxx/bin/xxx.sh" %f Comment=Develop with pleasure! Categories=Development;IDE; Terminal=false StartupWMClass=jetbrains-rubymine
配置环境变量
/etc/profile
为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行。我们一般在这里为所有用户设置全局环境变量。/etc/bashrc
为每一个运行bash shell的用户执行此文件。当bash shell被打开时,该文件被读取。~/.bash_profile
每个用户都可使用该文件输入专用于自己使用的shell信息。 当用户登录时,该文件仅仅执行一次!~/.bashrc
该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该文件被读取。~/.bash_logout
当每次退出系统(退出bash shell)时,执行该文件。执行方式
当你登录并且登录shell是bash时,bash首先执行/etc/profile文件中的命令(如果该文件存在),然后它顺序寻找~/.bash_profile、~/.bash_login或~/.profile文件,并执行找到的第一个可读文件中的命令。当登录bash退出时,它 将执行~/.bash_logout文件中的命令。当启动一个交互的bash时,它将执行~/.bashrc文件中的命令(如果该文件存在并且可读)。当非交互地启动以运行一个shell脚本时,bash将查找bash_env环境变量,确定执行文件的名称。
常见软件安装
包管理
apt-cache search package 搜索包 apt-cache show package 获取包的相关信息,如说明、大小、版本等 apt-cache showpkg package 显示许多细节,以及和其它包裹的关系 apt-cache depends package 了解使用依赖 apt-cache rdepends package 是查看该包被哪些包依赖 sudo apt-get install package 安装包 sudo apt-get install package --reinstall 重新安装包 sudo apt-get -f install 修复安装"-f = ——fix-missing" sudo apt-get remove package 删除包 sudo apt-get remove package --purge 删除包,包括删除配置文件等 sudo apt-get update 更新源 sudo apt-get upgrade 更新已安装的包 sudo apt-get dist-upgrade 升级系统 sudo apt-get dselect-upgrade 使用 dselect 升级 sudo apt-get build-dep package 安装相关的编译环境 sudo apt-get source package 下载该包的源代码 sudo apt-get clean && sudo apt-get autoclean 清理无用的包 sudo apt-get check 检查是否有损坏的依赖
SSH安装
apt-get install openssh-server
GIT安装
apt-get install git
autojump安装
sudo apt-get install autojump
oh-my-zsh安装
curlsh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"[/code]
wgetsh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
如果需要更多使用技巧,请参考:https://github.com/robbyrussell/oh-my-zsh。搭建自己的vim开发环境
sudo apt-get install vim
在 .vim 目录中建立 bundle 目录,以后Vundle自动下载的插件都保存在这里。然后,进入 Bundle 目录,使用 git clone 命令下载 vundle。cd ~/.vim mkdir bundle git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
配置bundle支持,.vimrc添加如下内容:set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " alternatively, pass a path where Vundle should install plugins "call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' " The following are examples of different formats supported. " Keep Plugin commands between vundle#begin/end. " plugin on GitHub repo Plugin 'tpope/vim-fugitive' " plugin from http://vim-scripts.org/vim/scripts.html "Plugin 'L9' " Git plugin not hosted on GitHub "Plugin 'git://git.wincent.com/command-t.git' " git repos on your local machine (i.e. when working on your own plugin) "Plugin 'file:///home/gmarik/path/to/plugin' " The sparkup vim script is in a subdirectory of this repo called vim. " Pass the path to set the runtimepath properly. Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} " Install L9 and avoid a Naming conflict if you've already installed a " different version somewhere else. Plugin 'ascenator/L9', {'name': 'newL9'} Bundle 'scrooloose/nerdtree' Bundle 'Valloric/YouCompleteMe' Bundle "taglist.vim" Bundle "ctags.vim" Bundle "a.vim" Plugin 'bling/vim-airline' Plugin 'tpope/vim-commentary' Plugin 'altercation/vim-colors-solarized' Plugin 'tpope/vim-fugitive' Plugin 'godlygeek/tabular' " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required " To ignore plugin indent changes, instead use: "filetype plugin on " " Brief help " :PluginList - lists configured plugins " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate " :PluginSearch foo - searches for foo; append `!` to refresh local cache " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal " " see :h vundle for more details or wiki for FAQ " Put your non-Plugin stuff after this line
打开一个vim, 运行:BundleInstall
常用命令更新插件:BundleUpdate 清除不再使用的插件:BundleClean 列出所有插件:BundleList 查找插件:BundleSearch
其它设置,在.vimrc中添加"配置NERD Tree map <F10> :NERDTreeToggle<CR> filetype on syntax on set autoindent set smartindent set tabstop=4 set shiftwidth=4 set showmatch set ruler set number
更多使用技巧,参考:http://vim.wikia.com/wiki/Vim_Tips_Wiki。
报错YouCompleteMe unavailable: requires Vim 7.4.143+,解决办法:sudo add-apt-repository ppa:jonathonf/vim sudo apt-get update && sudo apt-get -u dist-upgrade sudo apt-get install vim-nox安装ctags
sudo apt-get install exuberant-ctags
.vimrc中添加Bundle "taglist.vim"JDK安装
tar zxvf ./jdk-7u45-linux-x64.tar.gz -C /usr/lib/ vim /etc/profile export JAVA_HOME=/usr/lib/jdk1.7.0_45 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH source /etc/profileRUBY安装
add-apt-repository ppa:costamagnagianfranco/ettercap-stable-backports apt-get update apt-get install curl curl -L https://get.rvm.io | bash -s stable source ~/.bashrc rvm install 2.1.0 rvm use 2.1.0 --default gem source -r http://rubygems.org/ gem sources --add https://ruby.taobao.org/ gem source gem install bundler gem install railsRubyMine安装
tar zxvf ./RubyMine-7.1.4.tar.gz -C /usr/lib/PYTHON安装
apt-get install python-pipNODEJS安装
tar zxvf ./ node-v4.2.4-linux-x64.tar.gz -C /usr/lib/ vim ~/.bashrc export NODE_HOME=/usr/lib/node-v4.2.4-linux-x64 export PATH=${NODE_HOME}/bin:$PATH source ~/.bashrcGO安装
tar zxvf go1.5.1.linux-amd64.tar.gz -C /usr/lib/ vim ~/.bashrc export GOROOT=/usr/lib/go export PATH=$PATH:$GOROOT/bin source ~/.bashrc阅读 Linux 内核源代码
搜索内核源码版本
sudo apt-cache search linux-source sudo apt-get install linux-source查看Linux 内核源代码
进入 Linux 内核源代码包的安装目录,解压 Linux 内核源代码,并生成 tags 文件sudo tar jxvf linux-source-3.13.0.tar.bz2 cd linux-source-3.13.0 sudo ctags -R
阅读代码前,需要告诉 Vim 使用哪一个 tags 文件,在这里,就是刚刚使用 ctags 生成的文件,可以通过 :set tags=/usr/src/linux-source-3.13.0/tags 来设置。如果需要启动vim时,自动设置tags,可以在.vimrc添加如下内容:set tags=/usr/src/linux-source-3.13.0/tags
最后,启动 Vim,找到相应的代码进行浏览。如果编辑的是一个目录的话(如下面的 :e . 命令,表示编辑当前目录),会自动跳出 The-NERD-tree 的界面,在目录之间导航非常方便。
相关文章推荐
- Ubuntu 16.04 SPARK 开发环境搭建-- 伪分布版 与新建一个Spark版本的WordCount
- 搭建一个开发Predix软件的Ubuntu 系统(3)配置Java开发环境
- ubuntu环境利用Vagrant搭建一个虚拟开发环境
- ubuntu 下搭建一个python3的虚拟环境(用于django配合postgresql数据库开发)
- 用 Ubuntu 搭建一个 Ruby on Rails 本地开发环境
- 搭建一个开发Predix软件的Ubuntu 系统(2)配置使用Predix工业云平台的基础环境
- 手把手与你搭建一个MASM开发环境学写Makefile
- ubuntu/mysql C++开发环境搭建
- 在ubuntu7.10下搭建flex开发环境
- 在ubuntu上搭建uClinux编译开发环境并用Skyeye (2)
- 在ubuntu上搭建uclinux开发环境(转载)--- 第二篇
- Ubuntu下搭建Java开发环境[转帖 ]
- 在ubuntu7.10下搭建flex开发环境
- 在ubuntu7.10上搭建uClinux编译开发环境并用Skyeye进行仿真
- 初学者如何在 Linux (Ubuntu) 下搭建C/C++ 开发环境
- 在ubuntu7.10下搭建flex开发环境详解
- ubuntu8.04+skyeye1.2.4搭建linux2.6.24+s3c2410的模拟arm-linux开发环境
- Ubuntu8.04搭建C++开发环境