so true

心怀未来,开创未来!
随笔 - 160, 文章 - 0, 评论 - 40, 引用 - 0
数据加载中……

Ubuntu安装点滴

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); $ cat .vmware/config
xkeymap.nokeycodeMap=true

mirror.rootguide.org更新服务器(上海市 电信):
deb http://mirror.rootguide.org/ubuntu/ jaunty main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ jaunty main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ jaunty-updates main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu/ jaunty-backports main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ jaunty-backports main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu/ jaunty-security main restricted universe multiverse
deb-src http://mirror.rootguide.org/ubuntu/ jaunty-security main restricted universe multiverse
deb http://mirror.rootguide.org/ubuntu/ jaunty-proposed main multiverse restricted universe
deb-src http://mirror.rootguide.org/ubuntu/ jaunty-proposed main restricted universe multiverse

语言包:
系统-》系统管理-》语言支持-》添加中文
sudo apt-get install scim scim-chinese
sudo apt-get install gnome-do  注意配置成docky类型,这样就可以达到类似于苹果的那种效果了。
sudo apt-get install vim-full

sudo apt-cache search sun
sudo apt-get install sun-java6-jdk
sudo apt-get install sun-java6-source

sudo apt-get -y install stardict stardict-common stardict-gnome stardict-plugin

dpkg -l 可以查看安装了哪些包;
dpkg -L vim 可以查看vim这个包都安装了哪些东西

关于locale的设定:
http://blog.chinaunix.net/u/7334/showart_353129.html

/////////////////////////////////////////////////////////////////////////

安装中文支持:
1、安装中文字体

界面操作:系统--》管理--》language support
采用命令:sudo apt-get install language-pack-gnome-zh language-pack-gnome-zh-base language-pack-zh language-pack-zh-base language-support-zh

2、将中文字体设置为系统默认字体

网上看了一下,说是将以下几句加到/etc/profile文件中:
LC_ALL=zh_CN.GBK
LC_CTYPE=zh_CN.GBK
LANG=zh_CN.GBK

但是我在通过命令:source /etc/profile使其生效时,报如下错误:
-bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.GBK): No such file or directory
表示字体zh_CN.GBK未找到,后面在网上找了一下,可以通过命令:locale -a,会列出如下内容(不同的机器会有不同):
C
POSIX
en_AG
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_NG
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8
zh_CN.utf8
zh_HK.utf8
zh_SG.utf8
zh_TW.utf8

这个时候将上面字体设置更改为:
LC_ALL=zh_CN.utf8
LC_CTYPE=zh_CN.utf8
LANG=zh_CN.utf8
再重新使设置生效即可

3、使设置生效

通过source命令使其生效:source /etc/profile
sudo gedit /var/lib/locales/supported.d/local 

在文件中添加 
zh_CN.GBK GBK 
zh_CN.GB2312 GB2312 

执行 
sudo dpkg-reconfigure –force locales 

然后在输出的结果中会出现 
zh_CN.GB2312 done 
zh_CN.GBK done
/////////////////////////////////////////////////////////////////////////

字体:
cp字体文件到~/.fonts或者/user/share/fonts下,sudo fc-cache -fv, 在需要的地方选择新添加的字体即可。
删除字体也很容易,只要把字体文件删除掉,然后sudo fc-cache -fv即可。

使用Windows键:
点击“系统”-“首选项”-“键盘”,当窗口出现以后切换到到“布局”标签。点击“布局选项”按钮会出现一个对话框,在对话框里面点击“Alt/Win键行为”旁边的小箭头,勾选“Super键映射到Windows键”,关闭所有窗口。

    现在就可以使用Windows键组合其它键定义自己的快捷方式了。

    譬如现在可以和Windows一样定义Win+E来打开Nautilus,打开gconf-editor,找到“/apps/metacity /keybinding_commands”,双击command_1项,在Value输入框里面输入“nautilus computer://”。然后继续在gconf-editor里面,找到“/apps/metaciy/global_keybindings”,双击 “run_command_1”项,在出现的对话框里面输入“<Super>e”。关闭gconf-editor,按下Win+E,一个 Nautilus就会立刻弹出。

    gconf-editor可以定义12个这样的快捷方式,都可以在“/apps/metacity/keybinding_commands”和“/apps/metaciy/global_keybindings”里面定义。

    尽管如此,还是有一些Win组合键无法使用。原因不明,但是如果再加上Ctrl或者Alt等组合使用就可以工作了。

    另外组合键还可以使用“上下左右”等方向键,譬如可以使用Windows+Cursor Left,也可以使用<Home>、<End>、 <Insert>、 <Delete> 和<Pause>,另外Page UP、Page Down和Scroll Lock必须写成Page_UP、Page_Down和Scroll_Lock。


说明:<Mod4>是win左键做组合键

VMWare有一个问题,guest os 的声卡和Master os的声卡会冲突。比如说当master os在听歌的时候,如果guest os需要发出声音,VMWare就会报一个错误:

failed to open sound device /dev/dsp:
device or resource busy

解决的方法是使用oss。
参考ubuntu的做法:

  1. su
  2. 输入root密码
  3. aptitude install alsa-oss
  4. chmod +s /usr/lib/libaoss.so.*
  5. cd /usr/lib/vmware/bin/
  6. mv vmware-vmx vmware-vmx.real
  7. echo '#!/bin/bash' > vmware-vmx
  8. echo 'LD_PRELOAD=libaoss.so exec
     /usr/lib/vmware/bin/vmware-vmx.real "$@"' >> vmware-vmx
  9. chmod +x vmware-vmx

就可以解决这个问题了。

开发环境搭建:
sudo apt-get install build-essential binutils-doc cpp-doc gcc-doc glibc-doc libstdc++6-4.3-doc stl-manual manpages manpages-dev manpages-posix manpages-posix-dev
测试一下:
c:
man strncasecmp
c++:
man std::string
posix:
man stdlib.h


sudo apt-get install nautilus-gksu nautilus-open-terminal nautilus-image-converter nautilus-wallpaper
http://g-scripts.sourceforge.net/

安装wine,ie,阿里旺旺
sudo apt-get install wine cabextract
wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz

在使用vi打开文件前忘记加sudo了,依然能够保存的方法: w !sudo tee %

Ubuntu中使用framebuffer的方法:

打开/etc/initramfs-tools/modules文件,在末尾加上:

fbcon
vesafb

打开/etc/modprobe.d/blacklist-framebuffer,找到“blacklist vesafb”一行,在这一行前面加上“#”把它注释掉。

打开/boot/grub/menu.lst,找到相应的kernel一行,加上vga参数。例如我把分辨率设置为1024x768,对应的vga数值就是0x317。

kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=3c51a0d7-d373-473b-830e-225b6d7aafdf ro quiet splash vga=0x317

最后执行:sudo update-initramfs -u更新,重启一下。如果你禁用了图形界面登陆,应该就能看到漂亮一些的字符界面了;如果没有禁用,可以在桌面环境中按Ctrl+Alt+F1 ~ F6看看效果,按Ctrl+Alt+F7返回桌面环境。


firefox安装vimperator后,配置文件:
" 解决全选、复制、粘帖、剪切和撤销与vimperator冲突的问题,在/home/yourname/.vimperatorrc
noremap <C-V> <C-v>
noremap <C-Z> <C-z>
noremap <C-c> <C-v><C-c>
noremap <C-a> <C-v><C-a>
cnoremap <C-c> <C-v><C-c>
cnoremap <C-v> <C-v><C-v>
cnoremap <C-x> <C-v><C-x>
inoremap <C-a> <C-v><C-a>
inoremap <C-c> <C-v><C-c>
inoremap <C-v> <C-v><C-v>
inoremap <C-x> <C-v><C-x>
inoremap <C-z> <C-v><C-z>
inoremap <C-y> <C-v><C-y>
" 还原我的书签栏和下载对话框快捷键
noremap <C-b> <C-v><C-b>
noremap <C-y> <C-v><C-y>
" 还原 ctrl-k 跳到搜索栏的快捷键
noremap <C-k> <C-v><A-d><Tab>
set editor=gvim" -f
set go=mTB
在vimperator中随意切换tab的方法有以下几种:
g0:切换到第一个tab
g$:切换到最后一个tab
Ngt/NCtrl+^:切换到第N个tab
Ctrl+^:在上一次浏览过的tab之间作switch
gt/T:切换到下/上一个tab
Ctrl+n/p:切换到下/上一个tab
:b N:切换到第N个tab
:B:列出所有的tab

允许root用户登录的方法:修改/etc/gdm/gdm.conf中AllowRoot=true即可

安装conky:
需要附加软件devilspie的支持,因此先用apt-get安装它们,然后
配置~/.conkyrc为:
# vim: syntax=conkyrc
# set to yes if you want Conky to be forked in the background
background no

cpu_avg_samples 2
net_avg_samples 2

out_to_console no

# X font when Xft is disabled, you can pick one with program xfontsel
#font 7x12
#font 6x10
#font 7x13
#font 8x13
#font 7x12
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
#font -misc-simsun-medium-r-normal-*-12-*-*-*-c-*-gb18030.2000-0

# Use Xft?
use_xft yes

# Xft font when Xft is enabled
xftfont monospace:pixelsize=10
#xftfont

own_window_transparent yes
own_window_colour brown
# Text alpha when using Xft
xftalpha 1

on_bottom yes

# mail spool
mail_spool $MAIL

# Update interval in seconds
update_interval 1
# Create own window instead of using desktop (required in nautilus)
own_window yes
#own_window_type desktop
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
#minimum_size 280 5
maximum_width 320

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

override_utf8_locale

# Stippled borders?
stippled_borders 10

# border margins
border_margin 4

# border width
border_width 1

# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color white

# Text alignment, other possible values are commented
#alignment top_left
#minimum_size 10 10
#gap_x 1259
#gap_y 36
alignment top_right
#alignment top_left
#alignment bottom_right

# Gap between borders of screen and text

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer no

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# boinc (seti) dir
# seti_dir /opt/seti

# Possible variables to be used:
#
#      Variable         Arguments                  Description                
#  acpiacadapter                     ACPI ac adapter state.                   
#  acpifan                           ACPI fan state                           
#  acpitemp                          ACPI temperature.                        
#  adt746xcpu                        CPU temperature from therm_adt746x       
#  adt746xfan                        Fan speed from therm_adt746x             
#  battery           (num)           Remaining capasity in ACPI or APM        
#                                    battery. ACPI battery number can be      
#                                    given as argument (default is BAT0).     
#  buffers                           Amount of memory buffered                
#  cached                            Amount of memory cached                  
#  color             (color)         Change drawing color to color            
#  cpu                               CPU usage in percents                    
#  cpubar            (height)        Bar that shows CPU usage, height is      
#                                    bar's height in pixels                   
#  downspeed         net             Download speed in kilobytes              
#  downspeedf        net             Download speed in kilobytes with one     
#                                    decimal                                  
#  exec              shell command   Executes a shell command and displays    
#                                    the output in torsmo. warning: this      
#                                    takes a lot more resources than other    
#                                    variables. I'd recommend coding wanted   
#                                    behaviour in C and posting a patch :-).  
#  execi             interval, shell Same as exec but with specific interval.
#                    command         Interval can't be less than              
#                                    update_interval in configuration.        
#  fs_bar            (height), (fs)  Bar that shows how much space is used on
#                                    a file system. height is the height in   
#                                    pixels. fs is any file on that file      
#                                    system.                                  
#  fs_free           (fs)            Free space on a file system available    
#                                    for users.                               
#  fs_free_perc      (fs)            Free percentage of space on a file       
#                                    system available for users.              
#  fs_size           (fs)            File system size                         
#  fs_used           (fs)            File system used space                   
#  hr                (height)        Horizontal line, height is the height in
#                                    pixels                                   
#  i2c               (dev), type, n  I2C sensor from sysfs (Linux 2.6). dev   
#                                    may be omitted if you have only one I2C  
#                                    device. type is either in (or vol)       
#                                    meaning voltage, fan meaning fan or temp
#                                    meaning temperature. n is number of the  
#                                    sensor. See /sys/bus/i2c/devices/ on     
#                                    your local computer.                     
#  kernel                            Kernel version                           
#  loadavg           (1), (2), (3)   System load average, 1 is for past 1     
#                                    minute, 2 for past 5 minutes and 3 for   
#                                    past 15 minutes.                         
#  machine                           Machine, i686 for example                
#  mails                             Mail count in mail spool. You can use    
#                                    program like fetchmail to get mails from
#                                    some server using your favourite         
#                                    protocol. See also new_mails.            
#  mem                               Amount of memory in use                  
#  membar            (height)        Bar that shows amount of memory in use   
#  memmax                            Total amount of memory                   
#  memperc                           Percentage of memory in use              
#  new_mails                         Unread mail count in mail spool.         
#  nodename                          Hostname                                 
#  outlinecolor      (color)         Change outline color                     
#  pre_exec          shell command   Executes a shell command one time before
#                                    torsmo displays anything and puts output
#                                    as text.                                 
#  processes                         Total processes (sleeping and running)   
#  running_processes                 Running processes (not sleeping),        
#                                    requires Linux 2.6                       
#  shadecolor        (color)         Change shading color                     
#  stippled_hr       (space),        Stippled (dashed) horizontal line        
#                    (height)        
#  swapbar           (height)        Bar that shows amount of swap in use     
#  swap                              Amount of swap in use                    
#  swapmax                           Total amount of swap                     
#  swapperc                          Percentage of swap in use                
#  sysname                           System name, Linux for example           
#  time              (format)        Local time, see man strftime to get more
#                                    information about format                 
#  totaldown         net             Total download, overflows at 4 GB on     
#                                    Linux with 32-bit arch and there doesn't
#                                    seem to be a way to know how many times  
#                                    it has already done that before torsmo   
#                                    has started.                             
#  totalup           net             Total upload, this one too, may overflow
#  updates                           Number of updates (for debugging)        
#  upspeed           net             Upload speed in kilobytes                
#  upspeedf          net             Upload speed in kilobytes with one       
#                                    decimal                                  
#  uptime                            Uptime                                   
#  uptime_short                      Uptime in a shorter format               
#
#  seti_prog                         Seti@home current progress
#  seti_progbar      (height)        Seti@home current progress bar
#  seti_credit                       Seti@hoome total user credit


#variable is given either in format $variable or in ${variable}. Latter
#${color lightgrey}Temperatures:
# CPU:$color ${i2c temp 2}C${color grey} - MB:$color ${i2c temp 1}C
# allows characters right after the variable and must be used in network
# stuff because of an argument
#${font Dungeon:style=Bold:pixelsize=10}I can change the font as well
#${color #ddaa00}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar}
#${font Verdana:size=10}as many times as I choose
#${font Perry:size=10}Including UTF-8,
#${font Luxi Mono:size=10}justo como este texto que o google traduz fêz o português
#${color #ddaa00}${time %a, %d %b}${alignr}${time %k:%M:%S}
# stuff after 'TEXT' will be formatted on screen

# ${color black}${cpugraph 000000 5000a0}
TEXT
${color #ddaa00}${font YaHei Consolas Hybrid:pixelsize=20}${time %Y年 %m月 %d日 星期 %u}${font}
${color #8811ee}${font YaHei Consolas Hybrid:pixelsize=50}${alignr}${time %H:%M}${font}
${color #88aadd}${hr 1}
${color #ddaa00}${font Verdana:size=10}$nodename - $sysname $kernel on $machine
${color #88aadd}${hr 1}
${color #ddaa00}${font Verdana:size=10}Uptime:${goto 85}$color $uptime ${color #ddaa00}${goto 168} Load:$color $loadavg
${color #ddaa00}${font Verdana:size=10}CPU Usage:${goto 85}${color lightgrey} ${cpu}% ${color #5000a0}${cpubar}
${color #ddaa00}${font Verdana:size=10}RAM Usage:${goto 85}$color $mem/$memmax - $memperc% ${color #5000a0}$membar
${color #ddaa00}${font Verdana:size=10}Processes:${goto 85}$color $processes  ${color #ddaa00}${goto 168} Running:$color $running_processes
${color #ddaa00}${font Verdana:size=10}File systems:
${color #ddaa00}/${goto 45}$color${fs_used /}/${fs_size /}${goto 165}${color #5000a0}${fs_bar /}
${color #ddaa00}home${goto 45}$color${fs_used /home}/${fs_size /home}${goto 165}${color #5000a0}${fs_bar /home}
${color #ddaa00}${font Verdana:size=10}Disk I/O:
${color green} Read:${color #8844ee} ${diskio_read} ${color green} ${goto 172}Write:${color #22ccff} ${diskio_write}
${color black}${diskiograph_read 20,150 ff0000 0000ff} $alignr${color black}${diskiograph_write 20,150 0000ff ff0000}
${color #88aadd}${hr 1}
${color #ddaa00}${font Verdana:size=10}Networking:
${color green} Down:${color #8844ee} ${downspeed wlan0} k/s${color green} ${goto 172}Up:${color #22ccff} ${upspeed wlan0} k/s
${color black}${downspeedgraph wlan0 20,150 ff0000 0000ff} $alignr${color black}${upspeedgraph wlan0 20,150 0000ff ff0000}
${color #88aadd}${hr 1}
${color #ddaa00}${font Verdana:size=10}Name${goto 128}${font Verdana:size=10}PID${goto 192}${font Verdana:size=10}CPU%${goto 256}${font Verdana:size=10}MEM%
${color #ddaa00}${font Verdana:size=10}Top CPU Usage
${color white}${top name 1}${goto 128}${top pid 1}${goto 192}${top cpu 1}${goto 256}${top mem 1}
${color #c4c4c4}${top name 2}${goto 128}${top pid 2}${goto 192}${top cpu 2}${goto 256}${top mem 2}
${color #a3a3a3}${top name 3}${goto 128}${top pid 3}${goto 192}${top cpu 3}${goto 256}${top mem 3}
${color #ddaa00}${font Verdana:size=10}Top Mem Usage
${color #e5dde5}${top_mem name 1}${goto 128}${top_mem pid 1}${goto 192}${top_mem cpu 1}${goto 256}${top_mem mem 1}
${color #c4c4c4}${top_mem name 2}${goto 128}${top_mem pid 2}${goto 192}${top_mem cpu 2}${goto 256}${top_mem mem 2}
${color #a3a3a3}${top_mem name 3}${goto 128}${top_mem pid 3}${goto 192}${top_mem cpu 3}${goto 256}${top_mem mem 3}

再配置.devilspie/conky.ds为:
(if
    (is (window_class) "Conky")
    (begin
        (pin)
        (below)
        (wintype "dock")
        (undecorate)
        (skip_pager)
        (skip_tasklist)
    )
)
此外,还需要让conky和devilspie开机即启动,可以通过系统—>首选项—>会话来设置。

下面再给出一个devilspie应用的例子,可以把启动的窗口自动分配到第几个桌面,注意,在ubuntu 9.04以下的版本中,为了让第几个桌面被正常的找到,需要将外观中的特效设置成无的状态。
./devilspie/workspace.ds:
(begin
  (if
        (or
            (matches (window_class) "OpenOffice.org*")
            (matches (application_name) "eclipse")
            (is (application_name) "Document Viewer")
        )
        (begin
            (set_workspace 1)
        )
    )

    (if
        (or
            (is (window_class) "Firefox")
            (is (window_class) "Evolution")
        )
        (begin
            (set_workspace 2)
        )
    )
    
    (if
        (or
            (is (window_class) "Audacious")
            (is (window_class) "Realplay.bin")
            (is (window_class) "Smplayer")
            (is (window_class) "MPlayer")
            (is (window_class) "Totem")
            (is (window_class) "Gmlive")
            (is (window_class) "Linux-fetion")
        )
        (begin
            (set_workspace 3)
        )
    )

    (if
        (or
            (is (window_class) "VirtualBox")
            (is (window_class) "Vmplayer")
        )
        (begin
            (set_workspace 4)
        )
    )

)
仿照上述例子,你也可以写一个属于自己定制的脚本了,这里再告诉你如何获取诸如window-class以及application-name之类的东西:
echo 'debug' > ~/.devilspie/debug.ds,然后在命令行启动devilspie,再打开一个程序,比如QQ,那么你会看到在终端里打印出来了QQ这个程序相关的各种诸如window-class以及name的信息。
xwininfo命令可以查看当前某个窗口程序的几何参数;xlsclients -l可以查看当前有哪些窗口程序在运行。
$ cat .devilspie/conky.ds 
(if
    (is (window_class) "Conky")
    (begin
        (pin)
        (below)
        (wintype "dock")
        (undecorate)
        (skip_pager)
        (skip_tasklist)
    )
)

$ cat .devilspie/Termnial.ds 
/* This is the configuration for Terminal */
(if (is (application_name) "Terminal")
    (begin
        (below)
        (undecorate)
        (skip_pager)
        (skip_tasklist)
        (wintype "utility")
        (geometry "1057x2000+0+0")
    )
)

硬盘安装ubuntu或者其他操作系统:
在grub的menu.lst文件中加入:
title        Ubuntu 9.10
root       (hd1,7)
kernel    /ubuntu9_10/vmlinuz boot=casper iso-scan/filename=/ubuntu9_10/ubuntu-9.10-desktop-i386.iso quiet splash rw
initrd      /ubuntu9_10/initrd.lz
注意grub只能认识fat32以及ext类型的分区,不能识别ntfs,因此上述文件不能放到ntfs分区; vmlinuz和initrd.lz这两个文件是从iso中提取出来的

如果遇到“不能卸载以下挂载点”之类的问题,那么就用下面的命令搞定:
sudo umount -l /isodevice

posted on 2009-04-12 08:12 so true 阅读(2150) 评论(0)  编辑  收藏 所属分类: Linux


只有注册用户登录后才能发表评论。


网站导航: