1.1 System Introduction
What is CentOS?
CentOS is a freely available source-code enterprise-level Linux distribution based on Red Hat Enterprise-class Linux . Each version of the CentOS will receive seven years of support (via a security update). The new version of the CentOS is released every two years , and each version of the CentOS is updated periodically (about every six months) to support new hardware. In this way, establish a secure, low maintenance, stable, high predictive, high repeatability of the Linux environment.
CentOS (Community Enterprise operating System) is one of the Linux distributions that is compiled from the source code released by Red Hat Enterprise Linux in accordance with open source rules. Because of the same source code, some servers that require a high degree of stability are used by CentOS instead of the commercial version of Red Hat Enterprise Linux. The difference between the two is that CentOS does not contain closed source code software .
CentOS is a community of Open-source software contributors and users. It compiles the Rhel source code and becomes one of many communities that publish new releases, and in the process of continuous development, the CentOS community is constantly merging with other communities of its kind, making CentOS Linux the most widely used Rhel compatible version. CentOS Linux is no less stable than Rhel, the only thing that is lacking is technical support because it is a free version released by the community.
CentOS Linux and RHEL products have a strict version of the corresponding relationship , such as the use of RHEL4 source code recompile published CentOS Linux 4.0,rhel5 corresponds to the CentOS Linux 5.0,rhel6 corresponding to the CentOS Linux 6. Because the Rhel product has a long life cycle (typically 3-5 years of official support), Red Hat has repackaged the cumulative update into an updated release, often referred to as Rhel update, at intervals after the release of the Rhel series.
For example, the 1th updated version of RHEL5 is called Rhel 5 Update 1, and the user is often called Rhel 5.1. Each Rhel update CentOS community released by Red Hat publishes a corresponding update release, for example, according to Rhel 5 Update 1, CentOS will recompile and package the CentOS Linux 5.1 release. CentOS Linux and the corresponding version number of the Rhel release has package-level binary compatibility, that is, if an RPM package can be installed to run in the Rhel product, it can be installed normally in the corresponding version of CentOS Linux. CentOS Linux has been used more and more widely because of its compatibility with Rhel and the stability of enterprise-class application, and allow users to use it freely.
CentOS Features
- CentOS can be interpreted as Red Hat as series! It's all about making the red Hat as a better release! All kinds of operation, use and red Hat no difference!
- CentOS is completely free and there is no problem with red HAT AS4 requiring serial numbers.
- CentOS 's unique yum command supports online upgrades that allow you to update your system instantly, unlike Red Hat, which requires money to buy support services!
- CentOS fixed a lot of red HAT as bug!
- CentOS Version Description: CentOS3.1 equivalent to Red Hat AS3 Update1 CentOS3.4 equivalent to Red Hat AS3 Update4 is equivalent to Red Hat CentOS4.0.
1.2 Installation version
This installation we choose CetOS6.0 version, the following from a few aspects of this version.
- integrates kernel based virtualization . CentOS 6 is a kernel based virtualization that integrates the KVM management program into the kernel. Such features help CentOS 6.0 of users migrate virtual machines easily between hosts, deploy and manage IT resources more flexibly, and effectively conserve resources for the enterprise. Leveraging the hardware abstraction of the kernel enables applications to be independent of the underlying hardware and to increase CPU and memory scalability so that each server can accommodate more virtual machines.
- enhance system and resource management capabilities . The standards-based Linux Manageability Specification (SBLIM) uses web-based Enterprise Management (WBEM) to manage systems. Replacing MKINITRD with dracut minimizes the impact of underlying hardware changes, is easier to maintain, and makes it easier to support third-party drivers.
- Enhanced power Management , on-time kernel improvements enable CentOS 6.0 to place processors without active tasks in idle state to reduce CPU temperature and further reduce energy consumption.
- With the help of a new framework called a control group (i.e. cgroups), CentOS 6.0 provides fine-grained control, allocation, and management of hardware resources . Cgroups runs at the process group level and can be used to manage resources from CPU, memory, network, and hard disk I/O for the application.
- enhance the reliability, usability and applicability of the system . CentOS 6.0 provides hot-swappable features with new hardware capabilities and can be checked through enhanced error checking of AER PCIe devices. CentOS 6.0 includes advanced data integrity features (DIF/DIX). This type of feature checks and verifies data from the application through hardware. The introduction of the Automated Defect Reporting Tool (ABRT) provides the identification and reporting of system anomalies, including kernel failures and user-space application crashes.
- improved scalability and kernel performance . CentOS 6.0 provides the flexibility to adapt to future systems with scalable capabilities ranging from optimized support for a large number of CPUs and memory configurations to the ability to handle a larger number of system interconnect buses and peripherals. When virtualization becomes as ubiquitous as bare-metal deployments, these capabilities are appropriate for bare-metal environments and virtualized environments.
- CentOS 6.0 improves kernel performance by allocating computing time more equitably between processors by allowing higher-priority processes to handle disturbances at a minimal lower priority. At the same time, CentOS 6.0 improves multiple multiprocessor lock synchronizations to eliminate unnecessary locking events, replace many rotational (spin) locks with sleep locks, and adopt more efficient locking primitives.
- Stable application development and production platform . CentOS 6.0 is a high-performance, highly scalable, distributed, memory-based object caching system that greatly improves the speed of dynamic Web applications. Improvements in three aspects of Apache, squid, and memcached have been largely improved on the web infrastructure. With Java performance support, tight integration of CentOS 6.0 and OPENJDK includes support for Java probes in Systemtap to support better Java debugging. At the same time, CentOS 6.0 is also gradually improving the support of Tomcat 6.
Official website and Documentation
The code is as follows |
|
Official homepage: http://www.centos.org/ Official wiki: http://wiki.centos.org/ Official Chinese document:http://wiki.centos.org/zh/Documentation Installation instructions: http://www.centos.org/docs/ |
1.3 Hardware Information
The Linux distribution now installs the hardware recognition ability to be quite strong , even if does not inquire what hardware information, installs the operating system not to have the big problem, but for very new Hardware and notebook computer such a special device, or recommend the network to query the relevant hardware information to ensure that the hardware can be driven. Here are a few examples of hardware that you might want to focus on, and you need to be aware of these issues for any distribution.
- motherboard chipset Support . This is a set of more important hardware information that may affect whether the hard disk is available, can enable UDMA, and whether ACPI or APM power management can be used. The support program here is always related to the kernel version, and the corresponding kernel version should be noted when examining.
- Network device Support . At present, for the general user is mainly Ethernet card and wireless network card, some wireless network card driver has not been integrated into the kernel, but it does have a driver support.
- sound card . Linux's support for sound chips has historically been criticized, but since the birth of Alsa (Advanced Linux Sound architecture) The problem has been greatly mitigated, and now ALSA is part of the 2.6 kernel. However, there are still a number of sound card problems from time to come. In particular, the majority of users currently use the motherboard onboard sound card, before installing the system should examine the Linux kernel on the motherboard chip sound-effect function support.
- video card . Mainstream graphics cards can now be supported, if necessary, look at the graphics card chip manufacturers, models, video memory size is basically OK, if you want to save time, you can consider the choice of performance, although not strong, but open source drive stability and performance of the best Intel integrated graphics card, The pursuit of High-performance graphics users can consider Nvidia chip and in the future use of the official driver to achieve better 3D performance, Ati/adm graphics card current Linux driver is not ideal, but AMD has opened the technology specifications of the chip, the future will certainly be open source-driven good support.
- Other Peripherals . USB keyboard and mouse generally can be supported, a few of the lowest end of the hard disk box of the mobile hard drive may not be supported, the camera these small hardware can be most of the support, and the other is a number of notebook computers, need to investigate.
In order to be prepared, there is a lot of information to investigate, in addition to the Internet to find and ask around friends, the use of Live CD experience is also a good way.
1.4 Hard Disk partitions
Installing the Linux system on your computer, partitioning the hard disk is a very important step, and here are several partitioning scenarios.
The code is as follows |
|
/boot: Used to store programs related to Linux system startup, such as boot loader, and so on, the recommended size is 100MB. /: The Linux system root directory, all the directories are hanging under this directory, the recommended size of more than 5GB. /home: For ordinary users of the data, is the normal user's host directory, the recommended size for the remaining space. Swap: Implements virtual memory, the recommended size is 1~2 times of physical memory. |
code is as follows |
|
/boot : Used to store programs that start with the Linux system for , such as boot loader, and so on, the recommended size is 100MB. /usr : The application that is used to store Linux systems has more data and is recommended for more than 3GB. /var : Used to store frequently changing data and log files for Linux systems, more than 1GB is recommended. /home : The data for ordinary users is the host directory for ordinary users, and the recommended size is the remaining space. /: The root directory of the Linux system, all directories are hanging under this directory, the recommended size is above 5GB. /tmp : The temporary disk is in a separate partition to prevent system stability when the file system is crammed. The recommended size is more than 500MB. Swap : Implements virtual memory, the recommended size is 1~2 times of physical memory. Scenario 3 (Virtual machine configuration server) (hard disk 8G) |
/boot: Used to store programs related to Linux system startup, such as boot loader, and so on, the recommended size is 100MB.
The remaining volume group configured as an LVM (Logical Volume Manager Logical Volume Management) (Volumegroup)
/: 1G
/ usr: 2GB
/ tmp: 1GB
/var: 1GB
Swap: 2G
There is still space left, and can be added to the desired directory at the appropriate time. Please note the above order, which is considered from the hard drive's read and write frequency.
2, CD-ROM installation
2.1 Installation Boot
First, set the computer's BIOS boot sequence to boot the CD drive, save the settings, put the installation CD into the CD drive, and restart the computer.
After the computer starts, the interface shown in the following figure appears.
You can simply press <Enter> to enter the graphical interface installation or wait 60 seconds .
The following is a boot menu option as shown in the previous illustration :
- Install or upgrade an existingsystem (install or upgrade existing systems):
This option is the default. Select this option to install the system to your computer using the CentOS graphics installer.
- Installsystem with basic video driver (installing systems, basic audio drivers):
This option allows you to install CentOS mode even if the graphics installer cannot load the correct driver for your video card. If your screen appears distorted or blank when using the option to install or upgrade an existing system, restart the computer and try this option.
- Rescue installedSystem (Rescue installed systems):
Select this option to repair your installation of the CentOS system to prevent the normal startup of your problem. Although CentOS is a very stable computing platform, it is accidental that problems can still occur and prevent startup. The rescue environment contains utilities that allow you to address these issues in a wide variety of applications.
- bootfrom the local drive (booting from native drive):
This option will boot from the first installed disk system. If you accidentally start this disc, use the Setup program that does not start immediately and this is the boot option from the hard drive.
2.2 Inspection of Disc media
As shown in the following illustration, if it is a complete installation disk, you can click the Skip button or click the OK button to detect the integrity of the installation disk.
Note : If you are sure that the DVD or CD you downloaded is OK, you can choose ' Skip 'here, but you can also press ' OK ' for DVD analysis, because after analyzing the DVD, There are no strange problems with subsequent installation comparisons. However, if you press ' OK ', the program will start to analyze all the files in the CD information, it will take a lot of time Oh!
2.3 Installation Welcome Interface
After testing the computer hardware information, enter the installation welcome interface, as shown in the following figure.
2.4 Select the language for the installation process
Click the "Next" button to enter the interface shown in the following figure, select the language used during the installation, and choose Chinese (Simplified) (Chinese (Simplified)).
2.5 Choosing a keyboard layout type
After you select the language in the installation process, click the Next button to enter the interface shown in the following figure, select the keyboard type generally, the default option is "American English (U.s.english)", the American keyboard, where you use the default selection.
2.6 Select Device
Select a storage device to install. Basic storage devices are the default choice for installation space and are suitable for users who do not know which storage device should be selected. The specified storage device requires the user to assign the system installation to a specific storage device, a local device, or a SAN (storage LAN). Once the user chooses this option, it is possible to add FCOE/ISCSI/ZFCP disks and filter out devices that the installer should ignore. Here, select Basic storage Devices and click the Next button.
Note : basic storage Devices : For desktops and notebooks, and so on; Specify storage devices : For servers, and so on.
2.7 Initializing the hard drive
If the partition table is not found on the hard disk, Setup will require that the hard disk be initialized . This operation causes any existing data on the hard disk to be unreadable. If your system has a new hard drive with no operating system installed, or deletes all partitions on your hard disk, click Reinitialize.
Note : Setup will provide you with a separate dialog box for each disk and it cannot read a valid partition table. Click the Ignore All button, or the Reinitialize All button to apply the same answer to all devices.
2.8 Setting the host name and network
Setup prompts you to provide and domain name for this computer's hostname format, set host name and domain name. Many networks have DHCP (Dynamic Host Configuration Protocol) services that automatically provide a connection to the domain Name system, allowing the user to enter a host name. Unless you have a specific need to customize the hostname and domain name, the default setting Localhost.localdomain is a good choice for most users.
Set Fixed IP
Select "Configure Network" à "wired" à "eth0" à "edit", pop-up edit window select "IPv4 Settings", open the "method" side of the Drop-down menu, select " manual ". Click the Add button, and then enter the IP, subnet mask , and Gateway for this computer. Enter the DNS address at the followingDNS server . Finally, click on the " Apply " button.
Configure the IP address according to the previous table 2.8-1.
2.9 Time zone selection
Because the world is divided into 24 time zones, you should tell the system where the time zone is. As shown in the following picture, you can choose Beijing or use the mouse to select it directly on the map. To pay special attention to UTC, which is related to "daylight saving time," We do not need to select this option, otherwise it will cause time zone confusion, causing the system to display different times than local times.
2.10 Set Administrator password
The following is the most important "system administrator password" setting, as shown in the following illustration. In Linux, the default name for the system administrator is root, please note that this password is important . At least 6 characters above, contain special symbols, and be remembered.
Note : When you set the next step, because your password may be set too simple, there will be a dialog box, if you want to stick to the password you set, you can choose " anyway ".
2.11 Disk partition Configuration
For the convenience of everyone partition hard disk, CentOS preset gives us partition mode, respectively:
Note : We are directly selected is the " use of all space ", at that time is the map convenient , but the actual work in accordance with the actual requirements of the hard disk partition, reasonable use of hard disk. Instead, select Create a custom layout and repartition the hard disk according to the server partitioning scheme given in 1.4 .
The following is a detailed description of each option:
- uses all spaces (using all Space ): (adds a default partition)
Select this option to remove all partitions on your hard disk (this includes Windows NTFS partition VFAT or partitions created by other operating systems).
- Replace existing Linux systems (replace Existing Linux system):
Select this option to remove partitions that were created by previous Linux installations. This will not remove other partitions (such as VFAT or FAT32 partitions) that you may have on your hard drive.
- Reduce existing systems (Shrink current system ):
Select this option to adjust the current data and partitions installed in manually freed space is a default Red Hat Enterprise Linux layout.
- Use the remaining space (using free spaces ):
Select this option to retain your current data and partitions and install space available on unused storage drives scientific. Make sure there is enough free space on the storage drive, and then select this option.
- Create a custom layout (Create custom Layout): (Select this, you can customize)
Select this option to manually store the device for partitioning and create a custom layout.
The following is the steps to create a custom layout :
The first step : Select "Create custom Layout", press "next" button, as shown in the following figure.
Step two : Create "/boot"
Select the free space you want to partition, and when you press create, you will receive the following picture. When you select Standard partition , click Build.
mount point : Select "/boot"; file system type : Use default "EXT4 log file system"; size : Enter the size of the distribution, in megabytes; Other Size options : Select fixed size , click OK button.
Step three : Create "/"
Continue to select the free space, press "create", you will be the following screen. When you select Standard partition, click Build.
mount point : Select/; file system type : Use default "EXT4 log file system"; size : Enter the size of the allocation 5000, in megabytes; Other Size options : Select fixed size , click OK button.
Step Fourth : Create swap space
Continue to select the free space, click "Create", the following screen will appear. When you select Standard partition, click Build.
file System type : Selectswap; size : Enter the size of the allocation 1000, in MB; Other size options : Select Fixed size ". Click OK button.
Note : Swap space is used to implement virtual memory, the recommended size is 1~2 times of physical memory.
Fifth Step : Create "/usr"
Continue to select the free space, press "create", you will be the following screen. When you select Standard partition, click Build.
mount point : select "/usr"; file system type : Use default "EXT4 log file system"; size : Enter the size of the allocation 3000, in megabytes; Other Size options : Select fixed size , click OK button.
Sixth step : Create "/var"
Continue to select the free space, press "create", you will be the following screen. When you select Standard partition, click Build.
mount point : Select "/var"; file system type : Using the defaultEXT4 log file system; size : Enter the size of the allocation 1000, in MB Other Size options : Select fixed size and click OK .
Note : The diagram and the fifth step are basically the same, so slightly.
Seventh Step : Create "/tmp"
Continue to select the free space, press "create", you will be the following screen. When you select Standard partition, click Build.
mount point : Select/tmp; file system type : Use default "EXT4 log file system"; size : Enter the size of the distribution , in megabytes; Other Size options : Select fixed size and click OK .
Note : The diagram and the fifth step are basically the same, so slightly.
Eighth step:"/home" Partition
Continue to select the free space, click "Create", the following screen will appear. When you select Standard partition, click Build.
mount point : Select "/home"; file system type : Use default "EXT4 log file system"; other size options : Select " use all available space ", click" OK "button.
At this point, the partitions have all been created, and if they are not satisfied, you can also click the Reset button to make changes. If you are sure that the Next button is clicked, eject the "format the following existing hard drive" and select "format".
The installer prompts you to confirm the partitioning options you have selected. Click ' Write modify to disk ' to allow Setup to partition on your hard disk and install system changes.
2.12 Boot Loader Setup
As shown in the following illustration, the Grub Boot installation window allows you to use the default settings and click the Next button directly.
Note : The boot loader password is set by selecting "Use boot loader password" and entering the password in the pop-up window. We are not actually setting this item .
2.13 Choose the installed package (this step minimal disk does not jump directly to the next step)
The optional server type is more, and the default installation is a very small or even incomplete system. Select now customize, and then click Next, as shown in the following illustration.
The optional type description is as follows:
- Desktop: Basic desktop systems, including commonly used desktop software, such as document viewing tools.
- minimal Desktop: A basic desktop system with less software.
- minimal: Basic system with no optional packages.
- Basic Server: Platform support for the basic system that is installed, and does not include the desktop.
- Database Server: Basic system platform, plus MySQL and PostgreSQL databases, no desktops.
- Web Server: Basic system platform, plus php,web Server, and MySQL and PostgreSQL database client, no desktop.
- Virtual Host: The basic system plus the dummy platform.
- Software Development Workstation: Contains more packages, basic systems, virtualization platforms, desktop environments, development tools.
Note : We install Linux here as a server to use, there is no need to install the graphical interface, so the choice is to minimize the installation (minimal), if you want to install the graphical interface, you can choose Desktop Installation (Desktop ).
Since the last step we chose was to minimize the installation (minimal), all packages are not selected by default in the following Package Settings screen. Here we only select the packages we need to install.
First , select Basic in the basic system .
then , select Development tools in development .
finally , select " Chinese support " in " language support ". If you have the need to support other languages, you can also choose here. Finally click " next " to start the installation.
2.14 Start installing Linux system
Start the installation. In the installed screen, it shows how much time it will take, the name of each package, and a brief description of the package, as shown in the following illustration.
When the installation is finished, everything will be finished. When the final screen appears, please take out the disc and press the "reboot" button to start it, as shown in the following figure.
3. Environment setting
After the CentOS 6 has just been installed, the default security settings and service startup and so on may not match our requirements, so before we build a variety of system services, we first set the system environment to the most concise state, In the subsequent opening of a variety of services, in accordance with the needs of the service to carry out specific customization.
3.1 Establish a general user
Root users have the highest control of the entire system , if in the ordinary operation we use root, it is easy to inadvertently delete the system caused by mistake, so we first set up the general user, Use ordinary users to deal with day-to-day system operations.
After the general user establishment success, we can use the general user to login the system to carry on the daily system management. In some cases where root permissions are required, we can log in as root for the user's login status in the following way, and do the operations that require root privileges.
As demonstrated above, we can log on as root by using the "Su-" command in the normal user login state.
3.2 Shutdown Firewall and SELinux
The document is based on the assumption that the "server within the firewall" under the premise of the codification, in this context, the server itself in the internal network does not require a firewall (in the case of need to defend against internal security threats, you can also use your knowledge of iptables, according to the facts set before the fire, and to ensure the state of the server-side firewall boot. In addition, in general, we do not need to SELinux complex protection, so we also set it to an invalid state.
Shutdown firewall
Close SELinux
Execute with the following command, and modify the contents as follows:
The code is as follows |
|
Vim/etc/sysconfig/selinux |
The code is as follows |
|
Selinux=enforcing ↓ Selinux=disabled |
Then execute the following command:
The code is as follows |
|
Setenforce 0 Getenforce |
3.3 Off unwanted services
Use the following command to turn off unwanted services:
The code is as follows |
|
for SERVICES in Abrtd acpid auditd avahi-daemon cpuspeed; Haldaemon mdmonitor Messagebus; Todo chkconfig ${SERVICES} off; Done |
Note : The document was written long after the event, and when Linux was installed, 3.2 and 3.3 of this section did not proceed so much that there was a lot of trouble later, so here's to make up for the omissions. In addition, all of the screenshots of this document are not actually installed, but to write the file on the virtual machine to install the screenshot, so the information on the individual map reflects the virtual machine hardware information, in practice is not the same, installation, please pay attention to the subtle differences.