歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux基礎知識 >> 實用技巧:Ubuntu Linux 8.04設置與優化

實用技巧:Ubuntu Linux 8.04設置與優化

日期:2017/3/2 15:47:31   编辑:Linux基礎知識
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刪除系統不再使用的孤立軟件

Copyright © Linux教程網 All Rights Reserved