linux must order (reproduced)

Common sense

$ PATH

Execute the file path variable

echo $ PATH

Add the path to the path

PATH = "$ PATH": / root

Do not add the current directory path, if the tmp under a virus disguised as ls, you are under implementation in the tmp will bid

Common directory (FHS)

/

Root directory, it is recommended only in this directory directory, not a direct file, all files associated with the start should be placed in this partition, / etc, / bin, / dev, / lib, / sbin, and the five sub-directories should be root directory together

/ Boot

Start the file will be used, vmlinuz is the core of linux

/ Dev

Any device with file type stored in this directory

/ Home

Default user directory

/ Root

Administrator's home directory

/ Mnt / media

CD, usb mount point by default

/ Sbin / usr / sbin / usr / local / sbin

System administrators will execute the command

/ Etc

The main configuration file directory system

/ Usr / local

Local self-installer default directory

Linux users group identity and user log files

/ Etc / passwd Note: The user (user) configuration file;

/ Etc / shadow Note: User (user) shadow password file;

/ Etc / group Note: the user group (group) profile;

/ Etc / gshadow Note: User Group (group) of the shadow file;

drwxr - r - 3 root root 4096

This is a directory, but the non-root account can not access this directory if the directory can not execute any command, and naturally can not enter, so, if the development of a directory relative to others, please remember that the x property development directory

Log

/ Var / log / messages

is the core system log messages log file. It contains the boot messages when the system starts, and other run-time system status messages. IO errors, network errors and other system errors are logged to this file. Other information, such as the identity of an individual to switch to root, are also listed here. If the service is running, such as DHCP server, you can observe in the messages file in its activities. Typically, / var / log / messages is that you do first when troubleshooting a document to view.

/ Var / log directory with some files to a number at the end, these are already round robin archive. Log file will become particularly large, particularly heavy. Linux provides a command to polling the log to make your current log information is not submerged into the old irrelevant information. logrotate is usually timed to run automatically, but can also be run manually. When executed, logrotate will get the current version of the log file, then attach the file name Finally, a ".1." Other documents for the earlier round robin ".2", ".3", and so on. The higher the number after the file name, logging more old.

Tcpd

/ Etc / rc.d / rc.local

linux auto-start service is simple, the easiest is to start the command into / etc / rc.d / rc.local file so that you can start automatically every time you start the service when, for example, for apache, apache build good will under the installation directory bin apachectl file generated, this is a textbook launch, we just need to add this command to rc.local in on it

echo / usr / local / apache / bin / apachectl>> / etc / rc.d / rc.local

Hard disk partition

MBR: master boot recorder master boot record, which record the boot program and partition table

A hard drive up to four (primary + extended) partition, which can only have one extended partition.

Therefore, the general partition can use the following partitioning scheme:

P + P + P + P or P + P + P + E or P + E

Extended partition can not be directly used, divided into logical partitions to the job. If you want more than four partitions, if necessary, use an extended partition, in the extended partition into logical partitions in the job.

One / dev/hda1-/dev/had4 been reserved.

For example, I want divided into five partitions, one primary partition, an extended partition. Then the disk partition number:

/ Dev/hda1 / dev/hda5 / dev/hda6 / dev/hda7 / dev/hda8

/ Dev/hda2 is the extended partition, which itself is only used for planning, in fact, the device does not exist.

xinetd and standalone operation mode to run mode

Outline

xinetd instead of inetd, and provides access control, enhanced logging and resource management functions.

In linux that do not are not long-term use of the service as a separate daemon is enabled in the boot, linux port to monitor all of these services by an independent centralized monitoring process xinetd when a client receives a corresponding request, xinetd process on temporary services and start the corresponding transfer of the corresponding port to the appropriate service, the client is disconnected, the corresponding end of the process of service, xinetd to listen. To open a telnet server, you can simply configure xinetd. Xinetd itself is run in standalone

chkconfig-list

xinetd 0: off 1: off 2: off 3: on 4: on 5: on 6: off

standalone one-time start running during stays in memory, the advantage is rapid access to the signal response, the disadvantage is the loss of a certain amount of system resources, so often applied to real-time response requirements of the higher professional FTP server.

Xinetd model to run the services does not in the service daemon implementation process to the process of example FTPD it to run the service model xinetd The situation was such that it will own FTP service listening on the 21st the port But to this modes, then run the service, port 21 by the xinetd process to monitor (and not running at this time FTPD service), if your network card receives a port 21 request, the xinetd process will have to call the FTPD procedure, will port 21 receives data transfer request to the FTPD process to deal with, dealt with FTPD process exits, the xinetd process continues to monitor port 21, which is somewhat similar to the windows svhost process; while running in standalone mode service is a service process such as the ftpd daemon to run in memory, receiving a request to port 21 after the FTPD fork a child process to process, and the original process continues to monitor port 21.

See what this machine is way to start the ftp service of

chkconfig-list # View all services

Found as follows:

vsftpd 0: off 1: off 2: off 3: off 4: off 5: off 6: off
xinetd based services:
vsftpd: on

vsftpd standalone operation mode does not open, use xinetd vsftpd service mode on the

cd / etc / xinted.conf

File is defined as follows

defaults
{
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 50 10
}
includedir / etc / xinetd.d

cd / etc / xinted.d

cat vsftpd

See the following:

service vsftpd
{
socket_type = stream
wait = no
user = root
server = / usr / sbin / vsftpd
log_on_failure + = USERID
log_on_success + = DURATION USERID
nice = 10
disable = no
}

disable = no table name is already started this service.

ps-aux | grep vsftpd

Start Service

1 Start the standalone mode of service: to syslog, for example:

[Root @ linux ~] # / etc / init.d / syslog start

2 Start super daemon (xinted) service mode: telnet, for example:

[Root @ linux ~] # vi / etc / xinetd.d / telnet (refer to section Setting Mode)

[Root @ linux ~] # / etc / init.d / xinetd restart

In addition to this start-up mode, we also can Fedora (Red Hat system) service provided by this program to the daemon start-Oh! In fact, service is just a script you, he can be back with the argument parsing, and then go to / etc / init.d / to start the service corresponding to the name of the script only! Are interested, you can make to resolve / sbin / service Zhezhi shell script ah! Below we explain his use of rough!

[Root @ linux ~] # service [service name] (start | stop | restart |...)

Parameters:

service name: which is the need to activate the service name is required and / etc / init.d / mapping;

start | ...: that is the service to be done.

Example:

Example 1: Zhezhi restart crond daemon:

[Root @ linux ~] # service crond restart

[Root @ linux ~] # / etc / init.d / crond restart

In the above example were, in fact, way to start the service this program, or go directly to the / etc / init.d / under start, all the same it! Themselves to resolve / sbin / service to know why the! ^ _ ^

Tips:

In fact, the Linux system, to 'open or close a port', is the need to 'enable or disable a service' it! Therefore, you can find a corresponding service port, the program corresponding to the service, then enable or disable him, so that by the start of the service port, naturally turned off!

/ Dev / null

cat / dev / null> catalina.out # empty file

Environment settings file

System Settings
/ Etc/sysconfig/i18n

Language data

/ Etc / profile

Set the PATH and other general information, this file is also planning a / etc / profile.d and / etc / inputrc

/ Etc / bashrc

Determine the unmask function, and the contents of the prompt

/ Etc / profile.d / *. sh

For color, language, vim, and which additional configuration commands such as

/ Etc / man.config

Man of the location of system variables

Personal settings
~ /. Bash_profile, ~ /. Bash_login, ~ /. Profile

These three documents as long as a can, usually the first there. Read only when the landing

~ /. Bashrc

Generally need to set their own here, every time when the shell script will re-read the file

~ /. Bash_history

Each landing bash, bash will first read the file, the command will read all the historical memory

~ /. Bash_logout

Leave linux, do some operations

Reading order

First read the system settings, and then read ~ /. Bash_ *, then read ~ /. Bashrc. So landing bash, the final configuration file is read ~ /. Bashrc, in which this file is the final set to set the value of some commonly used can be placed in the file alias or PATH.

source and. can read the contents of the configuration file into the current shell environment

source / etc / bashrc

. / Etc / bashrc

Commonly used commands

alias

Set alias alias ll = 'ls-l'

Unalias delete alias

It is for this log, if you want long-term effect, the need to modify ~ /. Bashrc, after landing initialize alias (with the user related to the root user, modify this file, only the root user when the force

cat-n

cd

chmod-x

Octal digital rights

0 ---

1 - x

2-w-

3-wx

4 r -

5 rx

6 rw-

7 rwx

We can mix the above list of numbers to access, such as the owner I want to have rwx (the corresponding figure is 7), is a group with - x (the corresponding figure is 1), other users have --- ( The corresponding number is 0), so we put together the group's permissions is the rwx - x --- (the corresponding number is 710).

chmod 710 sun.txt

And octal method, if we as a directory and its subdirectories and files have the same properties, you can use the-R option;

u on behalf of the main

g on behalf of the group

o behalf of other users

a representative of the owner, is a group and other users, that is, the top three users (or groups) of all;

Permissions define the letter:

r for read access;

w for write access;

x is execute permission;

Permissions changes in character;

- Represents less an authority;

+ Means increase the relevant authority;

Example 1:

[Root @ localhost ~] # ls-l linuxsir007.txt

-Rwxr-xr-x 1 root root 0 04-23 20:11 linuxsir007.txt

[Root @ localhost ~] # chmod ugo-x linuxsir007.txt Note: the owner, user group and other users have execute permission to lose;

[Root @ localhost ~] # ls-l linuxsir007.txt

-Rw-r - r - 1 root root 0 04-23 20:11 linuxsir007.txt

chkconfig

Check, set the system's various services

linux os operating environment will be divided into the following seven levels:

0: start (please do not switch to this level)

1: single user text mode interface

2: Multiplayer mode, the text user interface does not have the Network File System (NFS) functionality

3: user mode over a text interface with the network file system (NFS) functionality

4: Some distributions of linux to use this class to enter the x windows system

5: Some distributions of linux to use this class to enter the x windows system

6: Reboot

Parameters:

- Add new system services specified

- Del to delete the specified system service

- Level specifies the system service level in which the execution on or off

- List List the current commands from chkconfig management of all system services and class code

on / off / reset the execution in the specified register on / off / reset the system service

Example

1. See the implementation in a variety of different levels, the status of various services:

$ Chkconfig - list

2 lists the system service vsftpd start at all levels of implementation:

$ Chkconfig - list vsftpd

3. In the implementation level 3,5, close vsftpd system services:

$ Chkconfig - level 35 vsftpd off

4. In the implementation of Level 2, 3, 5, open system service vsftpd:

$ Chkconfig - level 235 vsftpd on

5 do not need to close some of their services ->

If no printer:

chkconfig - level 235 cups off

If there is no LAN:

chkconfig - level 235 smb off

If no remote user login:

chkconfig - level 235 sshd off

If you do not timed tasks:

chkconfig - level 235 crond off

If you do not need to add new hardware:

chkconfig - level 235 kudzu off

Services managed by xinetd are immediately affected by chkconfig. For example, if xinetd is running, finger is disabled, then perform the command chkconfig finger on is, finger do not have to manually restart xinetd to be enabled immediately. For other services will not change in effect immediately after using chkconfig. You must use the command service daemon stop to stop the individual services. In the previous example, replace daemon with the name you want to stop the service, such as the httpd. Replace stop with start or restart to start or restart the service.

chown

When we want to change a file's group, we used the user must be the owner of the file and is also the target group members, or super user. Only super user can change the file's owner.

Example: example.txt owner of the file to linuxsirorg users;

[Root @ localhost ~] # ls-l example.txt
-Rw-r - r - 1 root root 0 04-24 22:37 example.txt

[Root @ localhost ~] # ls-l example.txt
-Rw-r - r - 1 linuxsirorg root 0 04-24 22:37 example.txt

[Root @ localhost ~] # chown beinan: root example.txt
[Root @ localhost ~] # ls-l example.txt
-Rw-r - r - 1 beinan root 0 04-24 22:37 example.txt

chown-R also provides a parameter, change the directory owner and group are extremely useful, we can add the-R option to change all the files in a directory to the new owner or an group;

cp

date

df-h

du

exit (exit the current shell)

fdisk

fdisk-l see the disk usage

file

Through the file command, we were able to identify the file type.

[Root @ qb ~] # file install.log

install.log: UTF-8 Unicode text

find

Syntax Description
The general form of the find command;

find pathname-options [-print-exec-ok ...]

find command parameters;

pathname: find command to find the directory path. For example. To indicate the current directory, use / to represent the system root directory.
-Print: find command will match the file to standard output.
-Exec: find command to execute the files that match the parameters given shell command. Corresponding command in the form of 'command' {} \;, note {} and \; between the spaces.
-Ok: the role and same-exec, but in a more secure mode to execute the shell command given parameters, in the implementation of each command, you will be prompted to allow the user to determine whether to execute.

find command options

-Name
Find files by file name.
-Perm
To find files by file permissions.
-Prune
Use this option can specify the find command is not in the current directory to find, if you use the-depth option, then find-prune command will be ignored.
-User
According to the file owner to locate the file.
-Group
According to group the file belongs to locate the file.

-Mtime-n + n
Changes in accordance with the time to find the file file, - n that file to change the time from now n days, + n that file to change the time from now n days ago. find command-atime and-ctime option, but they are, and-m time option.
-Nogroup
Find the group owning the file without a valid, that is, the group the file belongs in / etc / groups does not exist.
-Nouser
Find the file without a valid owner, the owner of the file in / etc / passwd does not exist.
-Newer file1! File2
Change the time to find a new but lower than than the file file1 file2 file the old file.
-Type
Find a particular type of file, such as:
b - block device file.
d - directory.
c - character device file.
p - pipe file.
l - symbolic link files.
f - regular file.
-Size n: [c] Find the file file block length n, with c the length of time that the file in bytes.
-Depth: the search file, first locate the file in the current directory, and then look at its subdirectories.
-Fstype: look at a type of file system files, these file system types can usually be in the configuration file / etc / fstab to find the configuration file contains the system information about the file system.
-Mount: Find documents in the file system does not cross mount points.
-Follow: If the find command encounters a symbolic link file, follow the link points to the file.
-Cpio: files that match the use of the cpio command, these files will be backed up to tape devices.

In addition, the following three differences:

-Amin n
Find the last N minutes to access the system file-atime n
Find the system in the last n * 24 hour access to the file-cmin n
Find the system was changed in the last N minutes file status file-ctime n
Find the system in the last n * 24 hours to be changed the status of the file file-mmin n
Find the system was changed in the last N minutes of file data files-mtime n
Find the system in the last n * 24 hours to be changed file data files

-Exec-ok instructions

-Exec command argument followed by the command, note the following points:

command command terminated with ';' (semicolon) to determine, in the back must have a ';

'{}', Use {} to represent the file name, that is, find the process to filter out in front of the file for command command processing

Special emphasis, for different systems, direct use of the semicolon may have different meaning, the use of escape character '\' before the semicolon clearly

Example
Jsp files under a directory to find out there are 203 keywords

find / usr / local / tomcat / webapps-name '*. jsp'-exec grep 203 {} \;

find / usr / local / tomcat / webapps-name '*. jsp'-print | xargs grep 203

Find all files in the system's normal file length of 0, and list the full path

find /-type f-size 0-exec ls-l {} \;

Find all current file system directory and sort

find.-type d | sort

Find a common system for each file, then use the xargs command to test what kind of files they belong to

find.-type f-print | xargs file

free-m

ftp

In the windows directory on the first switch

ftp cqzhende.gicp.net

ls lists all files

bye quit

put the file transfer

get access to files

lcd local path switching

lpwd show local Road King

grep

id

Display the user's ID, and belongs to the group ID

ifconfig

kill

last login to the system lists the current and past users of information.

lastb list Login failed user-related information systems

less

Less is another text reader, but it also allows to scroll through the file and retrieve information.

less / var / log / messages

The above command will display the / var / log / messages file. Use "q" to stop viewing the file. Use "h" to get the use of less help.

ln

Hard links can only refer to the same file system files. It refers to the file in the file system of the physical index (also known as inode). When you move or delete the original files, hard links will not be destroyed, because it refers to a file instead of physical data files in the file structure in place. Hard-linked files do not need user permissions to access the original file, it will not show the location of the original file, which will help document security. If you delete a file with the appropriate hard links, then the file will still be retained until all references to it are removed.

A symbolic link is a pointer to the file in the file system location. Symbolic links can cross file system, or even point to the remote file system files. Symbolic link just specifies the location of the original file, the user needs to have access to the original location of the file permissions before you can use the link. If the original file is deleted, all symbolic links pointing to it will have been destroyed. They will point to the file system in a location that does not exist.

# Create a hard link from MyFile in the current

# Directory to / YourDir / MyFile

ln MyFile / YourDir

# Create a symbolic (soft) link from MyFile in

# The current directory to / YourDir / YourFile

ln-s MyFile / YourDir / Yourfile

ln-s / var / log / messages ~ / messages

For the linux system log to create a symbolic link to a user directory messages

locate

Need to run this command in the background as the index database support in Ubuntu the database file is located in / var / cache / locate / locatedb. In general, the database file via cron every day is automatically updated. If, unfortunately, has not been updated, you can execute sudo updatedb to update manually.

login

ls

ls-l

2408949 -rwxr-xr-x 1 root root 7 04-21 12:47 lsfile.sh

The first field :inode

The second field : Files types and permissions :

The third field : Number of hard links :

The fourth field : Owner :

The fifth field : The ownership group :

The sixth field : Size of the file or directory :

The seventh and eighth fields : Last accessed or modified times :

Nineth field : The file name or directory name

First-representative is a plain file , D representative directory

Each file or directory has a set of nine permission bits, each being divided into a group of three, they are the owner permission bits (representing three positions), the user group permission bits (representing three positions), other users rights position (accounting for three positions). Such as rwxr-xr-x, we know what the number is 9 position, and it is the nine permission bits to control the file owner, user groups and other users.

mkdir

mv

netstat

Use the netstat command allows you to know the whole Linux system's network

netstat-s displays statistics

netstat-a shows all connection information

passwd password

ping

ps report process status

ps-aux | grep XXX

pwd

reboot reboot

rm-fr recursively force remove

rmdir

rpm

redhat package manager

rpm-q webmin

Query whether to install webmin

Kit Installation

rpm-ivh package name

i: Use rpm to install mode

v: During the installation process to provide more information

h: During installation, print # numbers

Delete kit

rpm-e package name

Upgrade kit

rpm-Uvh package name

su

su - clsung change the account and change the working directory for the clsung to clsung's home directory

su clsung changes account for the clsung

sudo

tail

tail-f / var / log / messages

setup

graphical management tool under linux

The above command will display the / var / log / messages file the last 10 lines, and then continue to monitor the file, and output the new behavior. To stop tail-f command, use Ctrl + C to abort the process.

tar

tar-cf lib.tar lib

The lib directory to be packaged into lib.tar

Top

top-n 1

Show time

Time

A process to detect the time required for processing time plus the sum of the other. Do not confuse the above-mentioned date command. For example, I can use the command "time ls" to display a directory to determine how long it takes; or I can use the command "time sleep 10" command to test time (sleep for 10 seconds, do nothing).

touch

traceroute

Display data packets to the path between the host

traceroute command allows you to track network data packet routing means, the default packet size is 40Bytes, the user can be set.

tree

uname-a

uptime

The time now after a system boot operation to the present time the number of users to connect the last minute, five minutes and fifteen minutes of system load

vi

In command mode

: Q! exit without saving

: Wq to save and launch

/ Searchword search, n the next

dd delete line

v start tag text. Then, move the cursor

y copy the marked text

x Cut the marked text

p paste text that was cut or copied

In each user's home directory, there is a configuration file vi ". Vimrc" (If not, you can manually create). Users can edit it, so that its settings each time you start vi, are an effective argument. Such as the following:

display line number set nu ----

set nonu ---- do not display line numbers

set ic ---- search without regard to case

set noic ---- Find consider the case

set smartindent ---- Auto Indent

w

w command is also used to show the user logged into the system case, but the difference is and who, w command more powerful, it can not only show who is logged into the system, these users can display the current work in progress, I feel more practical

w displays information about currently logged users of the system

wc (word count)

whereis

whereis command is to find the binary files, but also to find its help files;

For example, we do not know where to put fdisk tool, we can use whereis fdisk to find;

[Root @ localhost ~] # whereis fdisk
fdisk: / sbin / fdisk / usr/share/man/man8/fdisk.8.gz

[Root @ qb ~] # whereis grep

grep: / bin / grep / usr/share/man/man1/grep.1.gz / usr/share/man/man1p/grep.1p.gz

who

Display system in which users are above, shows the data includes the user ID, use the terminal, even from up there, and on-line time, slack time, CPU usage, action, and so on.

whois

whois command to find and display information about the specified user account, as it is to the Network Solutions WHOIS database to search, so the account name must be registered before being found in the above, and the difference in name is not case sensitive.

y um

1 to find the package using YUM command: yum search <keyword>

Example

Synchronization time

hwclock - systohc

According to the hardware clock to set the system clock

date; hwclock; hwclock-s; date

Delete all files meet the requirements

updatedb

locate-r '.* properties2 .*' | grep tomcat | xargs rm

mv-v 1.1.txt test | | echo failure>> 2.txt

When the copy 1.1.txt to the test folder fails to write failure 2.txt

Configure telnet

Install telnet

rpm-ivh telnet-server-0.17-39.el5.i386.rpm

vi / etc / xinetd.d / telnet # start

service xinetd restart

Client Access, you can not use the root user

Boot into text mode

vi / etc / inittab, change id: 5: initdefault: to id: 3: initdefault:, reboot ok,

View cpu usage, and output to a text

top-n 1 | grep Cpu> cpu.log

View Hardware of cpu

cat / proc / cpuinfo

Configuring sshd

vi / etc / ssh / sshd_config, change the following

protocol 2

permitRootLogin yes # Enable ssh root login

PasswordAuthentication yes # Set whether to allow password authentication

PermitEmptyPasswords no # Set whether to allow the account with the login password is empty.

If you want to achieve maximum security link, consider a two-card in the configuration set on the server within the network link to allow only SSH, very simple, in the / etc / hosts.deny file to add a last line sshd: ALL in / etc / hosts.allow add the last line of a sshd: 192.168.10. and then save and exit.

service sshd restart

Turn off unneeded services

Input ntsysv

Below I've listed only needed services, not all kill!

Simply click here, selected or deselected using space, tab conversion!

Atd, Crond, Irqbalance, microcode_ctl, network, sendmail, sshd

View the last system boot boot log

Use the dmesg command to quickly view the last system boot the boot log. Usually it will be a lot of the content, so you tend to want to be piped to a reader.

dmesg | more

The above command will display the boot information page.

VMware configuration

VMware is set to vmnet (nat) (equivalent to a different segment connection), the virtual machine in the linux is set to dynamically obtain ip (dhcp) to

Dynamic Host Configuration Protocol (Dynamic Host Configuration Protocol)

The host of the role of virtual network card to act as a router

Yum mirror address changes

# Cd / etc / yum.repos.d /

# Cp-a CentOS-Base.repo CentOS-Base.repo.bak

# Vim CentOS-Base.repo

Code:

# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# Update status of each mirror to pick mirrors that are updated to and
# Geographically close to the client. You should use this for CentOS updates
# Unless you are manually picking other mirrors.
#
# If the mirrorlist = does not work for you, as a fall back you can try the
# Remarked out baseurl = line instead.
#
#

[Base]
name = CentOS-$ releasever - Base
# Mirrorlist = http://mirrorlist.centos.org/?release = $ releasever & arch = $ basearch & repo = os
# Baseurl = http://mirror.centos.org/centos/ $ releasever / os / $ basearch /
baseurl = http://mirrors.163.com/centos/ $ releasever / os / $ basearch /
gpgcheck = 1
gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

# Released updates
[Updates]
name = CentOS-$ releasever - Updates
# Mirrorlist = http://mirrorlist.centos.org/?release = $ releasever & arch = $ basearch & repo = updates
# Baseurl = http://mirror.centos.org/centos/ $ releasever / updates / $ basearch /
baseurl = http://mirrors.163.com/centos/ $ releasever / updates / $ basearch /
gpgcheck = 1
gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

# Packages used / produced in the build but not released
[Addons]
name = CentOS-$ releasever - Addons
# Mirrorlist = http://mirrorlist.centos.org/?release = $ releasever & arch = $ basearch & repo = addons
# Baseurl = http://mirror.centos.org/centos/ $ releasever / addons / $ basearch /
baseurl = http://mirrors.163.com/centos/ $ releasever / addons / $ basearch /
gpgcheck = 1
gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

# Additional packages that may be useful
[Extras]
name = CentOS-$ releasever - Extras
# Mirrorlist = http://mirrorlist.centos.org/?release = $ releasever & arch = $ basearch & repo = extras
# Baseurl = http://mirror.centos.org/centos/ $ releasever / extras / $ basearch /
baseurl = http://mirrors.163.com/centos/ $ releasever / extras / $ basearch /
gpgcheck = 1
gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

# Additional packages that extend functionality of existing packages
[Centosplus]
name = CentOS-$ releasever - Plus
# Mirrorlist = http://mirrorlist.centos.org/?release = $ releasever & arch = $ basearch & repo = centosplus
# Baseurl = http://mirror.centos.org/centos/ $ releasever / centosplus / $ basearch /
baseurl = http://mirrors.163.com/centos/ $ releasever / centosplus / $ basearch /
gpgcheck = 1
enabled = 0
gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

yum fast! We can try.

View all items in the system in the hibernate configuration file connection string

locate-r '.* hibernate.cfg.xml $' | xargs cat | grep connection.url

gzip compression tomcat start

vi / usr / local / tomcat / conf / server.xml

<Connector port = "8080" maxHttpHeaderSize = "8192"

maxThreads = "150" minSpareThreads = "25" maxSpareThreads = "75"

enableLookups = "false" redirectPort = "8443" acceptCount = "100"

connectionTimeout = "20000" disableUploadTimeout = "true"

compression = "on" compressionMinSize = "2048"

noCompressionUserAgents = "gozilla, traviata" compressableMimeType = "text / html, text / xml" />

Plus a few behind the red

Restart tomcat

/ Usr / local / tomcat / bin / shutdown.sh

/ Usr / local / tomcat / bin / startup.sh

access logs tomcat start

vi / usr / local / tomcat / conf / server.xml

Enable the following, the log in the logs directory

<Valve className = "org.apache.catalina.valves.FastCommonAccessLogValve"

directory = "logs" prefix = "localhost_access_log." suffix = ". txt"

pattern = "combined" resolveHosts = "false" />

Configuring vncserver

Service vncserver start

[Root @ zdtech init.d] # / etc / init.d / vncserver restart

Run vncserver, if the first configured VNC Server, VNC login will be required to provide a password to use. Vncpasswd can also be used later to change the password.

[Root @ zdtech init.d] # vncserver
New 'zdtech: 2 (root)' desktop is zdtech: 2

Starting applications specified in / root / .vnc / xstartup
Log file is / root / .vnc / zdtech: 2.log

Log in Windows using a VNC viewer

Enter the server address: 192.168.10.22:2 can be landed, but now is not the desktop changes into the configuration file / root / .vnc / xstartup, so that the same content with the following

[Root @ zdtech init.d] # vi / root / .vnc / xstartup

#! / Bin / sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec / etc/X11/xinit/xinitrc

[-X / etc / vnc / xstartup] & & exec / etc / vnc / xstartup
[-R $ HOME / .Xresources] & & xrdb $ HOME / .Xresources
xsetroot-solid grey
vncconfig-iconic &
xterm-geometry 80x24 +10 +10-ls-title "$ VNCDESKTOP Desktop" &
twm &

Modified to run vncserver command again

[Linuxzgf @ linuxzgf ~] $ vncserver

New 'localhost.localdomain: 1 (test)' desktop is localhost.localdomain: 2

Starting applications specified in / home / test / .vnc / xstartup

Log file is / home / test / .vnc / localhost.localdomain: 2.log

If you want to kill the vncserver process executable vncserver: 1 kill, 1 indicates the ID number display

Configuring apache awstats

Awstats is a very convenient access to the web statistics tool that analyzes logs produced by apache or tomcat, obtained access to statistical information.

Download and install awstats

wget http://prdownloads .sourceforge.net/awstats/awstats-6.9-1.noarch.rpm

rpm-ivh awstats-6.9-1.noarch.rpm

cd / usr / local / awstats / tools

Configuration 1

In the course of the implementation of perl awstats_configure.pl an error occurs,

Error: Failed to open '/ usr / share / doc / awstats / examples / wwwroot / cgi-bin / awstats.model.conf' for read.

Can run the command file before awstats.model.conf, find the installation package and copy this file to / etc / awstats directory

perl awstats_configure.pl # begin configuration

-----> Need to create a new config file?

Do you want me to build a new AWStats config / profile

file (required if first install) [y / N]? y

-----> Define config file name to create

What is the name of your web site or profile analysis?

Example: www.mysite.com

Example: demo

Your web site, virtual server or profile name:

> Cqmc

-----> Define config file path

In which directory do you plan to store your config file (s)?

Default: / etc / awstats

Directory path to store config file (s) (Enter for default):

>

-----> Create config file '/ etc / awstats / awstats.cqmc.conf'

Config file / etc / awstats / awstats.cqmc.conf created.

-----> Add update process inside a scheduler # add a timed task, such as the daily updated log

Sorry, configure.pl does not support automatic add to cron yet.

You can do it manually by adding the following command to your cron:

/ Usr / local / awstats / wwwroot / cgi-bin / awstats.pl-update-config = cqmc

Or if you have several config files and prefer having only one command:

/ Usr / local / awstats / tools / awstats_updateall.pl now

Press ENTER to continue ...

A SIMPLE config file has been created: / etc / awstats / awstats.cqmc.conf

You should have a look inside to check and change manually main parameters.

You can then manually update your statistics for 'cqmc' with command:

> Perl awstats.pl-update-config = cqmc

You can also read your statistics for 'cqmc' with URL:

> Http://localhost/awstats/awstats.pl?config=cqmc

Press ENTER to finish ...

Executed.

See whether the new log into effect

cd / usr / local / apache /

rm-rf logs / access_log # delete the access log, the log does not meet the previous requirements awstats log analysis

cd bin

. / Apachectl-k restart # restart apache

more .. / logs / access_log # check whether the new log into effect, you can use the browser to see their

Configuration 2

vi / etc / awstats / awstats.cqmc.conf

- LogFile specify the web server log file storage location. / Usr / local / apache / logs / access_log

- LogFormat check whether the parameter value to "1."

- DNSLookup the parameter value to "1."

- DirData specify the location of statistics stored. / Usr / local / apache / logs

- DirCgi specify the location of the CGI program. / Usr / local / apache / cgi-bin

- DirIcons specify a small icon in the location.

/ Usr / local / apache / icons

- SiteDomain site host name. cqmc

-HostAliases setting host aliases

Awstats update log data analysis

cd / usr / local / awstats / wwwroot / cgi-bin

perl awstats.pl-update-config = cqmc

Analysis of data access awstats

http://localhost/awstats/awstats.pl?config=cqmc

Auto update statistics regularly

vi / etc / crontab

# Add the following code

00 2 * * * root / usr / local / awstats / wwwroot / cgi-bin / awstats.pl-update-config = cqmc

# Daily 2:00 update statistics

service crond restart # restart crond service

Configure access rights

First introduced the use of password protected directories on the server.

First need to create a password file. This document should not be placed in the location of network access in order to avoid downloaded. For example, if / usr / local / apache / htdocs space can not be other than network access, consider the password file in / usr / local / apache / passwd directory.

Apache is installed in the bin directory provides a htpasswd tool, used to create the password file, you use:

htpasswd-c / usr / local / apache / passwd / passwords rbowen

htpasswd will ask you to enter a password, and asked to re-enter to confirm:

# Htpasswd-c / usr / local / apache / passwd / passwords rbowen

New password: mypassword

Re-type new password: mypassword

Adding password for user rbowen

If htpasswd is not in the search path, you must use the full path, such as: / usr / local / apache / bin / htpasswd

And then modify the httpd.conf or. Htaccess file, instruct the server to which users are allowed access to the user for the password. To protect the / usr / local / apache / htdocs / secret directory, you can write the following command / usr / local / apache / htdocs / secret / .htaccess, or in httpd.conf <Directory / usr / local / apache / apache / htdocs / secret> section.

AuthType Basic

AuthName "Restricted Files"

AuthUserFile / usr / local / apache / passwd / passwords

Require user rbowen

Let us explain these commands one by one. AuthType directive selects the implementation of user authentication methods, the most commonly provided by mod_auth_basic Basic. Must recognize the very important point is, Basic authentication does not encrypt the password from the user's browser, therefore, should not be used for highly sensitive data. Apache, there is another more secure method of authentication "AuthType Digest", ie for a summary of certification by the mod_auth_digest. Currently, only the latest browser versions only support digest authentication.

Configure tomcat awstats

First configuration tomcat access logs, mode pattern = "combined", then configure awstats

In addition to the log file for analysis, as long as the / etc / awstats / a awstats.tomcat.conf under the newly created copy of the document and then modify the inside of the LogFile location, and then in the browser by http://localhost/awstats/ awstats.pl? config = tomcat, using the appropriate conf document request, we can analyze the log of the

Can awstats_updateall.pl, adding cron, all the time with the new log statistics

inotify + rsync to achieve real-time synchronization linux file

Achieve 218.201.39.112 changes when the data are automatically synchronized to 218.201.39.113

Inotify-tools is installed before make sure you hit the linux kernel is 2.6.13, and turn the CONFIG_INOTIFY at compile time option. You can press the following simple way to confirm this: ls / proc / sys / fs / inotify, if supported, then there will be max_queued_events, max_user_instances, max_user_watches three.

Fetion

Download fetion linux command line program

wget http://www.it-adv.net/fetion/fetion_linux_20080402.tar.gz

tar xvf fetion_linux_20080402.tar.gz

Linux download fly client letter. Unpack a file only after the sms. Good. This letter is to send text messages flying procedures friends. Now still can not be used to fly letter. Because it requires the support of libace glibc libraries.

Check for missing libraries, and install

ldd sms

Download lib library

32 Official lib library: http://www.it-adv.net/fetion/library32.rar

64 Official lib library: http://www.it-adv.net/fetion/library64_linux.tar.gz

Unpack and install

cp *.* / lib /

cp *.* / usr / lib /

Fetion use

. / Sms-f 13594745404-p 520167qb-t 13594745404-m hello

. / Sms-f 13594745404-p 520167qb-t 13594745404-i 1.txt

Export oracle data, and compression

Export

mknod / tmp / mypipe p
exp userid = scott / tiger file = / tmp / mypipe &
gzip </ tmp / mypipe> exp.dat.gz
rm / tmp / mypipe

Importing

mknod / tmp / mypipe p
imp userid = scott / tiger file = / tmp / mypipe &
gunzip <exp.dat.gz> / tmp / mypipe
rm / tmp / mypipe

Check your operating system bits

file / sbin / init

BEA JRockit Mission Control

In bea jdk installation directory jrmc files, double click Executive

Tool

webmin

A browser-based management tool

Written in Perl, Webmin is a browser-based management application. Webmin is extensible, in addition to Linux, but also can be used for other Unix-like operating systems. After installation, you can locally or remotely through a browser specific port, usually 10000, to enter the Webmin. It has to point and click interface, you can complete a variety of Linux management tasks, including user management, network firewalls and network devices configuration.

wget http://prdownloads.sourceforge.net/webadmin/webmin-1.470-1.noarch.rpm

rpm-ivh webmin-1.470-1.noarch.rpm

By http://192.168.126.128:10000/ access

cron

Linux operating system, scheduled tasks are usually borne by cron, cron is started, it reads all its configuration files (global configuration file / etc / crontab, the scheduled tasks for each user profile), then cron will According to the command and execution time to time to call the degree of task. cron configuration file is modified, the effect you want the new file, you must re-crond server, there are two ways to choose from;

/ Etc / init.d / crond restart

service crond restart

If you want to Fedora and Redhat or release-based cloning of these releases, if you want to automatically start running, please use the following method

chkconfig - levels 35 crond on

Global configuration file / etc / crontab, for the global configuration file, we use root privileges to change. File Description:

1 * * * * root run-parts / etc / cron.hourly Note: that the first minute of each hour, began to execute / etc / hourly directory of the executable program or script;
2 4 * * * root run-parts / etc / cron.daily Note: that's 4:02 every day, started / etc / cron.daily directory of the executable program or script;
22 4 * * 7 root run-parts / etc / cron.weekly Note: Each year the first seven weeks 4:00 I 22 points, began to execute / etc / cron.weekly directory of the executable program or script;
42 4 1 * * root run-parts / etc / cron.monthly Note: The first day of each month 4:42 to begin the / etc / cron.monthly directory of the executable program or script;

You can add a scheduled task on the global configuration file, also can be placed under each package, such as / etc / cron.daily directory

Write command:

Minutes to hour sun and moon week [user name]

We can schedule a task to write in the global configuration file, if you want to put a plan into the global configuration file, you have to change the distribution corresponding to the cron global configuration file, such as Fedora 5 of the global configuration file is / etc / crontab file;

Each user can also define your own cron configuration file, use crontab-e command to define;

Sysstat

sysstat's main purpose is to observe the service load, such as CPU and memory usage, network usage and disk write and read speed.

Once installed the package down, generally include the following few commands you can use.

Sar, iostat, sa1, sa2, sadf, mpstat, sadc, sysstat

Installation

wget http://pagesperso-orange.fr/sebastien.godard/sysstat-9.0.5.tar.gz

tar-zxvf sysstat-9.0.5.tar.gz

cd sysstat-9.0.5

. / Configure

make

make install

lambda probe

cd / usr / local / tomcat / webapps

wget http://www.lambdaprobe.org/downloads/1.7/probe.1.7b.zip

unzip probe.1.7b.zip

vi / usr / local / tomcat / conf / tomcat-users.xm

# Add the following line, probe the user name and login password

<user username="admin" password="admin1234" roles="manager"/>

# Add in catalina.sh, enable jmx

JAVA_OPTS-Dcom.sun.management.jmxremote

Install groovy

wget http://dist.groovy.codehaus.org/distributions/groovy-binary-1.7.0.zip

cp groovy-binary-1.7.0.zip / usr / local /

unzip groovy-binary-1.7.0.zip

vi / etc / profile

Open / etc / profile, adding environment variables

export GROOVY_HOME = / usr/local/groovy-1.7.0

export PATH = $ GROOVY_HOME / bin: $ PATH

Effect of environmental variables

. / Etc / profile

Test:

[Root @ cqmc-web1 groovy-1.7.0] # groovy-version

Groovy Version: 1.7.0 JVM: 1.5.0_21

Write a test file:

vi test.groovy

#! / Bin / env groovy

println 'hello'

分类:OS 时间:2011-09-21 人气:656
分享到:
blog comments powered by Disqus

相关文章

  • Constant Struts2 default profile configuration default.properties Detailed 2011-01-01

    struts.configuration This property specifies the Struts 2 configuration file loads the configuration file manager. The default value of the property is org.apache.Struts2.config.DefaultConfiguration, this is Struts 2 default configuration file manage

  • LINUX-c-Linux and Solaris environment, the default value 2010-09-03

    Linux and Solaris environment, the default value. Table 6-4 pthread attribute function SuSE Linux 2.6.13 the default value Solaris 10 default value pthread_attr_ setdetachstate () PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE pthread_attr_ setscope

  • linux inotify monitoring changes in the system directory under the 2010-08-26

    Recently we were project needs in a timely manner to delete the cache files generated Nginx services, Youyubushi Henle Jie Nginx Huancun generated Policy, Zhao, on-line Meiyou carefully deliberated, the final hope into liunx the inotify Gongneng, Jia

  • Ubuntu modify the root account password, use the root login 2010-10-28

    How to go online to find a modified root, its own practice the next useful to share out. . . . Ubuntu is a Debian's Linux-based system, which seeks is "Just Work", the latest 10.04 version, unlike other Linux distributions, Ubuntu is free for al

  • Internet HTTP Status Messages 2010-03-29

    Section editor: http://www.btinternet.com/ ~ wildfire / reference / httpstatus / index.htm Of course, j2ee API also have to explain, to gain access to API HTTP Status Messages are errors that web servers and web browsers generate. There are several t

  • New linux user no. Profile issues 2010-07-16

    1 Create a new user, the default home directory below what documents generated by the / etc / skel directory decision, that is what this directory below the home directory after the new user what to build. 2 Create a user by the-d parameter specifies

  • Linux 2.4.30 kernel file system learning (multi-map) 2010-12-22

    I. Overview Based on previous experience of learning the kernel source, the file system implementation in the study, I probably had a learning objectives set: 1, the establishment of a clear overall concept. Details of the code needed for the future

  • Linux 2.4.30 kernel file system learning: a virtual file system (multi-map) 2010-12-22

    This is an old article I published in CSDN, now re-released to the JAVAEYE, and re-finishing. I. Overview Linux file system is very complex, this article only the implementation of virtual file system on specific file system does not involve. Even th

  • Linux's / etc / profile file 2011-10-11

    Linux / etc / profile file to the system will involve changes to the environment, which is something the Linux environment variables, learning to understand the Linux profile Linux-related documents principles, where a detailed analysis of the places

  • linux user. Group Management 2010-06-12

    Linux system is a multi-user multi-task time-sharing operating system, any user to use system resources, must first apply for an account to the system administrator, then the identity of the account into the system. The user's account on the one hand

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.731 (s). 14 q(s)