Newcomer entry and installation configuration FAQ (8) <74> How to use Linux to set up a web server? The Apache server is the first choice for setting up a web server in Linux. You can choose to install it when you install Linux. If you do not install Apache when installing, you can find a file from the disc or on the Apache website: Apache-1.3.12.i386.rpm, then perform the following command to complete the installation: 1) rpm -ivh apache-1.3.12.i386 .rpm 2) Modify the configuration file httpd.conf, access.conf, access.conf, etc. in the / etc / httpd / conf directory; 3) Place the home page file in / home / httpd / html directory; 4) Execute "/ etc / rc. D / init.d / httpd start "Start the Apache server If you need to close, you can execute the /etc/rc.d/init.d/httpd stop command. <75> How to use Linux to set up an FTP server? In Linux, the most commonly used FTP service software is a number of wu-ftpd if it is not installed when it is installed. You can get its RPM package from the CD or website rpmfind.net/linux/rpm/wbyname.html: wu-ftpd-2.6.0-9.i386.rpm. Then do the following command to complete the installation: rpm -ivh wu-ftpd-2.6.0-9.i386.rpm Edit "/etc/inetd.conf" file, point to the new FTPD daemon, as follows: ftp stream TCP NOWAIT ROOT / usr / sbin / tcpd in.ftpd -la to this, your Linux can accept FTP service. <76> How to use Linux to set up an E-MAIL server? In Linux, the most commonly used E-mail server is Sendmail, you can select it when you install Linux. 1) Do a MX record for the E-mail server on the DNS server; 2) Edit the /etc/inetd.conf file, remove the annotation of the row of POP and SMTP; 3) Execute the kill -hup inetd to make the modification take effect The user of the e-mail server can send and receive mail through client programs such as Outlook. <77> How to use Linux to set up a News server? When installing Linux, select the INN package and allow the InND when booting. Most of the configuration work has been completed when the system is installed, and there is no need to compile the source code. 1) Configuration /etc/news/inn.conf: domain: foo.com Organization: Foo Company News Site Server: Localhost fill in according to the actual situation; 2) Configuration /etc/news/nnrp.access nnrp.access is used to complete news The Readers service's waiter NnRPD configuration file is used to control access to the site, modify this file does not have to start InND. 3) Add newsgroup: You can use the ctlinnd command to increase by manually editing / var / lib / news / Active file.
If you have a manual modification newsgroup, you must do the following command to take effect: CTLinnd Reload Active "Modify Active <78> How to use Linux to set up BBS? 1) Download the source code release package file Pbbs.Tar.gz; 2) perform TAR ZXVF PBBS.TAR.GZ until the TAR ZXVF PBBS.TAR.GZ unfained file; 3) Enter the PBBS directory, run install; 4) Change the default settings according to specific requirements. <79> How to make Linux become a file server? In Linux, you can use Samba to make a file server, you can select Samba when you install Linux, you can complete the installation. 1) edit /etc/smb.conf, modify the configuration:. Netbios name = linux workgroup = SambaServer server string = Samba Server hosts allow = 192.168.9 127. securoty = share interfaces = 192.168.9.1 / 24 name resolve order = host dns Bcast Wins Support = NO 2) Restart SMB Server: /etc/rc.d/init.d/smb restart 3) Edit client's HOSTS file, join the resolution of Samba Server; 4) You can nearest online I saw it. <80> How to use Linux to set up a proxy server? 1) to http://squid.nlanr.net/squid/ download Squid proxy server software Squid-2.2.stable3-src.tar.gz; 2) Perform tar xzxf Squid-2.2.stable3-src.tar.gz 3) Execute ./configure 4) Perform make, make install installation to / usr / local / squid directory; 5) Edit /usR/local/squid/squid.conf file, join: ACL ALLOWED_HOSTS SRC 192.168.9.0/255.255.255.0 Note : Suppose your intranet IP address is 192.168.9.0; 6) Execute / USR / local / Squid / Bin / Squid -z for initialization 7) Execute / usr / local / squid / bin / Squid open service 8) on the client Set the proxy server IP and port 3128, you can access the Internet. <81> How to use Linux to make a transparent gateway? Confirm that the Linux kernel has supported ipchain, then write a script ipchains.rule, the content is: Note: Suppose the external network address of the transparent gateway server is: 1.2.3.4, has been connected to the Internet; the intranet address is 192.168.9.1, Online.
#! / bin / sh / sbin / ipchains -f forward / sbin / ipchains -f output / sbin / ipchains -p forward deny / sbin / ipchains -piny / sbin / ipchains -p input / sbin / ipchains -p output Accept external_interface = 1.2.3.4 / sbin / ipchains -a input -j accept -i lo / sbin / ipchains -a output -j accept -i lo / sbin / ipchains -a infut -j deny -i eth1 -s 192.168.9.0 / 24 / sbin / ipchains -a input -j deny -i eth1 -d 192.168.9.0/24 / sbin / ipchains -a output -j deny -i eth1 -s 192.168.9.0/24 / sbin / ipchains -a output J Deny -i Eth1 -d 192.168.9.0/24 / sbin / ipchains -a input -j deny -i eth1 -s $ external_interface / 32 / sbin / ipchains -a input -j deny -i eth1 -s $ external_interface / 32 / sbin / ipchains -a output -j deny -i eth1 -d $ external_interface / 32 / sbin / ipchains -a forward -j accept -i eth0 -s 192.168.9.0/24 -d 192.168.9.0/24 / sbin / modprobe ip_masq_ftp / sbin / modprobe ip_masq_quake / sbin / modprobe ip_masq_irc / sbin / modprobe ip_masq_user / sbin / modprobe ip_masq_raudio / sbin / ipchains -A forward -j MASQ -i eth1 -s 192.168.9.0/24 After running this script, all machines in the 192.168.9.0 network simply set the gateway to 192.168.9.1, you can connect to the Internet. <82> What server can you build? Linux can also be a domain name server, a PPP server, a CVS server, a router, a firewall, and can also build a server cluster system through the LVS solution. <83> How to check the port of the system? You can use the command: netstat -lnp to view the port of the current listening of the system. Where l option indicates a port that is listening (listen); n option means that the port number is displayed instead of being converted to port names by viewing / etc / service; the P option indicates the listening program.
<84> How to use iptable to do the NAT on Linux under the NAT Internet Card IP 200.200.200.100 NIC IP 192.168.8.1 Add the following content to the /etc/rc.d/rc.local file, restart the machine Can #############> / proc / sys / net / ipv4 / ip_forward / sbin / rmmod ipchains / sbin / modprobe ip_tables / sbin / modprobe iptable_filter / sbin / modprobe iptable_nat / sbin / modprobe ip_conntrack / sbin / modprobe ip_conntrack_ftp / sbin / modprboe ip_nat_ftp / sbin / iptables -F INPUT / sbin / iptables -F FORWARD / sbin / iptables -F POSTROUTING -t nat / sbin / iptables -P FORWAR DROP / Sbin / iptables -t nat -a postrouting-th0 -a postrouting -o eth0 -s 192.168.8.0/24 -j masquerade / sbin / iptables -a forward -i eth0 -m state --state established, Related -j Accept / Sbin / iptables -a Forward -s 192.168.8.0/24 -j accept ################ <85> How to prevent a key file from being modified under Linux? Under Linux, some configuration files do not allow anyone to include ROOT modifications, in order to prevent erroneous deletion or modification, you can set the "Immutable" ". For example: Chattr I / etc / fstab If you need to modify the file: Chattr -i / etc / fstab will then modify the file. <86> How to make a universal ISO mirror mkisofs -a -l -j -l -r -r -r-portname.iso / Directory can make a use of Windows and Linux (or other unix) on Windows and Linux (or other unix) ISO Mirror <87> How to set the user password under Linux How to set a user's password expiration time can be set with usermod -e. If you want to set the user's password expiration time, then modify /etc/login.defs Pass_max_days, such as modifying all users password expiration time is 30 days: pass_max_days 30 If this value is 99999, then the password will never expire.
Novice Getting Started and Installation Configuration FAQ (9) <88> How to Use the Script Automatic FTP? # Under the script, for example, the file name is ftp.txt, the content is as follows: Open 192.168.1.100 / * Connect the remote server with the OPEN 192.168.1.100 * / user myname mypassword / * myName is a username, mypassword is a password * / binary / * with binary transfer * / have / * When there is data transfer, display # 号 * / cd remote_pathname / * Enter a remote target path Remote_pathname * / GET Remote_File Local_File / * Download the Remote File Remote_File Download Cost File Local_File * / Put Local_File Remote_File / * Upload local file local_file to remote file remote_file * / bye / * Exit FTP Application * / # execution command: Cat FTP. TXT | FTP-N <89> How to find computer IP according to the NetBIOS name under Linux? Using nmblookup test You can find the IP of the NetBIOS name TEST in the same network, if this machine has multiple IPs, it will also be part Out. <90> How to use multiple virtual terminals (VT) under Linux? Suppose you have 6 files now, using files for / etc / inittab, join: 8: 234: Respawn: / sbin / getty 38400 TTY8 ..... 24: 234: Respawn: / sbin / getty 38400 TTY24 To skip VT7 because x uses this terminal. The Telinit Q then reload the configuration file. Use the left Alt Fn to switch between 1-6 and 8-12, and switch between 13-24 using the right alt fn key. <91> How to implement multi-network card Bonding under Linux? Use multiple network card virtual to become a network card, with the same IP address. This technology is actually existed in Sun and Cisco, known as Trunking and EtherChannel technology, in Linux, this technology is called Bonding. Because Bonding is already included in the kernel 2.4.x, you only need to select the Bonding Driver Support in the Network Device Option when compiling. Then, recompile the core, restart the computer, execute the following command: ismod bonding ifconfig eth0 Down ifconfig eth1 Down IFCONFIG BOND0 ipaddress ifenslave Bond0 Eth0 ifenslave bond0 Eth1 Now two network cards have been working like a piece. This can improve the data between cluster nodes Transfer. You'd better write these sentences into a script, then call the /etc/rc.d/rc.local so that it will take effect on it. Bonding is a better choice for the server. When there is no Gigabit network card, With two or three 100 megabytes cards, Bonding can greatly improve the bandwidth between the server to the switch. But you need to set two port mappings that connect to the Bonding NIC to the same virtual interface on the switch. <92> How do you do not respond to ping under Linux? If you want your Linux server to respond to ping echo 1> / proc / sys / net / ipv4 / icmp_echo_ignore_all, you can do. The same echo 0> / proc / sys / net / ipv4 / icmp_echo_ignore_all responds to the PING package.
But if you restart your machine, the settings will be invalid, so you must add Echo 1> / Proc / Sys / Net / IPv4 / ICMP_ECHO_IGNORE_ALL to /etc/rc.local. <93> How do you create a large number of users at a time? Use the built-in tool newusers and chpasswd. Edit your account file first, each column must be written according to the format of the password file. (Please use the copy of the copy of the instrument to create a large number of copies) example: an account file name to new_alist stu001 :: 600: 600: Stu: / Home / Stu001: / bin / Bash Stu002 :: 601: 601: Stu: / home / stu002 :: 602: 602: stu: / home / stu003: / bin / bash stu004 :: 603: 603: stu: / home / stu004: / bash stu005 :: 604: 604: Stu: / Home / Stu005 :: 605: 605: Stu: / Home / Stu006: / bin / BAME / Stu006: / bin / BASH JISERS
FS_FILE - This field describes the desired file system loaded directory points, for the SWAP device, which is none; for the load directory name contains space, use 40 to represent spaces. FS_TYPE - Defines the file system on the device, which is generally common file type EXT2 (common file type of Linux device), Vfat (FAT32 format of Windows system), NTFS, ISO9600, etc. FS_OPTIONS - Specifies the file system that loads the device is a specific parameter option that needs to be used, and multiple parameters are separated by commas. For most systems use "defaults" to meet the needs. Other common options include: Option Meaning RO Loads this file system SYNC to buffer the write operation of the device, which prevents the file system in the case of abnormal shutdown, but reduces the computer speed USER allowed Normal users load this file system quota to force disk quota on this file system to limit NOAUTO no longer use mount -a commands (such as system startup time) load this file system fs_dump - This option is used by "dump" command to check a file system You should dump with multiple fast frequencies. If you do not need to dump, set this field to 0 fs_pass - this field is used by the fsck command to determine the order of file systems that need to be scanned at startup, and the root file system "/" should be The value of the field should be 1, and other file systems should be 2.
If the file system does not need to scan at startup, set this field 0 3. Sample file # / etc / fstab / dev / hda9 swap swap defaults 0 0 0 / dev / hda1 / ext2 defaults 1 1 / dev / hda5 / home ext2 Defaults 1 1 / dev / hda6 / usr ext2 defaults 1 1 / dev / hda7 / usr / local ext2 defaults 1 1 / dev / hda8 / var ket2 defaults 1 1 / dev / hdb / cdrom iso9660 Noauto, User 0 0 None / Proc Proc Defaults 0 0 none / dev / pts devpts gid = 5, Mode = 620 0 0 (97) How to temporarily add exchange space? 1. Generate a 64M empty file #dd if = / dev / zero of = / swapfile bs = 1024 Count = 65536 2. Initializing this file is swap file: mkswap / swapfile 65536 Sync 3. Activate this exchange file: Swapon / swapfile Novice Getting Started and installation Configure FAQ (10) (98) FAQ type? Compression and package file * .bz2 - Use the bzip2 command to compress file, you can use the bzip2 -d filename unpack * .gz - Use the gzip command to compress file, you can use the gunzip -d filename unpacking * .tar - using the TAR package, the Tarball file, you can Use tar xf filename unpackage * .tbz - After the package is used, you can use the TAR JXF FileName unpack * .z - to compress file using the compress command, you can use the compress -d filename solution Package * .tgz - After using the TAR, then compress the package with the Gzip command, you can use the TAR ZXF FileName to unpack the normal file format * .au - sound file, you can use the system's sound player or Java program. GIF - GIF image file, you can use a web browser to view * .html / .htm - html file, you can use a web browser to view * .jpg - JPEG image file, you can view web browsers * .pdf - the electronic version of the document, PDF is a standard for electronic documents, you can use * XPDF or Adobe Acrobat Reader read * .png - PNG image file, PNG is a short-handed WEB browser or Image Browser View * .ps - PostScript file, a print format file, you can use GhostView or an image browser that supports the PS view, you can also directly output it to the printer print * .txt - text format file, you can use any editing View * .wav - sound file, you can use the sound player to play * .xpm - XPM image file, you can use the image viewer to view the system file * .conf - a program's configuration file, usually use VI to edit *. Lock - a program's lock file for detecting a program in execution or a device or resource is using * .rpm - redhat pack manager file for installing software programs and script files * .c - c Language program source file * .cpp - c language program source file * .h - c or C
Language header file * .o - Program object file * .pl - perl script file * .so - Dynamic Link Library Document * .tcl - TCL Scripting File (99) How does LILO failure after Win9X? After the WIN9X, LILO fails, resulting in the unable to start Linux. You only have to start Linux with a floppy and then run a LILO. For RedHat, you can use the command mkbootdisk to create a boot disk, for example: mkbootdisk --devices / dev / fd0 2.2.15-1 1.2.15-1 is a directory for the operating system version number under / lib / modules. If there is a disc, you can start from the CD, then enter Linux Rescue, then use lilo -r / mnt / sysimage after entering. (100) The meaning of the relevant options in the kernel compile menu? 1. Prompt for development and / or Incomplete Code / Drivers, many reference books say this is the function of developers think it is not very stable, but according to my experience, this is an option to choose, because modern Linux is based on these, so it should You can answer y, unless you just want to use something that is fully constitutive in Linux, but performance is definitely not good, and support for system features will not be good. 2. Processor Family (386, 486 / 5x86 / 6x86, Pentinum / K6 / TSC, PENTINUM / K6 / TSC, PPRO / 6X86) This should not be too much, choose your CPU type, BIOS can Get it, pay attention to the system's startup information. It should be noted that the CPU that cannot be selected than your CPU type, otherwise it may not work properly. 3. Math Emulation Simulation Mathematical Cooperation, if your machine has no mathematical coordinator, then select to improve performance, but 486 after the math coordinator is integrated into the CPU, it should be not used, so The general choice is N. Of course, there will be no problems, except that the core is slightly larger. 4. MTTR (Memory Type Range Register) The option is used to start the special features of the Pentinum Pro and Pentinum II. If you are not using this CPU, you will only make the kernel change. 5. Symmetric Multi-Processing Support Synchronous Processor Support, if you have multiple CPUs, choose. 6. Enable loadable module support This will start the functionality of the additional module, so it is sure to select. 7. SET VERSION INFORMATION ON All Symbols for modules This option can be used for a version of the kernel to be used in another version of the kernel, but it is generally not used. 8. Kernel Module Loader If you enable this option, you can automatically load or uninstall those portable modules at needed at need. The suggestion is recommended. 9. Networking support If you use any network, you should choose 10. PCI BIOS Support is usually selected, unless you use a machine without any PCI device. PCIBIOS is used to detect and enable PCI devices. 11. PCI Bridge Optimization (V1.3) When this option is started, the operating system is optimized for data from the PCI bus from the CPU and the system. This function has completed the experimental phase, which should be safe. And also enhance the efficiency of the system.
12. SYSTEM V IPC Use this option to enable the kernel to support the functionality (IPC) of the SYSTEM V process, and some programs that are transferred from System V will require this feature, which is recommended to enable this feature. 13. SysctL Support Unless you have less memory, you should start this feature, enable this option, the kernel will be 8K, but you can change the parameters of the kernel without having to reboot. 14. Keernel Support for Elf Binaries This option allows your system to perform executables stored in ELF format, while ELF is a standard format of modern Linux executable files, target files, and system libraries. These criteria are required when the operating system should work with the compiler and the connector, so I should answer Y. 15. Compile Kernel AS ELF This option makes your kernel itself compiles in ELF format. If the process GCC on your system generates an executable file in ELF format, then you should start this option. Let's take a look at the version of your compiler and decide. 16. Parallel Port Support If you have any parallel ports and want Linux to use, you can enable this option. Linux can not only use the parallel printer, but also support PLIP (a network communication protocol designed for parallel port), ZIP disk drive, scanner, etc. In most cases, you need additional drivers to use external parallel devices. 17. Plug and play support supports PNP devices Not Microsoft's patents, if you want Linux support PNP devices, you can conflict with other devices, but some cases are enabled (I / O, DMA, IRQ, etc.) ). This option has no effect on the PCI device, because they are born to PNP devices. 18. Normal Floppy Disk Support should answer Y, unless you don't want to use a floppy disk under Linux. But for some systems that do not need to support floppy drives, this option saves some memory. 19. Enhanced IDE / MFM / DLL Disk Support Unless you don't need the support of the MFM / DLL / IDE hard disk, you should answer Y, but if you only have SCSI's hard drive, turn off this option to be safe. 20. Enhanced IDE / MFM / DLL CDROM Support and the above, but it is only support for CDROM. 21. Enhanced IDE / MFM / DLL TAPE Support generally does not have many people in using a tape, so answering N is a better answer. 22. Enhanced IDE / MFM / DLL FLOPPY Support This device seems to be generally used, so I can answer N. 23. Xt HardDisk support If you have this stone's XT hard drive, congratulations, you can use him. 24. Parallel Port IDE Device Support Linux is an IDE device that supports this very new parallel port. If you have any words, use it. 25. Networking Options If you choose a support network in front, you will answer a lot of questions here. Unless you have a special requirement, you should use the default options should be enough. 26. SCSI Support If you have any SCSI control card, this option should answer Y. Find your hardware types in advance, because these issues are for specific SCSI control chips and control cards, if you are not sure which type you use, check your hardware's instructions or Linux's HOWTO document.
Also let you answer a lot of SCSI devices (hard drives, cdrom, tape, floppy, etc.), based on your situation. If you don't have a SCSI device, it is recommended not to support because it saves a lot of kernel space. 27. Network Device Support There are a lot of questions about the network control card. If you can't determine how to choose correctly, check the hardware document or Linux Howto document. 28. Amateur Radio Support This option can be used to initiate basic support for wireless networks, and current wireless networks can transfer data through the public frequency. If you have such a device, you can be enabled, please refer to the AX25 and HAM HOWTO documents. 29. ISDN Subsystem If you have ISDN hardware, you should enable this option and install the appropriate hardware driver, you should also need to enable the Support Synchronous PPP option (refer to PPP overisdn). 30. Old CD-ROM Drivers This is a problem for some special disc drive programs. If you have IDE or SCSI CDROM control card, then this option is not enabled. 31. Character Devices Linux supports many special character devices, such as parallel ports, serial port control cards, QiC02 tape drives, and mice in a specific interface, and in addition to the game rod and image intake and microphone, according to your own situation Bar. 32. FileSystems This is a series of file systems supported by the kernel. For the EXT2 / PROC file system, it should be supported. There are optical drives to support ISO9660 (or module support), have Windows or DOS partitions and want to be in Linux. Access them can also support it. 33. Console Drivers You should at least support VGA Text Console, otherwise you cannot use Linux from the console. 34. Sound Card Support Answer y here Y will have a lot of questions about the sound card, and configure it according to your own situation. 35. Keernel Profiling Support (v1.3) This option enables the function of kernel to perform efficiency statistics and provides other information useful when it is detected. These features will need to pay some costs and cause the system to be performed slowly, unless you are studying a problem with the kernel, otherwise you should answer N. 36. kernel Hacking If you are planning to study how Linux running on your system is working, there are many options, but there is no need to turn off. 101. Why is it very slow when logging in with Telnet / FTP, and normal login is normally? This is because telnetd / ftpd is started with TCPD, and TCPD is necessary to perform security checks, and it uses reverse name parsing. You can add the client's IP address / name to / etc / hosts or add to DNS. Another way is to cancel TCPD (not recommended), modify /etc/inetd.conf original: ftp stream tcp noait root / usr / sbin / tcpd in.ftpd -l -a is changed to: FTP stream TCP NOWAIT ROOT / USR /sbin/in.ftpd in.ftpd -l -a original: telnet stream TCP NOWAIT ROOT / USR / SBIN / TCPD in.telnetd change to: Telnet Stream TCP NOWAIT ROOT /USR/SBIN/IN.TELNETD IN.TELNETD After you, use killall -hup inetd to take effect.
102. How to prohibit a Telnet function of a user, and he has an FTP function?: Suppose you want to turn off the user ftponly Telnet,: 1) Write a shell script / bin / ftponly:: #! / Bin / sh: / BIN / CAT << xx: you can only Use ftp on this computer,: but you may not use this account to login.: xiction will be closed in 10 seconds: xx: / usr / bin / sleep 10: #end of FTPONLY: 2) Set the user ftponly's shell to / bin / ftponly:: to the passwd file, find the line corresponding to FTPONLY: ftponly: ......: / home / ftponly: / bash, put the final : / Bin / bash change to / bin / ftponly.: 3) Add / bin / ftponly to / etc / shells: / bin / bash: / bin / tcsh: / bin / csh: / bin / ash: / bin / zsh: / bin / ftponly: Just line .. --------------:: Suppose you want to turn off the user ftponly Telnet,: 1) Write a shell script / bin / ftponly::: #! / bin / sh:: ~~: XX is a casual file name? The XX here is a flag. When ftponly tries telnet, two will appear on the screen. The content between XX is then cut off after 10 seconds. Note: You should also use trap to block the keyboard interrupt! Otherwise, the family uses Ctrl-Z ... 103. Don't make a boot floppy disk, install Linux? In the Linux CD, there is a DOS software named loadlin.exe, which is to transfer Linux core to memory, and Instead of the current OS pipe computer, Linux core enters the Linux installation routine. Suppose the user's optical drive is F: disk, the Linux core is f: / images / vmlinuz, enter the following command, you can use the start floppy disk, install Linux: loadlin f: / images / vmlinuz root = / dev / ram init = f: /Images/initrd.img loadingLin software has other options to adapt to different hardware configurations. If you are interested, you can refer to the loadlin document. 104./proc important information? Cat / Proc / CPUInfo - CPU (IE vendor, MHZ, FLAGS LIKE MMX) CAT / Proc / Interrupts - Interrupt CAT / Proc / Ioports - Device IO Port CAT / Proc / Meminfo - Memser Information (IE Mem Used, Free, Swap Size Cat / Proc / Partitions - All devices all Partition cat / proc / pci - PCI device information CAT / proc / swaps - All SWAP partition information CAT / proc / version - Linux version number 105. How to let your hard drive fly? Cannot use 32bit I / O and DMA. Use / sbin / hdparm -c1 / dev / hda (HDB, HDC ..) to open the 32Bit transfer mode, open the DMA using command / sbin / hdparm -d1 / dev / hda (HDB, HDC ...). Finally, use / sbin / hdparm -k1 / dev / hda to keep the hard disk over the RESET, so that the hard disk read / write speed should be more than double.