Bt5的配置手记

来源:岁月联盟 编辑:exp 时间:2012-05-04
BT5本来就是用Ubuntu 10.04做得蓝本,所以,我在配置BT5的时候,基本上都是按照Ubuntu 10.04的配置方法,在配置BT5
1    系统基本设置
1.1  安装Ubuntu10.04
分区时首先为根目录分配最多的硬盘空间,然后为boot目录分配200M,最后为swp目录分配内存的2倍空间。
 
1.2  利用软碟通UltraISO制作U盘启动的Ubuntu 10.04
安装软碟通
插入U盘
以管理员运行软碟通
启动光盘-> 写入硬盘映像
选择U盘,写入方式usb-hdd+
完成
 
1.3  更新源
(1)备份源        sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
(2)编辑源        sudo gedit /etc/apt/sources.list
编辑你的源列表,将原来的内容全部删除,添加一个最适合你的源,复制到你的列表中,然后保存列表。我用的是163的源:
(3)更新源          sudo  apt-get  update
(4)升级           sudo  apt-get  upgrade
(5)升级系统    sudo  apt-get  dist-upgrade
 
1.4  更改左边关闭按钮的位置
ubuntu10.04最大的变化可能就是最小化最大化和关闭按钮移到左边去了
按alt+F2进入应用程序运行器,输入gconf-editor进入配置编辑器,依次进入/apps/metacity/general /button_layout
将键值close,minimize,maximize:修改为menu:minimize,maximize,close
再用sudo gconf-editor再把上面的内容修改一次
 
1.5  中文乱码问题
1.5.1  gedit
在Windows下编辑好txt文件后在Ubuntu中使用Gedit打开出现乱码;这是编码方式不同造成的。Windows下txt文件的编码格式为GBK,Ubuntu Gedit默认没有对GBK的支持,需要手动配置。
(1)打开终端,输入”gconf-editor”,回车后打开配置编辑器;
(2)在左边的树节点找到/apps/gedit-2/preferences/encodings并单击它;
(3)双击右边的auto_detected 键,打开“编辑键”对话框;
(4)单击列表右边的“添加”按钮,输入“GB18030”,单击确定按钮,这样列表的最底部新增加了一个“GB18030”。如果你不放心,可以再增加GBK、GB2312编码。
(5)选中“GB18030”将其移动到列表的顶部。如果你在第四步后发现没有乱码了,这一步也就可以省略了。
(6)但是通过这种方法解决后,又会引来新的问题,那就是,当打开一个空文档 时,gedit会崩溃,那么我总结出来到办法就是,把UTF-8放到最上面去就可以了。
(7)再用sudo gconf-editor再把上面的内容修改一次,就可以解决用sudo gedit编辑文档中文乱码的问题了
 
1.5.2  Flash中文显示为方块
编辑/etc/fonts/conf.d/49-sansserif.conf 文件
修改第18行,将
<edit name=”family” mode=”append_last”>
<string>sans-serif</string>
</edit>
修改为
<edit name=”family” mode=”append_last”>
<string>sans</string>
</edit>
 
1.5.3  pdf中文乱码
sudo apt-get install poppler-data
sudo mv /etc/fonts/conf.d/49-sansserif.conf /etc/fonts/conf.d/49-sansserif.conf.backup
 
1.5.4  更多中文字体
(1)去windows系统里复制所需字体,通常是在C/WINDOWS/FONTS下
(2)在home/你的用户名,下创建一个名为“.fonts”的文件夹(前面的小点意为隐藏的文件夹),将刚才所复制的放入“.fonts”
 
1.6  双系统怎样让系统默认为从windows启动
在/etc/grub.d目录中的脚本文件的文件名都是以数字开头,这确定了在执行update-grub时各文件内容被执行的顺序
我们只要把30_os-prober这个文件名的数字30改为05到10之间的数字即可(没多少可选06、07、08、09),比如改为08_os-prober
这样创建出来的grub.cfg内的菜单项,windows的排序就会自动在ubuntu之前。
cd /etc/grub.d
sudo mv 30_os-prober 08_os-prober
此外,还有一种方法,手动修改grub2启动配置文件
sudo cp /boot/grub/grub.cfg /boot/grub/grub.cfg_backup
sudo gedit /boot/grub/grub.cfg
 
1.7  把终端放在右键菜单
sudo apt-get install nautilus-open-terminal
 
1.8  以root权限打开文件夹
sudo apt-get install nautilus-gksu
 
1.9  火狐设置
在Firefox 地址栏里输入“about:config”,然后将修改下面给出的选项到相应的值。
network.http.pipelining > 设为True
network.http.pipelining.maxrequests > 设为8或10
network.http.proxy.pipelining > 设为True
 
1.10    开启3d桌面
sudo apt-get install compizconfig-settings-manager
 
http://forum.ubuntu.org.cn/viewtopic.php?t=140531
 
1.11    快捷键
Ubuntu操作基本快捷键
* 打开主菜单= Alt + F1
* 运行= Alt + F2
* 显示桌面= Ctrl + Alt + d
* 最小化当前窗口= Alt + F9
* 最大化当前窗口= Alt + F10
* 关闭当前窗口= Alt + F4* 截取全屏= Print Screen
* 截取窗口= Alt + Print Screen
* 展示所有窗口程序= F10
* 展示当前窗口最上层程序= F11
* 展示当前窗口所有程序= F12
* 切换窗口= Alt + Tab
* 旋转3D桌面= Ctrl + Alt + 左/右箭头
* 旋转3D桌面(活动窗口跟随)= Ctrl + Shift + Alt + 左/右箭头
* 手动旋转3D桌面= Ctrl + Alt + 左键单击并拖拽桌面空白处
* 窗口透明/不透明= possible with the “transset”utility or Alt + 滚轮
* 放大一次= 超级键+ 右击
* 手动放大= 超级键+ 滚轮向上
* 手动缩小= 超级键+ 滚轮向下
* 移动窗口= Alt + 左键单击
* 移动窗口时贴住边框= 左键开始拖动后再Ctrl + Alt
* 调整窗口大小= Alt + 中击
* Bring up the window below the top window = Alt + middle-click
* 动态效果减速= Shift + F10
* 水纹= 按住Ctrl+超级键
* 雨点= Shift-F9
* 桌面展开=Ctrl + Alt + 下箭头,然后按住Ctrl + Alt 和左/右箭头选择桌面
Nautilus
Shift+Ctrl+N – 新建文件夹, 很有用
Alt + Enter – 查看选择文件/文件夹的属性,代替单击右键选择属性
Ctrl + 1/2 – 改变文件夹视图查看方式,图标视图/列表视图
Ctrl + W – 关闭当前Nautilus窗口
Ctrl + Shift + W – 关闭所有Nautilus窗口
Ctrl+T – 在Nautilus中新建一个标签
Alt + Up/Down Arrow – 移动到父文件夹/选择的文件夹
Alt + Left/Right Arrow – 后退/前进
Alt + Home -直接移动到主文件夹
F9 – 开关显示Nautilus侧边栏
Ctrl + H -开关显示隐藏文件夹
其他
Ctrl + Alt + L -锁屏
Alt + F1 – 打开应用程序菜单
Alt + F2 – 打开运行应用程序对话框
Win + 鼠标滚轮 – 放大/缩小屏幕
 
2    软件安装
2.1  安装Ubuntu额外的版权受限的程序
sudo apt-get install ubuntu-restricted-extras
 
2.2  安装RAR压缩/解压缩程序
sudo apt-get install rar unrar
建立软链接
sudo ln -fs /usr/bin/rar /usr/bin/unrar
这样,以后只要在命令行输入unrar,就可以解压或者压缩文件了,安装完成后,归档管理器也同时集成了rar组件
安装7zip解压缩软件
sudo apt-get install unrar p7zip-full cabextract
 
2.3  安装ibus输入法
2.3.1  输入法自启动
Ubuntu系统安装后已经自带了ibus输入法,在英语环境下 默认不启动。
配置ibus自动启动可以在Ubuntu系 统菜单上选择System ―Preferences ―Startup Applications,在该窗口中增加一 个程序:
Name: ibus-daemon
Command: ibus-daemon -d -x Cr
 
2.3.2  安装智能拼音
ibus 默认提供的中文输入法比较弱智,需要额外安装ibus-pinyin,命令如下:
sudo apt-get install ibus-pinyin
这时,还需要将ibus-pinyin输入法启动。在Ubuntu系 统菜单上选择System ―Preferences ―IBus Preferences,
在Input Method页中的“Select an input method”下拉框中选择增加Chinese C Pinyin,就是图标中有个一个大大的“拼”字的那一个,然后点击Add按钮,最后通过Up按钮将该输入法移动到最上面。
系统重启后,通过Ctrl + 空格即可调出ibus输入法。
 
2.3.3  安装sougou词库
下载http://code.google.com/p/hslinuxextra/downloads/list的sougou-phrases-full.7z
解压后的Andriod.db移动到/usr/share/pinyin-database
将原来的main.db改 名,然后将Andriod.db改名为main.db,注销重进系统就行了,成功标志,能打出:弗雷德霍姆行列式
 
2.4  安装编译环境
安装gcc g++ make等等
sudo apt-get install build-essential
 
2.5  安装gvim
2.5.1  安装vimgdb进行调试
若要安装vimgdb需重新编译安装vim,请参考以下网址
 
http://wiki.ubuntu.org.cn/%E8%80%81%E6%97%A7%E6%96%87%E7%AB%A0/Gvim%E7%9A%84%E5%AE%89%E8%A3%85%E5%8F%8A%E9%85%8D%E7%BD%AE
 
编译安装vim一定记得要先安装编译vim-gtk的依赖包
sudo apt-get build-dep vim-gtk
 
2.5.2  安装ctags
tar -xzvf   ctags.xxxxxx
./configure    –prefix= 安装的目录
make
sudo make install
ctags   –version 测试是否安装成功
或者执行下面的命令:
sudo apt-get install exuberant-ctags
 
2.5.3  添加gvim 启动项
sudo cat > /usr/share/applications/gvim.desktop << “EOF”
[Desktop Entry]
Name=Gvim
Comment[zh_CN]=Gvim编辑器
Exec=gvim
Icon=/usr/share/pixmaps/gnome-word.png
Terminal=false
X-MultipleArgs=false
Type=Application
Categories=Application;Development;
Encoding=UTF-8
StartupNotify=true
 
2.5.4  编译gvim 后忽略错误警报
alias gvim=”gvim -reverse 2>/dev/null”
alias tvim=’gvim –remote-tab-silent’2.5.5  把gvim打造成IDE2.5.6  .vimrc配置文件
cp /usr/share/vim/vim72/vimrc_example.vim ~/.vimrc
vim ~/.vimrc
在文件末尾增加以下内容:
”by djk 2010.9.22 for Ubuntu 10.04
” 编辑设置
set number
set cursorline
set tabstop=4
set sw=4
set expandtab
set autoindent
set cindent
set nobackup
set nowritebackup
set showmatch
set statusline=%<%F%h%m%r%h%w%y/ %=/ line:%l//%L/ %=/ col:%c%V/ %=/ %p%%
set laststatus=2
syntax enable
syntax on
:match DiffAdd ‘/%>80v.*’
colorscheme desert
” 括号自动补全
inoremap [ []<esc>:let leavechar=”]”<cr>i
inoremap { {<esc>o}<esc>:let leavechar=”}”<cr>O
” 设置代码折叠
set foldcolumn=0
set foldmethod=indent
set foldlevel=3
” 设置字体
“set guifont=Bitstream_Vera_Sans_Mono:h12:cANSI
“set gfw=Yahei_Mono:h10.5:cGB2312
” 解决中文编码问题
let &termencoding=&encoding
set fileencodings=utf-8,gbk,ucs-bom,cp936
” 进行版权声名 按F4进行添加和更新
map <F4> ms:call TitleDet()<cr>’s
function AddTitle()
call append(0,”/*====================================================”)
call append(1,”#”)
call append(2,”# Author: JK David – “)
call append(3,”#”)
call append(4,”# Last modified: “.strftime(“%Y-%m-%d %H:%M”))
call append(5,”#”)
call append(6,”# Filename: “.expand(“%:t”))
call append(7,”#”)
call append(8,”# Description: “)
call append(9,”#”)
call append(10,”====================================================*/”)
echohl WarningMsg | echo “Successful in adding the copyright.” | echohl None
endf
function UpdateTitle()
normal m’
execute ‘/# *Last modified:/s@:.*$@/=strftime(“: %Y-%m-%d %H:%M”)@’
normal ”
normal mk
execute ‘/# *Filename:/s@:.*$@/=”: “.expand(“%:t”)@’
execute “noh”
normal ‘k
echohl WarningMsg | echo “Successful in updating the copy right.” | echohl None
endfunction
function TitleDet()
let n=1
while n < 8
let line = getline(n)
if line =~ ‘^/#/s*/S*Last/smodified:/S*.*$’
call UpdateTitle()
return
endif
let n=n+1
endwhile
call AddTitle()
endfunction
” 编译运行程序
if(has(“win32″) || has(“win95″) || has(“win64″) || has(“win16″))
let g:iswindows=1
else
let g:iswindows=0
endif
”F5单个文件编译
map <F5> :call Do_OneFileMake()<CR>
function Do_OneFileMake()
exec “w”
if expand(“%:p:h”)!=getcwd()
echohl WarningMsg | echo “Fail to make! This file is not in the current dir! Press <F7> to redirect to the dir of this file.” | echohl None
return
endif
let sourcefileename=expand(“%:t”)
if (sourcefileename==”" || (&filetype!=”cpp” && &filetype!=”c”))
echohl WarningMsg | echo “Fail to make! Please select the right file!” | echohl None
return
endif
let deletedspacefilename=substitute(sourcefileename,’ ‘,”,’g')
if strlen(deletedspacefilename)!=strlen(sourcefileename)
echohl WarningMsg | echo “Fail to make! Please delete the spaces in the filename!” | echohl None
return
endif
if &filetype==”c”
if g:iswindows==1
set makeprg=gcc/ -o/ %<.exe/ %
else
set makeprg=gcc/ -o/ %</ %
endif
elseif &filetype==”cpp”
if g:iswindows==1
set makeprg=g++/ -o/ %<.exe/ %
else
set makeprg=g++/ -o/ %</ %
endif
“elseif  &filetype==”cs”
“set makeprg=csc/ //nologo/ //out:%<.exe/ %
endif
if(g:iswindows==1)
let outfilename=substitute(sourcefileename,’/(/.[^.]*/)$’,’.exe’,'g’)
let toexename=outfilename
else
let outfilename=substitute(sourcefileename,’/(/.[^.]*/)$’,”,’g')let toexename=outfilename
endif
if filereadable(outfilename)
if(g:iswindows==1)
let outdeletedsuccess=delete(getcwd().”//”.outfilename)
else
let outdeletedsuccess=delete(“./”.outfilename)
endif
if(outdeletedsuccess!=0)
set makeprg=make
echohl WarningMsg | echo “Fail to make! I cannot delete the “.outfilename | echohl None
return
endif
endif
execute “silent make”
set makeprg=make
execute “normal :”
if filereadable(outfilename)
if(g:iswindows==1)
execute “!”.toexename
else
execute “!./”.toexename
endif
endif
execute “copen”
endfunction
“进行make的设置
map <F6> :call Do_make()<CR>
map <c-F6> :silent make clean<CR>
function Do_make()
set makeprg=make
execute “silent make”
execute “copen”
endfunction
”F2显示或隐藏菜单栏和工具栏
set guioptions-=m
set guioptions-=T
map <silent> <F2> :if &guioptions =~# ‘T’ <Bar>
/set guioptions-=T <Bar>
/set guioptions-=m <bar>
/else <Bar>
/set guioptions+=T <Bar>
/set guioptions+=m <Bar>
/endif<CR>
”ctrl+F12 更新tags文件
set tags=tags
au FileType cpp,c set tags+=~/.vim/stl_tags
set autochdir
map <c-F12> :!ctags -R –c++-kinds=+p –fields=+iaS –extra=+q .<cr>
”————–
” 插件管理
”————–
”taglist.vim
”:Tlist open taglist window
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Use_Right_Window=1
let Tlist_Sort_Type=”name”
let Tlist_File_Fold_Auto_Close=1
let Tlist_Auto_Open = 0
let Tlist_Auto_Update = 1
let Tlist_Hightlight_Tag_On_BufEnter = 1
let Tlist_Enable_Fold_Column = 0
let Tlist_Process_File_Always = 1
let Tlist_Display_Prototype = 0
let Tlist_Compact_Format = 1
”command wm show fileexplorer window and taglist window
let g:winManagerWindowLayout=’FileExplorer|TagList’
nmap wm :WMToggle<cr>
”a.vim
”exchange head file and source file
”:A 打开源文件和头文件
”:AV 打开源文件和头文件并分屏
”grep.vim
”press F3 to search
nnoremap <silent> <F3> :Grep<CR>
”auto completion
filetype plugin indent on
set completeopt=longest,menu
”omnicppcomplete
let OmniCpp_DefaultNamespaces = ["std"]
let OmniCpp_GlobalScopeSearch = 0
let OmniCpp_NamespaceSearch = 1
let OmniCpp_DisplayMode = 1
let OmniCpp_ShowScopeInAbbr = 0
let OmniCpp_ShowPrototypeInAbbr = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_MayCompleteDot = 1
let OmniCpp_MayCompleteArrow = 1
”NERD_commenter.vim
” 按下一次ctrl+h是注释,再按下一次是取消注释
”[count],cc 光标以下count行逐行添加注释(7,cc)
”[count],cu 光标以下count行逐行取消注释(7,cu)
”[count],cm 光标以下count行尝试添加块注释(7,cm)
”,cA 在行尾插入/* */,并且进入插入模式
let NERDShutUp=1
map <c-h> ,c<space>
”shell.vim www.2cto.com
”press F11 to fullscreen
”press F6 to open files directories urls and email under the cursor”
”snipmate
let snippets_dir=’/home/djk/.vim/snippets’
”crefvim
”press /cr to invoke C-reference
”stlrefvim
”place the cursor over the function
”press /tr to go to the documentation for it
”press /te to go to an example that uses this function
 
2.5.7  gvim以tab方式打开新文件
gvim   –remote-tab-silent  filename
为了方便可以在.bashrc中加入
alias vim=’gvim –remote-tab-silent’
alias gvim=’gvim –remote-tab-silent’
 
2.6  安装翻译软件stardict
sudo apt-get install stardict
词典选择
词典下载地址
将下载的词典放在一个目录下,进入该目录,输入以下命令可以一次性安装所有词典:
for i in stardict*.tar.bz2; do sudo tar xjvf “$i”-C /usr/share/stardict/dic/; done2.7  安装openfetion
使用飞信免费发短信,现在也可以使用webfetion了
安装库
apt-get install libxml2-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libssl-dev
sudo apt-get install libnotify-dev
sudo apt-get install libgstreamer0.10-dev
sudo apt-get install intltool
下载openfetion源码,进入src目录,执行以下命令
./configure
make
sudo make install
在/etc/ld.so.conf 中另起一行添加/usr/local/lib
之后运行以下命令即可
sudo ldconfig
 
2.8  安装smplayer
media播放器
sudo apt-get install smplayer
 
2.9  安装chmsee
查看chm文件
sudo apt-get install chmsee
 
2.10    安装scilab
类似MATLAB的科学计算软件
 
2.11    安装农历日历
sudo aptitude install lunar-applet
不过有个小问题,由于我使用的locale是en_US.utf8,所以阴历显示的都是拼音,解决方案如下:
sudo ln -s /usr/share/locale/zh_CN/LC_MESSAGES/liblunar.mo /usr/share/locale/en/LC_MESSAGES/
 
2.12    安装Eclipse
sudo apt-get install eclipse
 
2.13    安装openssh-server
这样就可以远程登陆ubuntu了
sudo apt-get install openssh-server
 
2.14    安装ftp图形界面工具filezilla
sudo apt-get install filezilla
 
2.15    安装时间管理软件gtg
sudo apt-get install gtg
 
2.16    安装docky
sudo apt-get install docky
 
2.17    安装latex
sudo apt-get install texlive-full
 
http://forum.ubuntu.org.cn/viewtopic.php?t=150168
 
3    FAQ
3.1  怎么删除编译安装的软件
cd 源代码src目录
make clean
./configure
make
make uninstall
 
3.2  怎么安装tar.gz文件
先解包,tar -zxvf xxx.tar.gz,这样会生成一个以文件名命名的文件夹。里面会有一些README、INSTALL、DOC等等一些文档,仔细读读,可以知道这个软件安装需要什么特殊的设置什么的。
* 一般软件包里会有一个叫configure的脚本文件,完成配置的任务。可以加很多参数,具体的可以运行./configure –help得到帮助的,比如./configure –prefix=xxx是设定软件安装到哪里。设置好参数,运行./configure,会生成makefile文件,这是你后面编译的基础。
* 接下来就要编译了,很简单,因为有makefile文件的存在,只要运行make就可以完成编译的。make是将读入所有由configure脚本程序建 立的制作文件。这些制作文件会告诉make哪些文件需要被编译以及按照怎样的顺序对它们进行编译,因为可能会有上百个源程序文件。当make工作的时候, 会在屏幕上显示出正在执行的每一个命令,以及与这个命令相关的全部参数。这些输出通常都是编译器的调用声明和所有传递给编译器的参数。如果编译器顺利地完 成了工作,就不会出现什么错误信息。大多数编译器的错误信息十分清楚和明确,因此不用担心可能会漏掉一个错误。如果确实看到有一错误,也不用慌张。大多数 错误信息并不反映出程序本身出现了一个问题,通常都是系统这里或者那里的问题。典型情况下,这些信息大多是因为文件访问权限不正确而产生的或者是因为文件 没有找到。
* 完成编译,之后就是安装软件了。这就更简单了,make install就好了,这个命令将启动安装脚本程序。因为make命令会在执行每一个命令的时候把它显示出来,所以将会看到许许多多的文字掠过眼前。如果没有看到什么错误信息,就说明这个软件包安装好了。
* 反安装就是make uninstall了