How to build a simple Linux Server

Source: Internet
Author: User
Tags mime file ide hard drive squid proxy

As a desktop operating system, Linux's man-machine interface is not flattering. However, as a network operating system, its ease of use (for NOS) and high performance are difficult to find its right. Of course, this is not to say that its operation is very simple, but that if you can master some skills, whether it is system settings or network management, you can become easy and free.

● Disable automatic energy saving of display in Terminal Mode 

After Linux is installed on most PCs, the monitor can be automatically disabled in terminal mode. However, if we want to display some information on the monitor, such as network traffic and packet analysis, this feature becomes very annoying. Changing CMOS and system attributes cannot be solved. The solution is to use setterm to set terminal commands, such as setterm -- blank, to disable the feature of automatic energy saving.

● Save man help document as a common txt file

Man's position is crucial in Linux, and it is much better than the Help in Windows. However, the information it displays is not plain text. If you direct the text to a text file, you will find that the highlighted text in man is changed to two, there are countless tabs, which makes printing and editing inconvenient. However, you can use the following statement to obtain the common help text of the tcsh command: man tcsh col-B> tcsh.txt, and there will no longer be any annoying repeated characters.

● IDE Hard Drive Optimization

Linux may pay more attention to data security rather than performance, which is completely necessary for NOS, but it should be fine to enable some useful optimizations on the IDE hard disk. Take a look at this command: hdparm, which is used to display and set the parameters of the hard disk (including the optical drive. We can first use hdparm-I/dev/hda to view the parameter settings of the hda disk, and then modify it as needed, for example: hdparm-c 1 can change the hard disk I/O read/write support from 16 bits to 32 bits. hdparm-m 16 is the MultiCount of the hard disk. Before executing this command, you 'd better use the-I parameter to determine the maximum number of MultiCount supported by your hard disk. These two items are the main optimization items, and others cannot be determined or confused. Hdparm-t/dev/had can be used to test hard disk performance before and after optimization.

● Allow root users to log on remotely

In Linux, the default security setting is that root cannot log on from a remote workstation, which makes remote management of Linux servers a lot of trouble, /etc/securtty is the key file for controlling this mechanism. In the root section of this configuration file, add pts/0 and pts/1 to the terminal name that you want the root user to log on.

● Recover the Linux boot program LILO of the covered MBR (primary Boot Sector)

If LILO is installed in MBR, then install Linux first and then install Windows, LILO will be overwritten. In this case, we cannot boot Linux from the hard disk. What should we do? We can start the Windows command line model, and upload the beiloadlin.exe and vmlinuz files to the Windows partition on the linuxoptical disk, and then execute loadlin vmlinuz root =/dev/had? Rw. This command is used to start Linux from a specified partition and set root partition (1) to read/write mode. In this way, you can modify most of Linux settings or restore LILO. It should be noted that the Linux started in this case is incomplete, such as MSDOS, VFAT file system support, network, and so on, but it does not matter, as long as it can be started like this, we can use mkbootdisk to create a Linux boot disk. You can use this boot disk to start Linux. After Linux is started, you only need to set the first boot =/dev/hda in the/etc/lilo. conf file? Change to boot =/dev/hda, and then execute lilo to restore Linux from MBR.

Most of the Linux system's control is based on configuration files. Understanding these configuration files is more conducive to Linux.

● Add Linux to the Windows NT/2000 Startup Menu

The Linux Startup menu is good. Unfortunately, it cannot display Chinese characters, and you cannot choose whether to start NT or Win 98. Therefore, I think it is better to use the NT series to start the menu. In fact, it is easy to do. After installing all Windows operating systems, install Linux again, and install LILO to the partition where Linux is located instead of MBR during installation. Then, use the boot disk to start Linux, mount the Windows partition to/mnt/dos. Then run dd if =/dev/hda? Bs = 512 count = 1 of =/mnt/dos/bootsect. lin, so a bootsect is available in the Windows partition. lin file, which records the Linux partition boot information, and then in the Windows nt startup configuration file boot. add C: BOOTSECT to ini. LIN = "Red Hat Linux 7.0", when we start the computer again, we find that the "Red Hat Linux 7.0" option is added to the Windows NT boot menu, and we can choose it to start our Linux. Note that NT still only recognizes files in the 8.3 format at startup, so do not change bootsect. lin to a long file name.

● Use Squid to Control File Access

A major benefit of Linux is that it can easily Route IP networks. Many Linux systems are dedicated to Internet access routers. However, package filtering software such as iptables or ipchain can only control which websites the user accesses, but cannot control which files the user accesses. Using Squid, the agent server software in Linux, can easily achieve this. The urlpath_regex In the Squid. conf file controls access to each registered MIME file, for example, the following statement:

# Lists the MIME file types for access control (the access control list is the acl)

Acl denymine urlpath_regex. exe. zip

# Prohibit access to such files

Http_access deny denymine

In this way, all users after this statement are prohibited from accessing the zip and exe files of the corresponding site. Of course, you can add other file types, such as MP3 files. The ReDirect redirection function, such as iptables, forces users to access the Internet through the Squid proxy, that is, the so-called "transparent proxy", to completely control users' access to the site.

● Enable the system to display color files by default.

The color display of different types of files on Linux makes it very convenient, but sometimes this function may be accidentally lost, add alias ls = "ls -- color-F-N" to the configuration file to ensure the normal use of this function.

● Use cron to maintain the activation status of certain partitions

Cron is equivalent to a scheduled task of Win 98. It can regularly execute certain commands according to user requirements. If you mount some NTFS partitions and frequently access this partition (such as Web Server access to some files), it is very likely that the data cannot be correctly read and written due to a long time, at this time, you can use cron's timed access function to ensure that the partition is always active. In my personal experience, it is recommended that the NTFS partition on the network be accessed every 15 minutes by cron. Otherwise, the mount failure may occur when the partition data is required. [# Page _ #] [# page _ #] Note: Any unstated RedHat Linux in this article shall prevail.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.