Shallow talk about Linux operating system optimize reach safe configuration
Tuesday, March 03, 2009 by rain
Very long had not written an article,Receive many friends to send a letter recently,Alluded to concern optimize configuration with a few new safe issues,Here I think and everybody is easy to read and understand discuss these issues,What forbids to be mixed truly have better kind,Please give me a letter to discuss jointly rise.
The good article that ? ? sees many concerned Linux optimize a respect on the net,Here I also not give uncecessary details these articles,The issue that I consider to talk about this respect from the experience of myself only.
? ? regards a system as the administrator,What say below me is to be based on what the Linux of server application will talk,Because Linux is used on personal computer,perhaps not be to resemble a server going up same,Preferential pursuit safety and stability,The friend that uses because of this personal computer makes a reference only
? ? the system that the article alludes,Without special statement like,The Redhat Linux system that all uses Redhat firm.
? ? about optimizing
? ? speaks of to optimize,The configuration that be optimized best actually even if promotes hardware,The operation capacity that increases Cpu for example,The size that increases memory,If you consider to upgrade,the individual thinks the word of hardware,The proposal is first the size that increases memory,Because of general server application,Put internally using up use requirement is highest.Of course this is the word outside the problem.
We are principal here those who discuss,It is to be below coequal hardware configuration (same table server,Below the condition that does not promote hardware) undertake optimizing to your system.
? ? regards a system as the administrator,I think,Above all we should make clear a viewpoint:Any operations are made on the server,Upgrade and modify any configuration files or software,Must first consideration security,Not be to jump over new thing to had been jumped over,This also is the place that why differs somewhat with Windows on Linux management sense,The newest version software that Windows recommends everybody to use it above all and operating system,Actually my individual thinks this is act of a kind of trade,As will tell from systematic government,This is very bad,Use new software and system to may bring new issue,Some are deadly even.
? ? because of this,As management,The version that we or the software edition that should consider to be used for a long time steadily regard us as originally,I did not say specific benefit more.Those who believe to serve as an administrator you should know.
The Linux that actually the individual uses ? ? is optimized the directest even if upgrade kernel,The system that the kernel that oneself compile is him basis is compiled and come,Will get the greatest performance and the smallest kernel.
? ? but,The server is not quite same,Of course the kernel that we also hope each server is he is compiled by hand,Efficient and exquisite.But mix actually the desire is have difference,Just think,If you manage 100 come stage Linux lead plane,And each perhaps are configured different,A process that compiles a kernel then will be project of a huge,And from actual consideration,Workload is gotten greatly adv unimaginably.I think you also won't be willing to do this kind of business.Because of this,The individual suggests,The kernel that uses the government to release upgrades the bag is very good choice.
? ? above all,We to the system of new setup,Will do a series of upgrading,Include software and kernel,This is very important step,(the detailed circumstance of this respect welcomes another to look carefully at me about upgrading the article of the respect) .
? ? is in had upgraded after all software,After basic firewall and configuration had been done,We begin to optimize a few detail to configure,If you are old system,So a few operations that making this problem reach and before optimizing your system,Be sure to back up place know exactly about sth occupies other medium.
? ? 1, fictitious memory is optimized
The use case that ? ? examines fictitious memory above all,Use command
? ? # Free
The memory that ? ? examines current system uses a case.
Generally speaking,The physical memory of Linux is complete Used almost.This with the distinction with very big Windows,Its memory government mechanism makes full use of systematic memory,Like no matter how old memory wants to use a few fictitious memory,be not Windows.This bit of need notices.
The acquiescent configuration of fictitious memory carries an order below ? ? Linux
? ? # Cat /proc/sys/vm/freepages
? ? can be examined,Three indication numbers are current system:Page of page of blank of the smallest memory, lowermost memory blank and highest memory blank.
? ? notices,The principle that the system uses fictitious memory here is:If blank page amount is installed under highest and blank page,Use disk to exchange a space.When should achieving lowermost blank page to install,Use memory is exchanged (note:This is I examine what a few data must come,Oneself still need to observe when specific applying,Nevertheless this does not affect us to configure new fictitious memory parameter) .
? ? memory allocates with byte of every page 4k commonly.Setting of page of blank of the smallest memory is amount of the memory in the system 2 times;Setting of page of lowermost memory blank is memory amount 4 times;Setting of page of highest memory blank is systematic memory 6 times.These values decide when the system is started.
? ? is told commonly in configuration system distributive fictitious memory is configured on,My individual thinks to increase page of highest memory blank is a kind of better configuration way,With the memory of 1G configuration is exemple:
? ? can construct original configuration scale instead:
? ? 2048 4096 6444
? ? carries an order
? ? # Echo "2048 4096 6444 "%26gt;/ Proc/sys/vm/freepages
Because ? ? increased highest and blank page to configure,Can make memory more effective so use.
? ? 2, hard disk is optimized
? ? if you are Scsi hard disk or Ide array,Can jump over this one,This parameter of section introduction adjusts the server that is aimed at use Ide hard disk only.
? ? we install IDE hard disk through Hdparm program,
? ? use DMA is transmitted with 32 can promote a system property considerably.Use order is as follows:
? ? # /sbin/hdparm -c 1 /dev/hda
? ? this command appoints the PCI bus line of hard disk of the first IDE it is 32,
? ? is used - C 0 parameter will ban transmit with 32.
? ? uses DMA on hard disk,Use command:
? ? # /sbin/hdparm -d 1 /dev/hda
? ? shuts DMA to be able to be used - the parameter of D 0.
? ? is changed after finishing,Can use Hdparm to check the result after revising,Use command:
? ? # /sbin/hdparm -t /dev/had
The kill that ? ? sets to ensure is changeless,Use command:
? ? # /sbin/hdparm -k 1 /dev/hda
Jussive of ? ? Hdparm a few commonly used other parameter functions
? ? - the track of G indication hard disk,Magnetic head,The parameter such as magnetism area.
? ? - the hardware standards information of I indication hard disk,These information are by hard disk itself when switch on the mobile phone place is offerred.
? ? - I reads the hardware standards news that takes hard disk place to offer directly.
? ? - the PIO mode of hard disk of P set.
- Tt evaluates hard disk read those who take efficiency and hard disk fast take efficiency.
? ? - U %26lt;0 or 1%26gt;When hard disk is accessed,Allow other interrupt a requirement to be carried out at the same time.
? ? - the relevant set of V indication hard disk.
? ? 3, other optimize
? ? shuts the service that does not need,About the service that the system starts automatically,There are a lot of data on the net,Here I not give uncecessary details.
? ? about safety
? ? regards a system as the administrator for,It is very important to make comprehensive safe inspection to the system regularly,Encounter incoming letter of a few friends to said to appear recently a few indescribable problems,For example a the biggest question feels network service is lazy apparently namely,This is the phenomenon that is atttacked likely extremely.Practice proves,No matter be the sort of system,Acquiescent installation is insecure,Actual no matter you use Windows it may not be a bad idea,Linux, bsd or other what system,Of acquiescent installation have a lot of flaw,The system that how can just make safety then,This is the thing that our system administrator needs to do.Configuration configures relocate.Any systems,Want attentive configuration only,Stem foregone flaw,Can say this system is safety,Be not a lot of friends to say actually in that way,Installed a system,Configured firewall,Installed the software that reduce toxin,So safe,If do not make any safety to the system,install actually,That is equal to open wide gate of a paper to the hacker,Ten minutes several can be controlled completely!
This is not ? ? appalling.As Linux system,Put in a lot of flaw likewise,The whole system that black likelihood uses these flaw to control you,Should avoid these problems,We need to make the following move:
? ? 1, upgrade the newest version that all software in the system include;
? ? 2, the firewall with relatively strong setting;
? ? 3, regular examination key records a file,Configuration kills poisonous software
? ? 4, much care allots cloth security information admonitory website,The characteristic that masters a few newest virus and hacker program,These benefit at the system run normally.
? ? this article basically is given priority to with optimizing,To cooperate this one theme,We discuss safe part only daily a few defend the work.
? ? besides above it is the extracurricular with mandatory administrator 4 listed,Very important also to the maintenance of detail of system of a few Linux.
? ? includes:
? ? 1, tool of configuration log training in rotation,Log of fixed download backup,It is a first-rate habit,Such not only the waste disk space that can reduce a log,Improve systematic efficiency,Can discover a problem in time more,The analyzer of a little very good systematic daily record below Linux,The special project in log of can direct extraction,Leave out the trouble that reads a log;
? ? 2, I of - of use command Lsof, a of Netstat -, the command such as E of Ps -,Port of service of regular examination system is monitored wait for a circumstance,The script that also can make be carried out regularly,Execute these orders regularly late in mailbox;
? ? 3, the History list that checks Root user regularly,Last list,Vipw user list is normal;
? ? 4, fixed backup file,Command with Tar with respect to can very good backup,Need to download these backup of course and transfer medium;
If ? ? discovers any special cases that had not seen or port at one o'clock,Should cause enough attention so,Do not try to save a little but lose a lot.
? ? above is me safe to Linux system with optimized a few easy to read and understand understanding,Hope everybody can safe the working life that efficient use Linux is you is brought convenient.