Linux system configuration and optimization experience

  
                              



As a Linux enthusiast, I have installed various Linux distributions. A large amount of configuration optimization work takes a lot of time during each installation process, and it is easy to cause some details to be missed. This article takes the installation and use of RedHat 6.1 as an example, talk about some of their own experiences, and communicate with friends who participated in the IBM "I Love Linux" online gathering.

About hard disk partitioning


The author's experience is to set up a separate partition when installing Linux, which is used to store the user's private data, and can also be used to back up the system's configuration file. Easy to configure later.

Editing the /etc/inittab File

Most Linux distributions have six virtual consoles built in. In fact, three are enough and you can save valuable memory. Edit the /etc/inittab file and add # in front of the next three lines.

4:2345:respawn:/sbin/mingetty tty4

5:2345:respawn:/sbin/mingetty tty5

6:2345:respawn:/sbin/mingetty Tty6

Then execute init q to make the system re-read the /etc/inittab file and close the tty4, tty5, and tty6 virtual consoles. If you don't consider the security of the system, you can use the fourth virtual console to view various system information, edit the /etc/syslog.conf file, and add it in the last line:

.?/dev/tty4< Br>

Finally execute killall -HUP syslog.

Edit /etc/inputrc file

Just edit the /etc/inputrc file, set the INPUTRC environment variable, and use the Tab key to complete the function, you can achieve DOSKEY similar to MSDOS. Features. This is as convenient and efficient as the various operations of files and directories.

Editing the /etc/rc.local file

If you need to customize your own login information, be careful to modify the /etc/rc.d/rc.local file, because each time you execute /etc/The rc.d/rc.local file needs to modify the /etc/issue and /etc/issue.net files. We can edit and customize our /etc/issue file to speed up the Linux boot process and add the following:

echo "base=0xd8000000 size=0x800000 type=write-combining" >> /proc/mtrr

# Enable NumLock

for tty in /dev/tty[1 -3]; do

setleds -D +num <

done

Customizing vim environment

In the Linux environment, there are many editors There are mainly emacs, vim, joe, etc. For those who have never used UNIX or Linux, the author's suggestion is to find a few related reference books, first understand the use of these editors, so after installing Linux, When editing and viewing some configuration files, you won't be overwhelmed.

Editing the /etc/mtools.conf file

Under normal circumstances, both Windows 98 and Linux operating systems are installed on their own machines. By installing the mtools package, you do not need to install the corresponding The file system allows reading, writing, moving, and displaying of files between MSDOS, Windows 98, and Linux file systems. Assuming Windows 98 is installed in the /dev/hda1, /dev/hda5 partition, modify the /etc/mstools.conf file and add the following:

drive c: file="/dev/hda1"

drive d: file="/dev/hda5"

This will execute the mdir c: and other commands.

Copy various configuration files

According to the purpose of the machine, edit the corresponding configuration file, for example: samba configuration file /etc/smb.conf, domain name server configuration file, DHCP Configuration file /etc/dhcpd.conf, etc. In general, these files are rarely changed once they are configured, which saves a lot of time. Note that the original configuration file must be backed up, if the configuration file changes, you must also make a backup!

Compiling the Linux kernel

Generally, the kernels installed in various Linux system suites are suitable for most machines, but the disadvantage is that they are large and complete. The kit contains many modules that are not needed at all. . Only by configuring the kernel according to your own needs and machine hardware conditions can you achieve the best. Note that before compiling the kernel, you must have a comprehensive understanding of your own machine, so that you can be aware of it.

The following is a brief step to compile the kernel: (using redhat6.1 as an example)

1. Enter /usr/src/linux, edit the Makefile, and modify EXTRAVERSION= -xx, where Xx indicates the compiled version number, preferably a number, and greater than the original value.

2. According to the hardware configuration of your machine, select the appropriate option to configure the kernel.

#make menuconfig

3. Smooth the dependencies of each file and clean up the previously generated object files and other files.

#make clean ; make dep

4. Compile the kernel and install, and install the module.

#make bzImage

#make modules; make modules_install

5. Install the kernel.

# cp arch/i386/boot/bzImage /boot/vmlinuz-yyyy-xx

Copy the kernel to the /boot directory, where yyyy indicates the Linux version number and xx indicates the compilation. Version number.

# cp System.map /boot/System.map-yyyy-xx

# cd /boot

# ln -s System.map-yyyy-xx System.map

Finally, edit lilo's configuration file /etc/lilo.conf.

6. Test the new kernel.

After the boot is complete, check to see if the modules.dep file is created in the /lib/modules/y.y.yy-xx directory. If the file exists, you can modify /etc/rc.d/rc.sysinit to annotate the contents of the command that the execution module depends on, which speeds up the Linux boot process.

Before testing the new kernel, it is best to keep the original kernel, so if the new kernel boot Linux is not successful, you can use the old kernel to boot the Linux operating system.




Copyright © Windows knowledge All Rights Reserved