ubuntu配置

                                   ubuntu配置
                                           

    
1、 安装ssh。   
    $ sudo passwd root    ---> 设置root密码。
    $ sudo apt-get install ssh
    
    
2、 更新源。
    $ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

    指定国内源:
    $ sudo vi /etc/apt/sources.list 
    添加: 
""""""""""""""""""""""""""""
 # 网易源:注意对应的版本1404
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

"""""""""""""""""""""""""""" 
    $ sudo apt-get update


3、 vim配置。
    $ sudo apt-get install vim ctags git 
       
    下载vim管理插件(vundle):
     $ git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

    $ sudo vi /etc/vim/vimrc.local
    添加:

        
""""""""""""""""""""""""""""

filetype on                   " required!
 
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
 
" let Vundle manage Vundle
" required! 
Bundle 'gmarik/vundle'
 
" My Bundles here:
"
" original repos on github
Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'tpope/vim-rails.git'
" vim-scripts repos
Bundle 'L9'
Bundle 'FuzzyFinder'
" non github repos
Bundle 'git://git.wincent.com/command-t.git'
" ...
 
filetype plugin indent on     " required!
"
" Brief help  -- 此处后面都是vundle的使用命令
" :BundleList          - list configured bundles
" :BundleInstall(!)    - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..

set autoindent             " 缩进与上次相同
set smartindent
set hlsearch               " 将搜索内容反白 
set backspace=2            " 可以删除任意值
set cindent                " 使用 C/C++ 语言的自动缩进方式
set mouse=a                " 设置在哪些模式下使用鼠标功能,mouse=a 表示所有模式
set expandtab              " 用空格代替tab
set ruler                  " 打开光标的行列位置显示功能
set ambiwidth=double       " 显示中文引号
set cursorline             " 行高亮
set hlsearch               " 高亮搜索的关键字
set ignorecase             " 搜索忽略大小写
set history=100            " 设置命令历史行数
set wrap                   " 设置自动换行
set shortmess=atI          " 启动的时候不显示那个援助索马里儿童的提示
set novisualbell           " 不要闪烁
setlocal noswapfile        " 不要生成swap文件,当buffer被丢弃的时候隐藏它
syntax on                  " 语法高亮
set nocompatible           " 不使用vim的键盘模式
set confirm                " 未保存或者只读时,弹出确认
set showcmd                " 显示未完成命令
set tabstop=4              " tab为4个空格
set shiftwidth=4           " 行交错
set hlsearch               " 高亮查找匹配
set background=dark        " 背景色
set showmatch              " 显示匹配
set noerrorbells           " 不发出警告声
set nocp
set smartindent            " 智能选择对齐方式     
set incsearch              " 快速匹配
set fileencodings=gbk,utf-8,gb2312,gb18030,cp936
set termencoding=gbk,utf-8,gb2312,gb18030,cp936

" 增强模式中的命令行自动完成操作
set wildmenu

"执行 Vim 缺省提供的 .vimrc 文件的示例,包含了打开语法加亮显示等最常用的功能
source $VIMRUNTIME/vimrc_example.vim
 
"缺省不产生备份文件
set nobackup
set noswapfile
set nowritebackup

"在输入括号时光标会短暂地跳到与之相匹配的括号处,不影响输入
set showmatch

"正确地处理中文字符的折行和拼接
set formatoptions+=mM
 
"设定文件浏览器目录为当前目录
set bsdir=buffer

"自动切换当前目录为当前文件所在的目录
set autochdir

"自动重新加载外部修改内容
set autoread

"使PHP识别EOT字符串
hi link phpheredoc string
 
"允许在有未保存的修改时切换缓冲区
set hidden

"进入当前编辑的文件的目录
autocmd BufEnter * exec "cd %:p:h"

"保存文件的格式顺序
set fileformats=dos,unix
 

"配色(更多的配色见colors目录和http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-c.html
"colorscheme peacock_light

"启动后最大化
au GUIEnter * simalt ~x

"记录上次关闭的文件及状态
set viminfo='10,\"100,:20,%,n$VIMRUNTIME/_viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
"autocmd BufWinLeave * if expand('%') != '' && &buftype == '' | mkview | endif
"autocmd BufRead     * if expand('%') != '' && &buftype == '' | silent loadview | syntax on | endif
"You can obtain the completion dictionary file from:
"http://cvs.php.net/viewvc.cgi/phpdoc/funclist.txt
"set dictionary+=$VIM\vimfiles\syntax\function.txt
au FileType php setlocal dictionary+=$VIM\vimfiles\syntax\function.txt
if !exists('g:AutoComplPop_Behavior')
    let g:AutoComplPop_Behavior = {}
    let g:AutoComplPop_Behavior['php'] = []
    call add(g:AutoComplPop_Behavior['php'], {
            \   'command'   : "\<C-x>\<C-o>",
            \   'pattern'   : printf('\(->\|::\|\$\)\k\{%d,}$', 0),
            \   'repeat'    : 0,
            \})
endif
 
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap < <><ESC>i
:inoremap > <c-r>=ClosePair('>')<CR>
 
function! ClosePair(char)
  if getline('.')[col('.') - 1] == a:char
    return "\<Right>"
    else
    return a:char
  endif
endf
 
 
"平台判断
function! GetSystem()
    if (has("win32") || has("win95") || has("win64") || has("win16"))
        return "windows"
    elseif has("unix")
        return "linux"
    elseif has("mac")
        return "mac"
    endif
endfunction


" 插件配置
""""""""""""""""""设置开启ctags"""""""""""""   
Bundle 'ctags.vim'  
nmap <F3> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR>

set tags=tags;  
set autochdir 

 
"""""""""""""""""Taglist设置"""""""""""""""""  
Bundle 'taglist.vim' 
if GetSystem() == "windows"
    let g:Tlist_Ctags_Cmd = $VIMRUNTIME.'\ctags'
else
    let g:Tlist_Ctags_Cmd = '/usr/bin/ctags'
endif        
map <F4> :Tlist<CR>                      
let Tlist_Auto_Open = 0                 " 在启动VIM后,自动打开taglist窗口  
let Tlist_Ctags_Cmd = '/usr/bin/ctags'  " 设定ctags的位置  
let Tlist_Use_Right_Window=0            " 1为让窗口显示在右边,0为显示在左边  
let Tlist_Show_One_File=0               " 让taglist可以同时展示多个文件的函数列表,设置为1时不同时显示>多个文件的tag,只显示当前文件的  
let Tlist_File_Fold_Auto_Close=1        " 同时显示多个文件中的tag时,taglist只显示当前文件tag,>其他文件的函数列表折叠隐藏  
let Tlist_Exit_OnlyWindow=1             " 当taglist是最后一个分割窗口时,自动退出vim  
"let Tlist_Use_SingleClick= 1           " 缺省情况下,在双击一个tag时,才会跳到该tag定义的位置  
"let Tlist_Process_File_Always=0        " 是否一直处理tags.1:处理;0:不处理 


"""""""""""""""""""WinManager"""""""""""""""""
Bundle 'winmanager'
" 映射WinManager快捷键,控制开启和关闭  
nmap <F5> :WMToggle<CR> 
" 设置WinManager与TagList的布局:前者在上,后者在下  
let g:winManagerWindowLayout='FileExplorer|TagList' 


"""""""""""""""""""""grep""""""""""""""""""""
Bundle 'grep.vim'
nnoremap <silent> <F6> :Rgrep<CR>   


""""""""""""""""""QuickFix"""""""""""""""""""
nmap <F7> :cn<cr>
nmap <F8> :cp<cr>

"""""""""""""""""""A插件设置""""""""""""""""""
Bundle 'a.vim'
nnoremap <silent> <F12> :A<CR>


""""""""""""""""""cscope设置"""""""""""""""""" 
Bundle 'cscope.vim'         
set cscopequickfix=s-,c-,d-,i-,t-,e-    " 结果输出到quickfix窗口
if has("cscope")    
    set csprg=/usr/bin/cscope    
    set csto=1  
    set cst    
    set nocsverb   

    if filereadable("cscope.out")      
       cs add cscope.out    
    endif    
    set csverb    
endif    
  
nmap <C->s :cs find s <C-R>=expand("<cword>")<CR><CR>  
nmap <C->g :cs find g <C-R>=expand("<cword>")<CR><CR>  
nmap <C->c :cs find c <C-R>=expand("<cword>")<CR><CR>  
nmap <C->t :cs find t <C-R>=expand("<cword>")<CR><CR>  
nmap <C->e :cs find e <C-R>=expand("<cword>")<CR><CR>  
nmap <C->f :cs find f <C-R>=expand("<cfile>")<CR><CR>  
nmap <C->i :cs find i <C-R>=expand("<cfile>")<CR><CR>  
nmap <C->d :cs find d <C-R>=expand("<cword>")<CR><CR>

""""""""""""""""""MiniBufExplorer"""""""""""""
Bundle 'minibufexpl.vim'
" <C-Tab> 向前循环切换到每个buffer上,并在但前窗口打开
" <C-S-Tab> 向后循环切换到每个buffer上,并在但前窗口打开
" let g:miniBufExplMapCTabSwitchBufs = 1  
 
" 则可以用<C-h,j,k,l>切换到上下左右的窗口中去,就像: 
" C-w,h j k l    向"左,下,上,右"切换窗口. 
" let g:miniBufExplMapWindowNavVim=1 

" 用<C-箭头键>切换到上下左右窗口中去.
" let g:miniBufExplMapWindowNavArrows=1 


""""""""""""""""""""omnicppcomplete"""""""""""
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascrīptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete

Bundle 'omnicppcomplete'
" set tags=D:/ctags/tags/cpp 
" set tags+=D:/ctags/tags/hge 
" set tags+=D:/ctags/tags/curl " OmniCppComplete 
 let OmniCpp_NamespaceSearch = 2
 let OmniCpp_GlobalScopeSearch = 1
 let OmniCpp_ShowAccess = 1 
 let OmniCpp_ShowPrototypeInAbbr = 1 " 显示函数参数列表 
 let OmniCpp_MayCompleteDot = 1   " 输入 .  后自动补全
 let OmniCpp_MayCompleteArrow = 1 " 输入 -> 后自动补全 
 let OmniCpp_MayCompleteScope = 1 " 输入 :: 后自动补全 
 let OmniCpp_SelectFirstItem = 2
 let OmniCpp_DisplayMode=1
 let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"] " 自动关闭补全窗口 
 au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif 
 set completeopt=menuone,menu,longest
 highlight Pmenu    guibg=darkgrey  guifg=black 
 highlight PmenuSel guibg=lightgrey guifg=black

""""""""""""""""""""superTab插件""""""""""""""
Bundle 'supertab'
let g:SuperTabDefaultCompletionType="context"


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:BundleList          #已安装列表
:BundleInstall(!)    #安装、升级
:BundleSearch(!)     #搜索
:BundleClean(!)      #删除
   
    
4、 配置samba服务端。
    $ sudo apt-get install samba system-config-samba
    $ sudo system-config-samba    ---> 启动图形界面配置
   


5、 静态配置网络地址。
  $ sudo gedit /etc/network/interfaces  添加如下内容:
  添加:
""""""""""""""""""""""""""""

auto eth0
iface eth0 inet static
address 192.168.7.xxx 
gateway 192.168.7.1
netmask 255.255.255.0
dns-nameservers 202.96.134.133(配置DNS)注意以前配置方法重启会被覆盖。
  
""""""""""""""""""""""""""""


6、 配置FTP服务。
    $ sudo apt-get install vsftpd
    $ sudo vi /etc/vsftpd.conf 
    
    确保下面选项不被释:
""""""""""""""""""""""""""""   
 
anonymous_enable=NO 
local_enable=YES  
write_enable=YES 
    
""""""""""""""""""""""""""""
    $ sudo /etc/init.d/vsftpd restart


7、 配置NFS服务。
  $ sudo apt-get install nfs-kernel-server
  $ sudo vi /etc/exports
  
  添加:
  注:
  nfs允许挂载的目录及权限,在文件/etc/exports中进行定义,各字段含义如下:
 /home/lhj/nfs :要共享的目录
         * :允许所有的网段访问
       rw :读写权限
      sync:资料同步写入内存和硬盘
no_root_squash :nfs客户端共享目录使用者权限
""""""""""""""""""""""""""""  

/home/lhj/nfs *(rw,sync,no_root_squash)

  
"""""""""""""""""""""""""""" 
 $ sudo /etc/init.d/nfs-kernel-server restart      ---> 重启nfs服务
 $ showmount -e                                    ---> 显示共享出的目录
 
 测试:
 $ sudo mount -t nfs 192.168.200.134:/home/lhj/nfs  /mnt  ---> 挂载目录
 $ ls /mnt                 ---> 可以查看挂载的文件
 $ sudo umount /mnt        ---> 取消挂载
 $ mount -t nfs -o nolock IPADDRESS:/home/lhj/nfs /mnt  ---> 用在嵌入式设备上挂载,要加上参数-o nolock
 
 
8、 安装TFTP服务。
  $ sudo apt-get install tftp-hpa tftpd-hpa  xinetd 
  $ sudo mkdir /home/lhj/tftpboot  
  $ sudo chmod 777 -R /home/lhj/tftpboot
  $ sudo vi /etc/xinetd.d/tftp
  添加:
"""""""""""""""""""""""""""" 

service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /home/lhj/tftpboot -c
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}

""""""""""""""""""""""""""""
 $ sudo vi /etc/default/tftpd-hpa 
""""""""""""""""""""""""""""

#/etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/home/lhj/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s" 

""""""""""""""""""""""""""""   
 $ sudo vim /etc/xinetd.conf

"""""""""""""""""""""""""""" 
defaults

{
 # Please note that you need a log_type line to be able to use log_on_success
 # and log_on_failure. The default is the following :
 # log_type = SYSLOG daemon info
 }
 includedir /etc/xinetd.d

#tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot

"""""""""""""""""""""""""""" 
  $ sudo service tftpd-hpa restart
  $ sudo /etc/init.d/xinetd reload                                                     
  $ sudo /etc/init.d/xinetd restart
  $ sudo ufw disable  (禁用防火墙).
  测试:
 从服务器下载文件(存放在 /tftpboot目录下的test文件)
 tftp IPaddress(192.168.x.xxx)
 tftp>  get  test(获取下取文件)
 tftp>  put  test (上传)
 tftp>  quit      (退出)
 查看当前目录是否下载了test(不要在/tftpboot目录下执行以上命令).

9. 安装其它
 $ sudo apt-get install automake   // 详解请参照automake配置
        $ sudo apt-get install make
        $ sudo apt-get install gcc
 $ sudo apt-get install ncurses-dev  // make menuconfig
        $ sudo apt-get install cmake


        
 
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值