- 浏览: 849109 次
- 性别:
- 来自: lanzhou
文章分类
最新评论
-
liu346435400:
楼主讲了实话啊,中国程序员的现状,也是只见中国程序员拼死拼活的 ...
中国的程序员为什么这么辛苦 -
qw8226718:
国内ASP.NET下功能比较完善,优化比较好的Spacebui ...
国内外开源sns源码大全 -
dotjar:
敢问兰州的大哥,Prism 现在在12.04LTS上可用么?我 ...
最佳 Ubuntu 下 WebQQ 聊天体验 -
coralsea:
兄弟,卫星通信不是这么简单的,单向接收卫星广播信号不需要太大的 ...
Google 上网 -
txin0814:
我成功安装chrome frame后 在IE地址栏前加上cf: ...
IE中使用Google Chrome Frame运行HTML 5
Old hardware? Want a faster boot up? Need to free some system resources? Want snappier applications? This is for you. Note, I wouldn’t suggest doing anything within this if it doesn’t make sense to you.
Boot Process
1. Remove Network Manager if you do not need it “sudo apt-get remove network-manager”. If possible give yourself a static IP in /etc/network/interfaces like so:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.150
netmask 255.255.255.0
network 192.168.1.100
broadcast 192.168.0.255
gateway 192.168.1.1
Having a static IP helps with boot time as your machine doesn’t have to communicate with the router/dhcp server as much to obtain an address.
2. Also remove firestarter or whatever graphical firewall frontend you’re using. Learn to control iptables at boot up and shutdown . It’ll be much snappier. Some have been critical of this step, but firestarter is used quite frequently in ubuntu and it runs an additional startup process before the desktop environment is loaded. Doing straight iptables is much faster, plus you’ll learn something anyways.
3 . Install bum, “sudo apt-get install bum” and run it with root access. Shut off all unnecessary services. If you’re not sure about a service research it before shutting it off. Also, install sysv-rc-conf. Run the application as root. This will allow you to control, in an easy way, what services start at which run level. It’s like bum, but more detailed. Be very careful with which services you are removing from which run-level. If you don’t know what you’re doing here, research it or don’t touch it. After you do this you may want to reboot to make sure you didn’t break anything.
4. Turn off usplash in grub. (Mind you, you’re bootup won’t be as pretty as the splash will go away).
- vim /boot/grub/menu.lst
- on the kernel line delete the words “splash” and “quiet”
- Reboot to see the changes.
I remove “quiet” simply to show what’s going on. It does not have to be removed.
5. If you have a dual core processor, you can decrease your boot time with concurrency.
-
sudo vim /etc/init.d/rc
-
and find the line CONCURRENCY=none
and change it to:
CONCURRENCY=shell
- Reboot to see the changes. (tired of rebooting yet?)
- automounting encrypted drives done with dm-crypt/luks will not work with concurrency.
6 . Remove some TTYs
I could easily do this by editing /etc/inittab and then commenting the extra TTYs there. With the new upstart mechanism in place, things are a little different.
You have to edit /etc/default/console-setup file. This file defines how many ttys should you get.
Change ACTIVE_CONSOLES=”/dev/tty[1-6]” to the number of consoles you want. Lets say, 3 ttys, then change it to “/dev/tty[1-3]“.
And then goto /etc/event.d/ and change the ttyx files that you DONOT want. Edit them and comment lines starting with “start on runlevel”. So, in this case, you’ll comment the start line in tty4..tty6 files.
Rebooting shoud minimize the number of consoles for you. Worked for me!! Good luck, NOTE: Even though you’ve reduced the tty number, X is still on Alt-F7. Again, go ahead and reboot to make sure you didn’t break anything.
Tune Your Hard drive
Speed up your ext3 file system
The
following tweaks assume that you are using an ext3 filesystem for your
Ubuntu OS and they will offer a noticeable performance boost! However,
there is also a bad side of them… if you don’t have an UPS and your system will power off accidentally or because of a power loss,
YOU WILL LOSE IMPORTANT DATA! (don’t say you haven’t been warned)
Open a terminal (Applications -> Accessories -> Terminal
) and type:
sudo vim /etc/fstab
WARNING:
The following is just an example! Do NOT copy the lines into your /etc/fstab file! Just REPLACE the options marked with underline
with the ones marked with bold
!
From this:
# /dev/sda1
UUID=19f70288-7340-40c0-82d1-ee4b218fee1d / ext3 relatime,errors=remount-ro
0 1
To this:
# /dev/sda1
UUID=19f70288-7340-40c0-82d1-ee4b218fee1d / ext3 noatime,nodiratime,errors=remount-ro,data=writeback
0 1
Save and close. Now type the following command in the terminal:
sudo vim /boot/grub/menu.lst
And add the following option…
rootflags=data=writeback
…to the end of the following lines:
# defoptions=quiet splash vga=795 (by default, Ubuntu doesn’t have the “vga=795? option on this line. It appears if you did the second tweak from the first step (see above)).
# altoptions=(recovery mode) single
Save and close, and paste the following command in the terminal:
sudo update-grub
Type now the following command in order to manually change your filesystem “on-the-fly” into writeback.
sudo tune2fs -o journal_data_writeback /dev/sdb2
ATTENTION: Please note that /dev/sdb2
is MY root (/) partition. If you have the root (/) partition in another
place (for example /dev/sda1 or /dev/sda2) change it accordingly.
Please look in /etc/fstab
for this!
That’s all, now reboot your system and when you get back, you should feel an increased speed in video, image or audio usage.
Tune your swappiness
If you have been running Linux systems for some time and you have used applications like ‘top’ to see what’s going on in your machine, then you’ve probably wondered: Where has all my memory gone? You should know that the largest place it is being used in is the disk cache, as the cached memory is free and it can be replaced anytime if a newly started application needs that memory. Linux systems are made like this to use so much memory for disk cache because the RAM is wasted if it is not used and if something needs the same data again, then there is a very good chance to be in the cache memory.
Open a terminal (Applications -> Accessories -> Terminal ) and paste the following code:
sudo vim /etc/sysctl.conf
Now add the following line at the end of this file:
vm.swappiness=10
The number at the end of this line can be between 0 and 100. At 100 the
Linux kernel will prefer to find inactive pages and swap them out,
while value 0 gives something close to the old behavior where
applications that wanted memory could shrink the cache to a tiny
fraction of RAM. Save, close and reboot.
Preload and Prelink
prelink
Any executable that makes heavy use of shared libraries can benefit from prelinking. Prelinking resolves addresses of shared libraries in advance this reduces number of relocations.
Prelink is also useful in the context of security since we can tell prelink to make libraries load at random addresses until next run of prelink. This is useful since libraries won’t load at fixed addresses on every system.
You can install prelink by issuing following command.
sudo apt-get -y install prelink
Change a line inside the configuration file /etc/default/prelink from
PRELINKING=unknown
to
PRELINKING=yes
We will do our first prelinking by executing following command
sudo /etc/cron.daily/prelink
Thats it you don’t have to do anything else. Prelink daemon will run periodically to optimize your newly installed executables.
preload
Preload is a little application that monitors files of frequently used applications and and loads them in to the memory when system is idle. This usually results in lesser startup times for those applications. Install preload by executing following command.
sudo apt-get -y install preload
New Applications
Ok time to install a faster window manager and set of applications:
Add this repo in /etc/apt/sources.list:
#openbox https://launchpad.net/~k-belding/+archive
deb http://ppa.launchpad.net/k-belding/ubuntu
hardy main
deb-src http://ppa.launchpad.net/k-belding/ubuntu
hardy main
and then:
sudo aptitude update && sudo aptitude install openbox pypanel gmrun obmenu obconf nitrogen gtk-chtheme sakura scrot kazehakase sylpheed rtorrent irssi finch decibel-audio-player xfburn mirage abiword gnumeric leafpad epdfview xarchiver pcmanfm ivman
For an explination of each:
- openbox is an alternative window manager that we’ll be using as our desktop environment. It’s snappier than Fluxbox since it was rewritten to no longer be based off blackbox code.
- pypanel – since open box comes with no panel, this is an extremely light weight one, it can be configured in ~/.pypanelrc. You’ll need to add this to .config/openbox/autostart.sh with the line: pypanel &
- gmrun – will give you a small run dialog upon running
- obmenu – graphical openbox menu editting app
- obconf – graphical openbox theme changer, among other options
- nitrogen – lightweight application to change wallpapers
- gtk-chtheme – will allow you to change gtk themes. Icon themes and fonts can be specified in .gtkrc-2.0
- sakura – a light weight tabbed terminal. Easier to configure than aterm, xterm and the like.
- scrot – a command line screenshot tool
- kazehakase – a lightweight browser based on the gecko engine (A heads up about the hardy package: you can’t view the preference menu, it’ll crash. You can control most things through it’s config files and about:config)
- sylpheed – a light weight email application
- rtorrent – a command line torrent app
- irssi – command line irc
- finch – the command line version of finch
- decibel-audio-player – a light weight gtk based audio app
- xfburn – a burning application from the xfce suite
- mirage – an extremely light weight image viewer
- abiword and gnumeric – lighter office apps when compared to open office.
- leafpad – extremely lightweight notepad app
- epdfview – lightweight pdf viewer
- xarchiver – lightweight archiving and compression tool to replace file-roller with.
- pcmanfm – tabbed, lightweight file manager.
- ivman – a behind the scenes auto-mounter. You’ll need to add this to .config/openbox/autostart.sh with the line: ivman &
Here are some great reads on how to configure openbox:
- http://icculus.org/openbox/index.php/Main_Page
- http://wiki.archlinux.org/index.php/Openbox
- http://gentoo-wiki.com/HOWTO_Openbox
And that’s it. Log into openbox and get to configuring things the way you want it.
Use Readahead
This guide asks you to use the command-line to issue some commands, and uses the readahead-list and readahead-watch applications to profile a bootup. Changes to the system are easily reversible and the worst negative impact would be a reduction in login speed (the irony!). Of course, since you will be doing some things with root access, failure to correctly type in some commands may lead to permanent damage to your software or data. These changes are unsupported by Ubuntu developers. You probably shouldn’t try this unless you have more than 512MB RAM.
PART 1: Profile Login Sequence
First, we need to ask readahead to monitor a login sequence and make note of all the files read during this period. Advanced users may point out that during bootup, there is a GRUB argument “profile” that causes Ubuntu to optimize bootup. We will need to essentially manually replicate what this boot option does, but save the output to a different file.
First, let’s store our readahead list into a ~/.readahead directory.
mkdir ~/.readahead
Now, log out, and press CTRL+ALT+F1 to log into a terminal. Start the profiler:
sudo readahead-watch -o ~/.readahead/gnome.root /
This will grind the disk for a while (up to a few minutes) then it will return you to a command prompt. The profiler is now in the background watching all actions. Now, without logging out, go to your GDM prompt (ALT+F8 ) and log in normally.
after you are fully logged in, press CTRL+ALT+F1 to go back to your terminal, then run:
sudo killall readahead-watchsudo chown jdong:jdong ~/.readahead -R
Replace jdong:jdong with your user and group name. Now, we need to go prune this list a bit. Especially if you have large files on your desktop (like a 1GB AVI), the login sequence may touch it, causing readahead to think it should load the whole thing into memory! In a terminal, run:
cat ~/.readahead/gnome.root | xargs -i ls -lk {} | sort -rn -k +5 | less
This will display all the files readahead wants to cache, sorted by largest file first. The 5th column (before date) is the size of the file in KB. Make sure there’s nothing glaringly large. If it’s bigger than 10,000KB or so, it’s probably not worth preloading. You can remove unwanted files from the preload list by opening ~/.readahead/gnome.root in your favorite editor, and deleting its line.
If you have home on a different partition as root, you should repeat Part 1 for each partition, replacing gnome.root with a different name, and replacing the mountpoint / with each interested mountpoint.
PART 2: Hooking this into the login sequence.
Next, we need to tell Ubuntu to do this readahead on every login. I am going to use /etc/X11/Xsession.d for this, but if you have another preferred way to execute things before everything loads, be my guest!
Create a file called /etc/X11/Xsession.d/00readahead and put this in it:
for list in ~/.readahead/*; do readahead-list $list &done wait
Save the file. Now, you can reboot to try it out. You will notice the login
“hang” at the orange screen while the disk works without much grinding,
then once that is done the bootup should soar as if it were a fully
cached login. This brings my login session to around 30 seconds, a
notable improvement.
PART 3: Hook into bootup sequence
Often times, we don’t log in immediately when the prompt comes up. We might be getting a cup of coffee, or an entire lab might be turned on before students arrive. It makes sense to cache a login as a part of bootup. Open up /etc/rc.local in your favorite text editor, and before the exit 0 statement, add:
for list in /home/jdong/.readahead/*; do readahead-list $listdone
Note you need to hard-code a particular user in there, and this time we don’t background it. (We could, but there is not much motivation to)
Now, reboot, and wait for all disk activity to stop before logging in. This
time, I get a login speed of 19 seconds.
You might have two common questions at this point:
1. How much time does it take to call readahead again on files that have been cached once already? About 0.05 seconds to call readahead on the same list a second time
2. How much overhead does it add to bootup if the background readahead was still going, and you tried to log in? About 2 seconds on my setup
Conclusion
In my case, applying this readahead hack lead to a 10-second improvement in login speed in the worst-case scenario, and a remarkable doubling in login speed when the system idles at the login prompt for a few seconds.
This is a pretty appreciable improvement and it would be nice if a nicer version of this hack can be added to Ubuntu. The basic idea should be fairly simple to adapt to an /etc/readahead/readahead.gnome file representative of the default system and hooked by an Xsession.d script.
Many more applications come to mind as taking a long time to load while the disk grinds (Firefox? Openoffice? Eclipse?). You can use a procedure very similar to this to write a “wrapper script” that first performs a readahead-list call on a list, then call the application with the original arguments. I’d be interested to hear of any improvements gained by that method.
Undoing readahead
Remove, remove, remove! Delete the ~/.readahead directory, delete /etc/X11/Xsession.d/00readahead, and delete the line you added to /etc/rc.local
All Done
Your system should be a 100 times more snappier.
发表评论
-
Ubuntu 10.04 新视觉设计、主题和Logo
2010-03-04 18:46 961根据官方wiki (屏幕截图)的介绍,Ubuntu ... -
Ubuntu自动备份软件包和制作本地源
2010-01-27 11:47 2517执行过sudo apt-get update &&am ... -
10 scripts to create your own Linux distribution
2010-01-25 15:20 1027Those familiar with Linux will ... -
Ubuntu下rhythmbox播放MP3乱码问题的解决
2010-01-19 18:03 2409在Ubuntu下,系统是使用的UTF-8字符集。而rhyt ... -
解决ubuntu 鼠标键盘的失效问题
2010-01-11 10:09 11068把主板的apic 禁用掉就可以了,如果你是多系统的话,这样可能 ... -
Windows 7 or Ubuntu 9.10 – battle of the operating systems
2009-11-06 08:08 994Operating systems have become l ... -
Hey Ubuntu, Stop Making Linux Look Bad
2009-11-06 08:07 878It’s the same old story. A new ... -
Ubuntu.com Suffers Intermittent Outages As Thousands Download Karmic Koala
2009-11-04 08:40 776(WEB HOST INDUSTRY REVIEW) -- T ... -
Xubuntu 9.10 Review and Commentary
2009-11-04 08:38 941With the recent release of Ub ... -
Ubuntu 9.10 - Almost Perfect
2009-11-03 09:48 721It’s been quite some time sin ... -
5 things make Kubuntu 9.10 special
2009-11-03 08:50 860Kubutnu is the first distributi ... -
CentOS 5.4 vs. OpenSuSE 11.2 vs. Ubuntu 9.10 Benchmarks
2009-11-03 08:49 2943With the release of CentOS 5.4 ... -
many things to do after install ubuntu 9.10
2009-11-02 14:46 5581So you've just installed Ubuntu ... -
How to install Nvidia/ATI graphic cards drivers in Ubuntu 9.04
2009-11-01 23:49 1638Many a times users mess up thei ... -
How to install Ubuntu 9.10 without CD/DVD
2009-11-01 23:44 1298Ubuntu 9.10, Karmic Koala is ... -
Things to do after installing Ubuntu9.10 Karmic Koala
2009-11-01 22:44 1983Here are things i see are impor ... -
Ubuntu下安装MP3播放器Audacious
2009-11-01 08:02 2510在Ubuntu下安装软件就是简单方便,MP3你想不想听,那我们 ... -
The new Ubuntu Software Center
2009-10-31 08:25 1078You may remember my mention of ... -
Ubuntu 9.10 'Karmic Koala' released, could decide your OS fate
2009-10-30 09:51 687It's October 2009 which means s ... -
Ubuntu 9.10 brings web sync, faster bootup, GNOME 2.28
2009-10-30 09:49 899The Ubuntu Linux distribution h ...
相关推荐
How to Make Sense of Any Mess: Information Architecture for Everybody Abby Covert Everything is getting more complex. It is easy to be overwhelmed by the amount of information we encounter each ...
How To Break Into The ‘How To Make Money Online’ Niche By Sara Brown
How to Make Your Own Keylogger in C++ Programming Language 英文mobi 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
How to Make Your Home a Smart Home 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系...
Web Hacking 101: How to Make Money Hacking Ethically By 作者: Peter Yaworski Pub Date: 2018 ISBN: n/a Pages: 255 Language: English Format: PDF Size: 10 Mb With a Foreword written by HackerOne Co-...
How-to-Make-a-Computer-Operating-System, 在 C 中,如何制作计算机操作系统 如何使计算机操作系统关于如何从头开始编写 C/C 操作系统的在线书籍。注意 : 这个存储库是我旧课程的一个。 我的第一个项目是我在高中时...
讲解了怎么做一个成功的英语口语的presentation. 1.the purpose of presentation 2.the elements of an effective presentation 3.The effective delivery of information 4.......
从历史上来看,很多OpenStack的传道者都是由rockspace驱动的,OpenStack是开放的,我们可以共同合作、共同开发开源的软件,它会是未来社区的主导。谈到关于开源以及社区,我们会想到这样一幅图,这对于召集人们加入...
文档标题 "How to make a robot" 指明了内容的主旨,即介绍如何从零开始构建一个机器人。该文档可能详细描述了从选购材料到组装、编程以及测试机器人的整个过程。 2. 知识产权声明与免责声明: 在描述和部分内容中...
本文是有关如何从头开始编写,测试和运行C ++和Assembly的非常简单的操作系统的指南。
《如何在Ubuntu上做任何事情》是 Jeffrey T. Orloff撰写的一本指南,专注于Ubuntu Linux操作系统,这本书旨在帮助用户充分利用这个流行的开源系统。Ubuntu Linux是一款基于Debian的免费操作系统,以其用户友好性和...
HOWTO-html<br>News-HOWTO-html<br>News-Leafsite-html<br>Oracle-HOWTO-html<br>Plug-and-Play-HOWTO-html<br>PPP-HOWTO-html<br>Printing-HOWTO-html<br>QT 3.3 中文白皮书.pdf Quota RCS-...
25 App Monetisation Methods - How to Make Money From Your App
Interesting, entertaining, and challenging exercises encourage students to make a difference and use computers and the Internet to work on problems. To keep readers up-to-date with leading-edge ...
### 如何使用Ubuntu Desktop Live CD测试新电脑 #### 背景与意义 在选购新电脑时,确保其硬件能够满足个人需求是非常重要的一步。尤其是对于计划安装Linux系统的用户而言,提前验证硬件与Linux的兼容性显得尤为...
"How To Listen"是一款专为提升用户听力敏感度和音质辨识能力设计的训练软件,尤其适用于音乐制作人、音频工程师以及任何对声音有高要求的人群。这个名为"How To Listen (Public) 2.0.4 Setup.zip"的压缩包包含了该...
幼儿园大班英语教案《How to make tea》润新教育.txt
大班英语教学教案《how to make tea》润新教育.txt
标题“如何使用Ubuntu桌面LiveCD测试新电脑”指的是在不安装操作系统的情况下,通过Ubuntu桌面LiveCD(或USB)来预览和评估新电脑的硬件兼容性及操作系统的性能。这个过程对于那些想要尝试Linux系统或者在购买新电脑...