Take notes on centos 7 (1) and take notes on centos 7

Source: Internet
Author: User

Take notes on centos 7 (1) and take notes on centos 7

Note:

1. This is my first time getting started with CentOS7.

2. The ultimate goal is to perform security tests on the face of CentOS in the ngix + php + mysql + naxsi environment.

The first part is about CentOS 7.

Sometimes I wonder, what are the choices of the server operating systems for so many websites? Windows Server? Or Linux? I have heard of Windows Server 2003 and 2012, but we all know that Microsoft's systems are charged. Are all companies so rich? Is Windows indeed more stable than Linux? With questions, Baidu started.

Gains:

  1Some enterprises or companies adopt the Wndows architecture. For example, the ICBC website adopts the IIS6.0 + ASP. NET Microsoft solution. However, many well-known domestic large companies use the Linux server operating system, Sina's web server Apache and Netease's nginx. Several solutions have their own advantages and disadvantages. For example, nginx occupies less memory, has more concurrency, and has high stability.

  2Since many companies choose Linux as the server operating system, which of the following branches do they use? There is no comparison, no right to speak. Previously, RedHat Enterprise Edition was relatively stable but expensive. CentOS was released free of charge based on the RedHat source code and became the choice of many companies. This is also the reason for learning CentOS.

  3For CentOS, the full name is Community Enterprise Operating System. The Chinese name "Community Enterprise Operating System" is compiled based on the source code published by Red Hat Enterprise Linux according to the open source code requirements, but does not include software with closed source. Therefore, it has good stability and can be replaced by the commercial Red Hat Enterprise Linux.

 4, On the version, CentOS is constantly updated, according to the official site, the latest version is CentOS 7. Official site address: http://www.centos.org/

Part 2 install CentOS 7

Download the image on the official website and install it on the virtual machine. To understand CentOS 7 and minimize installation, this installation is characterized by the lack of many components and environments. You can refer to the related environment selection. Keep a learning heart, this time according to the default installation.

First thing: network settings

Because the default installation method is used and network settings are not selected, the first thing to do is network settings. Includes static IP and DHCP settings.

First, go to the directory/Etc/sysconfig/network-scripts,Vi ifcfg-eno16777736, Content such:

  

Dynamic DHCP settings

  You only need to change the last line of ONBOOT = no to OMBOOT = yes, save it again, and restart the network service network restart. You can use the PING command to test. (Ifconfig and other commands are not supported by default, and relevant modules will be installed later) or ip addr (ip)

Static IP settings

  As a server, all are set as static IP addresses. First, add the following code:

  

// Set dhcp to staticBOOTPROTO = staticIPADDR = 192.168.1.110 // your static IP address GATEWAY = 192.168.1.1 // Default gateway netmask = 255.255.255.0 // subnet mask // Subnet Mask this indicates # PREFIX = 24DNS = 223.5.5.5 // DNS address NM_CONTROLLED = no // no Network Manager is used

Note: It took me nearly five hours to complete the conversion. This problem occurs when the service is restarted.

Restarting network (via systemctl): Job for network. service failed. See 'systemctl status network. service' and 'journalctl-xn 'for details. [FAILED]
Solution:
  1First, confirmIfcfg-eno16777736The HWADDR (MAC address) andIpWhether the MAC displayed after the command is consistent.
  
  
Ensure that the two MAC addresses in the center are consistent.
2,
Use service network restart or
The systemctl restart network. service command may not take effect immediately. Use ifdownEno16777736, then ifupEno16777736.
  My thoughts:
After several hours of difficult searching for information, Official Website forums, Google ran a huge circle and saw a lot of solutions. But it is not solved. I have also checked whether the two MAC addresses are the same. Because no, I don't know if I have caught a blind eye. I finally found that the two MAC addresses are wrong. In this way, when the service is restarted, there is no error, but the IP address does not take effect immediately. If ifdown and ifup are used, they can take effect immediately, just as if the NIC in Windows is disabled/enabled.
The record is recorded here today and will be supplemented tomorrow. If something is wrong, I hope you can correct it and make progress together!

  

 

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.