CentOS 6.4 usage Summary

Source: Internet
Author: User

Outline

I. Installation

2. Start the NIC

3. Modify the Host Name (web.test.com)

4. Modify DNS (8.8.8.8)

5. Configure 163 yum Source

6. Disable SElinux

7. Disable the firewall (ipv4 and ipv6)

8. Install the VIM Editor

IX. Install MAN help document

10. Install LVM

11. Modify the default language

12. Install common tools

Note: The 64-bit CentOS6.4 system is installed in the minimal package. It is used as a local Web server and the entire process is recorded!

I. Installation

There is nothing special about the installation method, such as a CD or image. Describe the hard disk partition and file system format!

1. Partition (for example, GB hard disk and 8 GB memory)

/Boot --- 256 M

/--- 100 GB

/Data --- all remaining

Swap --- 16G

2. File System Type: ext4 is supported since CentOS 6.X. Here we select ext4! Some bloggers may ask why ext4 is selected? Is there any benefit? Hey, let me briefly describe the following: ext2, ext3, and ext4 are the key points for ext4!

3. Differences between the three file systems (the following documents are from the internet. I just sorted them out and shared them with you)

Ext2 (also known as the second extended file system): It is a standard file system in GNU/Linux systems. It features excellent file access performance and is more advantageous for Small and Medium files, this mainly relies on the excellent design of its cluster cache layer. The size of a single file is related to the upper limit of the file system capacity and the cluster size of the file system. In common x86 computer systems, the maximum size of a cluster is 4 kb, the maximum size of a single file is 2048 GB, and the maximum size of the file system is 16384 GB. However, because the current core 2.4 can only use a single partition of up to 2048 GB, the actual file system capacity is only 2048 GB.

Ext3 (third extension file system): As the name suggests, it is the next generation of ext2, that is, adding the log function under the current ext2 format.

EXT4 (fourth extended file system): The file system is a log file system in Linux and a later version of The ext3 file system, but Ext4 is a revolution in the Linux File System. In many aspects, the progress of Ext4 relative to Ext3 is far more than that of Ext3 relative to Ext2. The improvement of Ext3 over Ext2 mainly lies in the log, but the improvement of Ext4 over Ext3 is deeper, and is the optimization of the data structure of the file system, is an efficient, excellent, reliable, and extremely characteristic file system, and EXT3 can be converted into EXT4.

Features and differences between EXT4 and EXT3:

Ext4 provides better performance and reliability, as well as richer features:
1. compatible with Ext3. Execute several commands to migrate from Ext3 online to Ext4 without reformatting the disk or reinstalling the system. The original Ext3 data structure is retained, and Ext4 is used for new data. Of course, the entire file system also obtains a larger capacity supported by Ext4.
2. Larger file systems and larger files. Compared with the Ext3 currently supports a maximum of 16 TB file systems and a maximum of 2 TB files, Ext4 supports 1 EB (1,048,576 TB, 1 EB = 1024 Pb, 1 Pb = TB) file systems, and 16 TB files.
3. unlimited number of subdirectories. Ext3 currently only supports 32,000 subdirectories, while Ext4 supports an unlimited number of subdirectories.
4. Extents. Ext3 uses indirect block ing. When operating large files, the efficiency is extremely low. For example, for a 100 MB file, a ing table of 25,600 data blocks (4 kb for each data block) must be created in Ext3. Ext4 introduces the popular extents concept in modern file systems. Each extent is a set of continuous data blocks, the preceding file indicates that the file data is stored in the next 25,600 data blocks, which improves the efficiency.
5. Multi-block allocation. When writing data to the Ext3 file system, the Ext3 data block distributor can allocate only one 4 kb block at a time. To write a 100 MB file, it is necessary to call the 25,600 data block distributor, the multiblock allocator (mballoc) Multi-block allocator of Ext4 supports allocating multiple data blocks at a time.
6. Delay allocation. The data block allocation policy of Ext3 is to allocate as soon as possible, while the policy of Ext4 and other modern file operating systems is to delay the allocation as much as possible, data blocks are allocated and written to the disk only after the files are written to the cache. This optimizes the data block allocation of the entire file and significantly improves the performance with the first two features.
7. Fast fsck. In the past, the first step of fsck execution was very slow, because it needs to check all inode. Now, Ext4 adds a list of inode not used in each group to the inode table, in the future, The fsck Ext4 file system can skip them and only check the inode in use.
8. Log verification. Logs are the most common part and can easily lead to disk hardware faults. Restoring data from damaged logs will cause more data corruption. The log verification function of Ext4 can easily determine whether the log data is damaged. It also combines the two-phase Log Mechanism of Ext3 into one phase, which improves the performance while increasing security.
9. No Journaling mode. The log has some overhead. Ext4 allows you to disable the log so that users with special requirements can improve the performance.
10. Online fragment. Although delayed allocation, multi-block allocation, and extents can effectively reduce File System fragments, fragments are inevitable. Ext4 supports online fragment and provides the e4defrag tool for fragment of individual files or the entire file system.
11. inode-related features. Ext4 supports a larger inode. Compared with the default inode size of 128 bytes in Ext3, Ext4 can accommodate more extended attributes (such as the nanosecond timestamp or inode version) in inode ), by default, the inode size is 256 bytes. Ext4 also supports fast extended attributes (fastextended attributes) and inode retention (inodes reservation ).
12. Persistent preallocation ). In order to ensure sufficient storage space for the downloaded files, P2P software often creates an empty file with the same size as the downloaded file in advance, this prevents downloading failures due to insufficient disk space in the next few hours or days. Ext4 implements persistent pre-allocation at the file system level and provides the corresponding API (posix_fallocate () in libc), which is more efficient than the application software itself.
13. barrier is enabled by default. The disk is equipped with an internal cache to re-adjust the write operation sequence of batch data and optimize the write performance. Therefore, the file system must write the log data to the disk before writing the commit record, if the commit record is written first, and the log may be damaged, data integrity will be affected. In Ext4, barrier is enabled by default. Only data before barrier is written to the disk can be written to data after barrier. (You can disable this feature by running the "mount-o barrier = 0" command .)

2. Start the NIC

1. We can see from the title that the CentOS 6.4 Nic is not started by default, as shown in figure

As you can see, ONBOOT = no indicates that the boot is not self-starting! The following describes the specific meaning of each option!

12345678 [root @ localhost ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0DEVICE = eth0 # Nic Interface Name HWADDR = 00: 0C: 29: 87: 9D: 1D # hardware address (MAC address) TYPE = Ethernet # Network type uuid = 3efbea06-751a-4add-bec7-13db4d19bc0d # unique Nic identifier ONBOOT = no # Start NM_CONTROLLED = yes # whether the device eth0 can be hosted by the Network Manager graphical management tool BOOTPROTO = dhcp # method of obtaining

2. Let's modify it.

12345678910111213141516171819202122232425 [root @ localhost ~] # Vim/etc/sysconfig/network-scripts/ifcfg-eth0DEVICE = eth0HWADDR = 00: 0C: 29: 87: 9D: 1 DTYPE = EthernetUUID = bytes = yesNM_CONTROLLED = yesBOOTPROTO = a friend of dhcp must be eager to start the NIC service. No error will be reported in CentOS 5, but after the network service in CentOS6 is restarted, ip configuration error! In the main configuration document of the NIC under CentOS6, the line NM_CONTROLLED = yes is displayed by default, which means that the NIC eth0 must be hosted by NetworkManager, in this line, yes | the change of the no Switch Control item takes effect immediately. You can change it to no to save it and immediately solve the above problem! Let's modify it! [Root @ localhost ~] # Vim/etc/sysconfig/network-scripts/ifcfg-eth0DEVICE = eth0HWADDR = 00: 0C: 29: 87: 9D: 1 DTYPE = EthernetUUID = 3efbea06-751a-4add-bec7-13db4d19bc0dONBOOT = yesNM_CONTROLLED = noBOOTPROTO = dhcp [root @ web ~] # Service network restartShutting down interface eth0: [OK] Shutting down loopback interface: [OK] Bringing up loopback interface: [OK] Bringing up interface eth0: Determining IP informationforeth0... done. [OK] [root @ web ~] #

After the modification is successful, let's take a look at the effect:

So far, the online startup is complete!

3. Failed to start the clone VM Nic

After CentOS is configured with VMware, one instance is copied using the copy (clone) VM function. However, when you use ifconfig to view the IP address after startup, the system always prompts that eth0 is not found and the NIC service is restarted: service network restart with the following error message:

Solution:

(1). view the cloned NIC address

From the figure, we can see that the MAC of the virtual machine is different from the MAC in the configuration file. Let's modify the NIC configuration file!

(2). Modify the hwaddr in the ifcfg-eth0 to keep up with the MAC address above

1234567891011 [root @ localhost ~] #! Vimvim/etc/sysconfig/network-scripts/ifcfg-eth0DEVICE = eth0HWADDR = 00: 0C: 29: 87: 9D: 1 DTYPE = EthernetUUID = bytes = yesBOOTPROTO = dhcp (3 ). delete/etc/udev/rules. d/70-persistent-net.rules and restart [root @ localhost ~] # Rm-rf/etc/udev/rules. d/70-persistent-net.rules [root @ localhost ~] # Reboot

3. Modify the Host Name

1234567 [root @ web ~] # Vim/etc/sysconfig/networkNETWORKING = yesHOSTNAME = web.test.com [root @ web ~] # Vim/etc/hosts127.0.0.1 web web.test.com localhost. localdomain localhost4 localhost4.localdomain4: 1 localhost. localdomain localhost6 localhost6.localdomain6 [root @ localhost ~] # Reboot

4. Modify DNS

123456 [root @ web ~] # Vim/etc/resolv. conf; generated by/sbin/dhclient-scriptsearch sh. jjhh. comtest. comnameserver 211.95.1.97 # Shanghai Unicom DNSnameserver 8.8.8.8 # google DNS # Note: nameserver can be set to up to three

5. Configure the yum Source

1. view the yum Source

CentOS 5.X

12345 [root @ localhost ~] # Ls-l/etc/yum. repos. d/total 16-rw-r -- r -- 1 root 2245 Apr 26 2010 CentOS-Base.repo-rw-r -- r -- 1 root 626 Apr 26 2010 CentOS-Media.repo [root @ localhost ~] #

CentOS 6.X

123456 [root @ web ~] # Ls-l/etc/yum. repos. d/total16-rw-r -- r --. 1 root root1926Feb2516: 57CentOS-Base.repo # Is the network source. The default value is-rw-r --. 1 root root638Feb2516: 57CentOS-Debuginfo.repo # test file-rw-r --. 1 root root630Feb2516: 57CentOS-Media.repo # local resource-rw-r --. 1 root root3664Feb2516: 57CentOS-Vault.repo # previous versions have yum sources, which are discarded by the current version package and should not be used for production

2. Configure the yum source of Netease 163

(1) install wget in. yum

1 [root @ web ~] # Yum install wget

(2) download the repo File

: Http://mirrors.163.com/.help/CentOS6-Base-163.repo

1234567891011121314151617 [root @ web ~] # Wget http://mirrors.163.com/.help/CentOS6-Base-163.repo--2013-06-28 19:21:47 -- http://mirrors.163.com/.help/CentOS6-Base-163.repoResolving mirrors.163.com... 123.58.173.20.connecting to mirrors.163.com | 123.58.173.106 |: 80... connected. HTTP request sent, awaiting response... 200 OKLength: 2006 (2.0 K) [application/octet-stream] Saving: "CentOS6-Base-163.repo" 100% [= ========================================================== ========================>] 2,006 --. -K/sin0.01s2013-06-28 19:21:51 (137 KB/s)-"CentOS6-Base-163.repo" saved [2006/2006] [root @ web ~] # Lltotal 36-rw -------. 1 root 970 Jun 20 anaconda-ks.cfg-rw-r -- r -- 1 root 2006 Sep 1 2011 CentOS6-Base-163.repo-rw-r -- r --. 1 root 15709 Jun 20 05: 03install. log-rw-r --. 1 root 4178 Jun 20 05: 01install. log. syslogdrwxr-xr-x 2 root 4096 Jun 22 20:30 src [root @ web ~] #

(3). Back up and replace the system's repo File

12345678 [root @ web ~] # Cd/etc/yum. repos. d/[root @ web yum. repos. d] # mv CentOS-Base.repo CentOS-Base.repo.bak [root @ web yum. repos. d] # lsCentOS-Base.repo.bak CentOS-Media.repo [root @ web yum. repos. d] # mv/root/CentOS6-Base-163.repo CentOS-Base.repo [root @ web yum. repos. d] # lsCentOS-Base.repo CentOS-Debuginfo.repo CentOS-Vault.repoCentOS-Base.repo.bak CentOS-Media.repo [root @ web yum. repos. d] #

(4) execute the yum source update

123 [root @ localhost ~] # Yum clean all [root @ localhost ~] # Yum makecache [root @ localhost ~] # Yum update

6. Disable SElinux

1. temporarily close

1234567 [root @ localhost ~] # GetenforceEnforcing [root @ localhost ~] # [Root @ localhost ~] # Setenforce 0 [root @ localhost ~] # GetenforcePermissive [root @ localhost ~] #

2. Completely disable

12345678910111213 [root @ localhost ~] # Vim/etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX = can take one of these three values: # enforcing-SELinux security policy is enforced. # permissive-SELinux prints warnings instead of enforcing. # disabled-SELinux is fully disabled. SELINUX = disabled # SELINUXTYPE = type of policy in use. possible values are: # targeted-Only targeted network daemons are prot Ected. # strict-Full SELinux protection. SELINUXTYPE = targeted ~ [Root @ localhost ~] # Reboot

7. Disable Firewall

123456789101112131415 [root @ web yum. repos. d] # service iptables stopiptables: Flushing firewall rules: [OK] iptables: Setting chains to policy ACCEPT: filter [OK] iptables: Unloading modules: [OK] [root @ web yum. repos. d] # service ip6tables stopip6tables: Flushing firewall rules: [OK] ip6tables: Setting chains to policy ACCEPT: filter [OK] ip6tables: Unloading modules: [OK] [root @ web yum. repos. d] # chkconfig iptables off [root @ web yum. repos. d] # chkconfig ip6tables off [root @ web yum. repos. d] # chkconfig ip6tables -- listip6tables 0: off 1: off 2: off 3: off 4: off 5: off 6: off [root @ web yum. repos. d] # chkconfig iptables -- listiptables 0: off 1: off 2: off 3: off 4: off 5: off 6: off [root @ web yum. repos. d] #

8. Install the VIM Editor

1. View


Vim is not installed by default.

2. Install vim

1 [root @ web yum. repos. d] # yum install vim *

IX. Install MAN help document

1234567891011121314151617181920 [root @ web ~] # Yum install man * [root @ web ~] # Man vimVIM (1) VIM (1) NAMEvim-Vi IMproved, a programmers text editorSYNOPSISvim [options] [file ..] vim [options]-vim [options]-t tagvim [options]-q [errorfile] exviewgvim gview evim eviewrvim rview rgvim rgviewDESCRIPTIONVim is a text editor that is upwards compatible to Vi. it can be used to edit all kinds of plain text. it isespecially usefulforediting programs. there are a lot of enhancements above Vi: multi level undo, multi windows and buffers, syntax highlighting, com-mand line editing, filename completion, on-line help, visual selection, etc .. see ": help vi_diff.txt" forasum-mary of the differences between Vim and Vi.

10. Install LVM

12345678910111213141516171819202122232425 [root @ web ~] # Yum install lvm2 [root @ web ~] # Man lvmLVM (8) LVM (8) NAMElvm-LVM2 toolsSYNOPSISlvm [command | file] DESCRIPTIONlvm provides thecommand-line toolsforLVM2. A separate manual page describes eachcommandindetail. if lvm is invoked with no arguments it presents a readline prompt (assuming it was compiled with readline sup-port ). LVM commands may be entered interactively at this prompt with readline facilities includinghistoryandcommandn Ame and option completion. refer to readline (3) fordetails. if lvm is invoked with argv [0] setto the name of a specific LVMcommand (forexample by using a hard or softlink) it acts as thatcommand. on invocation, lvm requires that only the standardfiledescriptors stdin, stdout and stderr are available. ifothers are found, they get closed and messages are issued warning about the leak. where commands take VG or LV names as arguments, the full path name is optional. an LV called "lvol0" ina VGcalled "vg0" can be specified as "vg0/lvol0 ". where a list of VGs is required but is left empty, a list of allVGs will be substituted. where a list of LVs is required but a VG is given, a list of all the LVsinthat VGwill be substituted. so lvdisplay vg0 will display all the LVsin "vg0 ". tags can also be used-see -- Addtagbelow. one advantage of using the built-inshell is that configuration information gets cached internally between com-mands.Afilecontaining a simple script with onecommandper line can also be given on thecommandline. the scriptcan also be executed directlyifthe first line is #! Followed by the absolute path of lvm.

11. Modify the default language

1234 [root @ web ~] # Vim/etc/sysconfig/i18nLANG = "en_US.UTF-8 "~ [Root @ web ~] # Export LANG = en

12. Install common tools

1. Common compression tools zip unzip bzip2

1 [root @ localhost ~] # Yum-y install unzip zip bzip2 bzip2-devel

2. gcc ++ Compiler

1 [root @ localhost ~] # Yum install gcc-c ++-y

3. cmake Compiler

1 [root @ localhost ~] # Yum install cmake make-y

4. Image Resources

1 [root @ localhost ~] # Yum-y install gd libjpeg-devel libpng-devel freetype-devel

5. other commonly used resource package tools

1 [root @ localhost ~] # Yum-y install autoconf bison automake zlib * fiex * libxml * ncurses-devel libmcrypt * libtool-ltdl-devel *

All the demos have been completed! Pai_^ ......

This article is from "Share your knowledge ..." Blog, please be sure to keep this source http://freeloda.blog.51cto.com/2033581/1231645

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.