实用技巧 Ubuntu Linux 8.04设置与优化

来源:岁月联盟 编辑:zhuzhu 时间:2008-05-07
实用技巧 Ubuntu Linux 8.04设置与优化内容简介: 1. 换内核 系统默认的 kernel 2.6.24-16-generic,这个内核是通用内核没针对特定用户做过优化,而我的台式机还有一个更好的内核可以选,2.6.24-16-rt(realtime)这个内核的特点是任务抢占式,能大大加快 程序  1. 换内核

  系统默认的 kernel 2.6.24-16-generic,这个内核是通用内核没针对特定用户做过优化,而我的台式机还有一个更好的内核可以选,2.6.24-16-rt(realtime)这个内核的特点是任务抢占式,能大大加快 程序之间的启动时间跟切换时间。安装方法:

  sudo apt-get install linux-rt

  2. 关闭IPv6

  方法:

  编辑 /etc/modprobe.d/aliases

  修改

  alias net-pf-10 ipv6

  为

  alias net-pf-10 off

  然后注释掉 /etc/hosts文件中所有与IPV6有关的内容

  # The following lines are desirable for IPv6 capable hosts

  ::1 ip6-localhost ip6-loopback

  #fe00::0 ip6-localnet

  #ff00::0 ip6-mcastprefix

  #ff02::1 ip6-allnodes

  #ff02::2 ip6-allrouters

  #ff02::3 ip6-allhosts

  这将会禁止所有使用IPV6的网络接口。

  再新建一个/etc/modprobe.d/bad_list文件,内容为:

  alias net-pf-10 off

  3. 优化apt 源

  $cd /etc/apt

  $sudo su

  #mv sources.list sources.list-bak

  #sed -e ‘/^#/d’ -e ’s/deb-src/#deb-src/’ sources.list-bak > sources.list

  上面命令的结果是备份sources.list 为 sources.list-bak,同时去掉了sources.list 中的注释语句,再注释掉 deb-src目录。

  太多的注释语句看得我眼花缭乱,并且我也不需要软件的源码。

  4. 优化会话启动项

  菜单系统--首选项--会话,去掉你不需要的服务。

 5.程序启动优化

  使启动程序并行,加速启动过程。

  编辑 /etc/init.d/rc

  修改

  CONCURRENCY=none

  为:

  CONCURRENCY=shell

  小心别写错,错了就无法启动系统了。

  6.增加DNS cache

  dns cache dnsmasq 也是个不错的选择,但pdnsd 更小巧些,单机用这个就够了,而且也不是所有人都需要自己做cache的,我这里杭州网通的dns 服务器实在太慢了,才自己做cache 加快dns 解析速度的。

  sudo apt-get instll pdnsd 安装pdnsd

  编辑 /etc/pdnsd.conf 在 global 段下方加入

  server {ip="x.x.x.x"; /* 此处填你的第一个dns 服务器的 IP */

  timeout=30;

  interval=900;

  uptest=none;

  ping_timeout=500;

  purge_cache=off;

  caching=on;

  }server {

  ip="x.x.x.x"; /* 此处填你的第二个dns 服务器的 IP*/

  timeout=30;

  interval=900;

  uptest=none;

  ping_timeout=500;

  purge_cache=off;

  caching=on;

  }编辑/etc/resolv.conf文件

  改第一行内容为 “nameserver 127.0.0.1”

  7.安装RAR压缩/解压缩程序

  sudo apt-get install rar unrar

  做个软链接

  sudo ln -fs /usr/bin/rar /usr/bin/unrar

  这样,以后只要在命令行输入unrar,就可以解压或者压缩文件了,安装完成后,归档管理器也同时集成了rar组件。

  8.清理系统垃圾

  sudo apt-get autoclean清理旧版本的软件缓存

  sudo apt-get clean清理所有软件缓存

  sudo apt-get autoremove删除系统不再使用的孤立软件