Five, do Linux administrator: 21 questions
70. How to check the use of Linux hard disk?
In a Linux environment, you can use the DF command to view the hard disk usage. Here's an example of an df-t-H (-t parameter: Displaying the file system type, the-h parameter displaying information in a more readable way) command input:
FileSystem Type Size Used avail use% Mountedon
/DEV/HDA1 ext2 7.5G 4.7G 2.5G 65%/
/dev/hda2 ext2 653M 6.6M 613M 1%/root
/DEV/HDB1 ext2 7.5G 3.5G 3.7G 49%/usr
What compression tools are available under 71.Linux?
There are many kinds of compression tools in Linux, commonly used:
1 Gzip/gunzip: This is the GNU development of Free software, the use of fairly extensive. The compressed file name extension is. gz. The use method is simple, for example:
Gunzip eos.gz Gzip/home/test/*.txt;
2) Compress/uncompress: This is a long history of the compression program, the file after it compressed, compressed file name extension. Z ".
3 In addition, there are: Zip/unzip, bzip2/bunzip2 and so on.
72. How do I manage the process?
A process is a single execution of a program. You can use "PS-AUXW" to list the details of the process that is currently executing, including the process ID number for each process. You can terminate this process by "Kill process ID number".
73. What does the permission for a file or directory mean?
The permission bits of a file or directory are composed of 10 bits, such as-rwxr-xr-x.
1 First representative file/directory type: D represents the directory,-the representative file, L Representative link;
2 The remaining 9 bits are divided into 3 groups, 3 bits per group, 2-4 bits describe the permissions of the owner of the file, 5-7 bits describe the permissions of the same user group as the owner of the file, and 8-10 bits are the permissions of other users.
3) RWX: Each group of 3-bit is: Read permissions, Write permissions, execute permissions, if it is-do not represent this permission.
In other words,-rwxr-xr-x said, this is a common document, the owner of the file can read, write, execute this file, and the owner of the same group of users and other users can read, execute this file.
74. What is a user account?
In the Linux system, it is through the user account to identify each user, through the login to enter a different user account and password to determine your identity. That is, the Linux system is based on user accounts and all users of the management system.
Then you can create a group of users and add users to the group to get the permissions of the user group.
75. Under Linux, how to manage users?
If you want to add a user:
1 log in as root, then execute "adduser user account name"
2 Execute "passwd user account name" to set the password for this user account.
Execute "Userdel user account" to delete a user;
A new user group to perform the "Groupadd user group name";
Perform "Groupdel user group name" to delete a user group;
76. How do I make a disk quota for users?
1 to set the disk quota partition, modify the/etc/fstab file in the following format:
/dev/hda2/home ext2 Defaults,usrquota 1 2
2 Create an empty file under the partition directory where you want to set the disk quota Quota.user
#touch/home/quota.user
#chmod 600/home/quota.user
3 Restart the system, you can use the Edquota-u user name to set.
77. How do I back up the system?
In Linux, you can use the Dump/restore command group to implement system backup and recovery. Suppose you need to completely back up all the files in the/usr directory to the tape drive (assuming the device is RMT8 and different tape drives are not the same), you can use the command:
Dump-o-F/DEV/RMT8/USR
Where the-o parameter represents the backup of all files, the-f device filename parameter specifies where to back up, and the last directory name specifies what to back up.
You can then use the following command to restore:
Restore-r-f/dev/rmt8
78. How do I install the. Tar software package?
There are two ways to publish Linux software: One is the source code and the other is an executable package. Most of the release packages are archived with tar, then compressed with gzip, resulting in a. tar.gz end of the file.
You can use the "tar xvfz filename" to complete the decompression, to solve the tar package work.
If you get the executable package, the installation work is over.
If you get the source code package, you need to compile it:
1 in the Extract directory Run "./configure" to configure;
2) in the decompression directory run "make" to compile;
3 run "make install" installation.
79. How to install Linux software using RPM?
The RPM tools provided by Redhat company make Linux Software installation more convenient.
1) Installation: Rpm-ivh somesoft.rpm
2) Anti-installation: Rpm-e somesoft.rpm
3) Inquiry: Rpm-q Somesoft
80. What if you forget the root password?
If you forget the root password, you can restore it in the following ways:
1 Restart Linux, appear lilo: When, input linuxsingle into single-user mode;
2 at this time without the password to obtain the root authority;
3) Run passwd again to reset root password.
81. What happens when you destroy Lilo by reloading Windows?
This situation can be recovered using two methods:
1 start with a Linux boot floppy disk, then perform/sbin/lilo, and then set up Lilo in the boot area again;
2 use Linux installation CD to boot, select Upgrade system, will rebuild Lilo.
82. How do I make a Linux boot disk?
Under Linux, there is a tool mkbootdisk can easily make a system boot disk:
1 View the version of the system, you can see through ls/usr/src;
2 Insert an empty floppy disk;
3) Execute "mkbootdisk--verbose 2.2.5".
83. How to use Linux remotely?
We can use Telnet, rlogin, rsh, RCP and other commands to achieve remote use of Linux, but these methods in the transmission process is plaintext transmission, so it is possible to bring many unsafe factors. Therefore, you should try to avoid remotely using the root account to log on to the system.
How do I build a secure remote login?
Use SSH for secure remote logins, because SSH enables the encryption of data transfers.
1 obtain ssh-1.26.tar.gz documents;
2 Use tar xvpf ssh-1.26.tar.gz to untie this bag;
3) to the unlocked directory/usr/local/src/ssh-1.26 directory execution./configure;
4 Execute make and install to complete the compilation and installation.
5 You can use SSH to establish a secure remote connection with the server that has SSH installed.
85. How do I run a scheduled task?
It's possible to be familiar with the scheduling tasks in Windows, which can be done on a regular basis with some simple settings. In the maintenance of Linux systems, we may also need to perform a number of tasks on a regular basis, which can be used:
1 at command: it can read the instruction in the keyboard or file, and then execute at the specified time;
2 crontab Waiting Process: Performs certain tasks on a regular basis by setting its configuration file.
What did the 86.Linux boot process do?
1 A boot, the CPU will control to Bios,bios completed post;
2 The BIOS then reads the first sector on the disk and loads the Lilo in the main boot sector;
3 Lilo Select a different kernel image according to the input, if you choose Linux to read the core image under/boot;
4 core Start hardware detection and device driver initialization, and then run Init
5 The INIT process runs a series of initialization scripts according to the/etc/inittab configuration;
6 after completion, start the Getty process to accept the user's login.
87. How to set up the automatic running program?
You can add the following script files to the command you want to execute as soon as you start the system:
/etc/rc.local,/etc/rc.sysinit and/ETC/RC.D/INIT.D.
88. Why do I need to recompile the kernel?
You will need to recompile the kernel or join the dynamic kernel module in the following situations:
1 Update the driver;
2 according to their own needs to customize the most reliable kernel;
3 Upgrade the Linux kernel.
89. How do I recompile the kernel?
1 Enter the Linux source code directory: Cd/usr/src/linux
2 Execute "make config" or "Make Menuconfig", "Make xconfig" Configure kernel option, select the module you want, remove unwanted modules;
3 Execute the "make zimage" command, about 30-90 minutes later, will generate a zimage new kernel image file, stored in the/usr/src/linux/arch/i386/boot directory;
4) and then copy it to the/boot directory;
5) Modify lilo.conf file and add:
Image=/boot/zimage
Label=newlinux
ROOT=/DEV/HDA1 (according to the original file)
Run/sbin/lilo to make the changes take effect.
6 reboot, when the Lilo, input Newlinux can start the new kernel.
90. What is a dynamic kernel module?
Dynamic kernel module is a successful design of Linux, which makes Linux more flexible and easy to customize. In fact, the dynamic kernel module is a kernel module, which can dynamically add some functions to the kernel with the "Insmod module name" command without recompiling the kernel, and move it out of the kernel with the "Rmmod module name" command.
Vi. Cheap Network Solutions---linux:9 ask
91. How to use Linux to set up a Web server?
The Apache server is the first choice to set up a Web server in Linux. You can choose to install Linux when you install it. If you do not have Apache installed, you can find the file from the CD or to the Apache Web site: apache-1.3.12.i386.rpm, and then execute the following command to complete the installation:
1) RPM-IVH apache-1.3.12.i386.rpm
2 Modify the/etc/httpd/conf directory of the configuration file httpd.conf, access.conf, etc.;
3 Place the homepage file in the/home/httpd/html directory;
4 Execute "/etc/rc.d/init.d/httpd start" to start the Apache server
If you need to shut down, you can execute the/etc/rc.d/init.d/httpd Stop command.
92. How to use Linux to set up an FTP server?
In Linux, the most common FTP service software is a few wu-ftpd, if it is not installed when Linux is installed. You can get its RPM package from CD-ROM or website rpmfind.net/linux/rpm/wbyname.html: wu-ftpd-2.6.0-9.i386.rpm. Then perform the following command to complete the installation:
RPM-IVH wu-ftpd-2.6.0-9.i386.rpm
Edit the "/etc/inetd.conf" file to point to the new FTPD daemon, as follows:
FTP stream TCP nowait ROOT/USR/SBIN/TCPD in.ftpd-l-A
So far, your Linux will be able to accept the FTP service.
93. How to use Linux to set up e-mail server?
Linux, the most common e-mail server is SendMail, you can install Linux when you select it.
1 To do an MX record for the e-mail server on the DNS server;
2 Edit the/etc/inetd.conf file to remove the comment on the pop and SMTP lines;
3 Implement Kill-hup inetd to make the amendment effective;
This allows users of an e-mail server to send and receive mail via client programs such as Outlook.
94. How to use Linux to set up news server?
When installing Linux, select the inn package and allow Innd to start when the computer is powered on. When completing the installation of the system, most of the configuration work has been done without compiling the source code.
1) Configure/etc/news/inn.conf:
Domain:foo.com
Organization:foo Company news site
Server:localhost
Fill in according to the actual situation;
2) Configure/etc/news/nnrp.access
Nnrp.access is a configuration file used to complete the NNRPD of the News readers service, which controls access to the site, and does not need to start Innd to modify this file.
3) Add Newsgroups:
You can edit/var/lib/news/active files by hand to add newsgroups, or you can use the ctlinnd command to increase them. If the newsgroup is modified manually, the following command is required to make it effective:
Ctlinnd Reload Active "Modify active"
95. How to use Linux to erect BBS?
1) Download the Powerbbs source code release package file pbbs.tar.gz;
2 Execute tar zxvf pbbs.tar.gz unpack the file;
3) into the PBBs directory, running install;
4 Change the default settings according to the specific requirements.
96. How do I make Linux a file server?
In Linux, you can use Samba to do the file server, you can install Linux when the samba can be selected to complete the installation.
1 edit/etc/smb.conf, modify 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 the SMB server:/ETC/RC.D/INIT.D/SMB restart
3 Edit the Hosts file of the client and add the parsing of the samba server;
4 finally you can see it in the Internet neighborhood.
97. How to use Linux to set up a proxy server?
1) Download squid proxy server Software squid-2.2.stable3-src.tar.gz;
2) Perform tar xzxf squid-2.2.stable3-src.tar.gz
3) implementation./configure
4) Perform make,make install installation to/usr/local/squid directory;
5) Edit/usr/local/squid/squid.conf file and add:
ACL allowed_hosts src 192.168.9.0/255.255.255.0
Note: Suppose your intranet IP address is 192.168.9.0;
6) Perform/usr/local/squid/bin/squid-z initialization
7) Perform/usr/local/squid/bin/squid open service
8 on the client set proxy server IP and port 3128, you can access the Internet.
98. How to use Linux to set up a transparent gateway?
Verify that the Linux kernel already supports Ipchain, and then write a script ipchains.rule that reads:
Note: Assume that the extranet address of the transparent gateway server is: 1.2.3.4, already connected to the Internet, and the intranet address is 192.168.9.1, connected to the intranet.
#!/bin/sh
/sbin/ipchains-f forward
/sbin/ipchains-f input
/sbin/ipchains-f output
/sbin/ipchains-p forward DENY
/sbin/ipchains-p input ACCEPT
/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 input-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 the machines in the 192.168.9.0 network can connect to the Internet by simply setting the gateway to 192.168.9.1.
What other servers can Linux build?
Linux can also be a domain name server, PPP server, CVS server, router, firewall, but also through the LVS solution can also build server cluster system. Because this space is limited, only to the point, if interested can refer to professional Linux books.