Introduction : The above article is about [Front-end Frequently Asked Interview Questions] Next, I will summarize [Centos installation and deployment graphic introduction]. I think I can join a group to supervise the study and discuss technology. QQ group: 1076570504 personal learning database http://www.aolanghs.com/ WeChat public account search [ Huanshao ’s Growth Road]
One, CentOS7.4 download
Official website download address: http://vault.centos.org/
1. Enter the CentOS download official website and find the CentOS7.4 version
2. In the CentOS7.4 version page, find isos/
3. After entering the page, you can see x86_64
4. On the CentOS download page, select CentOS-7-x86_64-DVD-1708.torrent to download
5. After the download is complete, because "CentOS-7-x86_64-DVD-1708.torrent" is just a BT seed file and very small, we need to use tools such as Thunder to download the source image
(1) Open Thunder, create a new task, drag the "CentOS-7-x86_64-DVD-1708.torrent" BT seed file into the new task, and click Download Now
(2) After the download is complete, the following files will be generated. CentOS-7-x86_64-DVD-1708.iso is the mirror image we use in our work.
Two, CentOS7.4 installation
1. Open your VMware Workstation Pro and click "Create a new virtual machine". If VMware Workstation Pro is not installed, click VMware Workstation 14 to download and install
2. Click typical (recommended) (T), and click "Next"
3. Click to install the operating system (S) later, and click "Next"
4. Click Linux (L), because the CentOS-7-x86_64-DVD-1708.iso we downloaded earlier is 64-bit version 7.4, so here we choose CentOS 7 64-bit, and click "Next"
5. The name of the virtual machine can be changed or not depending on your needs, modify the installation path of the virtual machine, and click "Next"
6. The default disk selection is 20.0GB, click to store the virtual disk as a single file (O), and click "Next"
7. Click "Finish"
8. Click "Edit Virtual Machine Settings"
9. Click "Use ISO image file (M)" and add the CentOS-7-x86_64-DVD-1708.iso that we downloaded earlier
10. The default is NAT mode (N): it can be used to share the IP address of the host
Tip: Steps 11-13 to remove the USB controller, sound card and printer are just to free up more resource space (you can choose to skip it and not remove it)
11. Select the USB controller and click "Remove®"
12. Select the sound card and click "Remove®"
13. Select the printer, click "Remove®", and finally click "OK"
14. Click "Turn on this virtual machine"
15. The virtual machine is being turned on, move the mouse into the virtual machine, and press the "↑" key, select Install CentOS 7, and finally press the "Enter key"
提示: 鼠标移动到虚拟机内部单击或者按下Ctrl + G,鼠标即可移入到虚拟机中
按下Ctrl + Alt,鼠标即可移出虚拟机
注意: 在虚拟机中的操作,鼠标必须要移入到虚拟机中,否则虚拟机感应不到,无法对其进行操作
16. Press "Enter"
17. The installation interface in the default installation process uses English (English), click "Continue"
18. Configure time zone (DATE & TIME)
(1)选择DATE & TIME
(2)时区设置为 Region:Asia City:Shanghai
日期和时间 设置与自己的电脑时间同步,最后点击“Done”
19. Set software selection (SOFTWARE SELECTION)
(1)选择SOFTWARE SELECTION
(2)点击勾选 Compatibility Libraries 和 Development Tools
If you want to install CentOS with an interface, please select Server with GUI in the Base Environment on the left. The default is Minimal Install (Minimal Install). Tip: If the interface version is installed, click the following The operation in the 22nd step will be different (the interface version is not very useful, it can be set through the command line), here I did not install the interface version
20. Set the installation location (INSTALLATION DESTINATION)
(1)选择INSTALLATION DESTINATION
(2) Click I will configuire parttioning, and then click "Done"
(3) Change the mode, Standard Partition, click the "+" button to add a partition
(4) Add /boot partition, size 300MB, Add mount point
(5) Add swap partition. Generally, it is twice the size of physical memory. It is used when physical memory is insufficient, but it may cause system instability. So depending on the situation, you can set a smaller size, or even 0MB, here I set it to 512MB, Add mount point
(6) Add the root partition, do not fill in the size, that is, the default remaining space is given to the root partition, Add mount point
(7) Click "Done"
(8) Click "Accept Changes"
21. Click "Begin Installation" to start the installation
22. Set the password of the system user root (ROOT PASSWORD)
(1) Select ROOT PASSWORD
(2) Set a password for root (the password length should not be less than 6 digits), and then click "Done"
23. Wait for the installation to complete, and then click "Reboot"
Three, CentOS7.4 basic settings
1. Log in to CentOS, the default account is root, and the password is the root password you set during the previous installation
Tip: When you enter the password, Linux will not be able to see the password you entered for the sake of security. At the same time, if you are using the numeric keyboard on the right side of the keyboard to enter the password, it is recommended to check whether the numeric keyboard is turned on (it is recommended to use the numeric keys on the upper row of the letter keys to enter the password)
2. Configure IP address and gateway
cd /etc/sysconfig/network-scripts/ //进入到network-scripts目录下
vi ifcfg-ens32 //编辑配置文件
//修改以下内容
BOOTPROTO=static //启用静态IP地址
ONBOOT=yes //开启自动启用网络连接
//添加以下内容
IPADDR=192.168.30.1 //设置IP地址
NETMASK=255.255.255.0 //子网掩码
GATEWAY=192.168.131.2 //设置网关
2.1 How to set the IP address of Linux
1. Open the "command line window" on the local computer and enter the command ipconfig to view the IPv4 address under the Ethernet adapter VMware Network Adapter VMnet8
2. You can see that the IPv4 address under the Ethernet adapter VMware Network Adapter VMnet8 is 192.168.30.2
3. When we set the Linux IP address, we need to ensure that the first three digits of the Linux IP address and the IPv4 address under VMnet8 must be the same, that is, 192.168.30 must be the same, so that Linux can communicate with our local computer, and finally One digit is not the same, for example, the IP address of Linux can be set to 192.168.30.1 or 192.168.30.124, etc.
2.2. How to set the gateway of Linux:
1. Click Edit (E) → Virtual Network Editor (N)
2.3. How to set the gateway of Linux, select VMnet8, and then click the "NAT Settings" button to view the subnet mask under VMnet8 (NAT mode)
3. Check the gateway under VMnet8 (NAT mode), select VMnet8, and then click the "NAT Settings" button
3. Restart the network service
service network restart
4. Set DNS address
vi /etc/resolv.conf //编辑 resolv.conf文件
nameserver 114.114.114.114 //添加DNS地址
可以添加多个DNS地址,格式为:
nameserver xxx1.xxx1.xxx1.xxx1
nameserver xxx2.xxx2.xxx2.xxx2
常用的DNS地址:
阿里 223.5.5.5 或者 223.6.6.6
谷歌 8.8.8.8
国内移动、电信和联通通用的DNS 114.114.114.114
Tip: If it is an internal network, the DNS address configured above may not be able to access the external network. Right-click the network icon in the lower right corner of the computer, select to open the "Network and Internet" settings, select WLAN, and then click the one you are connected to Network, view network information
Just fill in the IPv4 DNS server address of the intranet
5. Check if you can access the external network
ping -c3 www.baidu.com
PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=128 time=9.45 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=128 time=12.2 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=3 ttl=128 time=9.29 ms
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 9.296/10.346/12.293/1.388 ms
6. Permanently turn off the firewalld firewall (the default firewall of centos7 is firewalld, not iptables, so you need to turn off the firewalld service)
systemctl stop firewalld.service // 停止firewalld服务
systemctl disable firewalld.service // 开机禁用firewalld服务
iptables -L //列出所有iptables规则
7. Permanently turn off the SELinux firewall
vi /etc/sysconfig/selinux //编辑selinux文件
SELINUX=disabled //把文件中的SELINUX=enforcing 改成 SELINUX=disabled 即可
sestatus //查看SELinux状态
Get the current security policy of selinux firewall
sestatus
You can see that the current security policy of selinux firewall is still enforcing, and the configuration file has not taken effect
At this time, we need to restart, and then check the status of the SELinux firewall, we can see that it has been closed
8. Set the "x" executable permission to the /etc/rc.d/rc.local file. The initial setting is that there is no executable permission by default.
chmod +x /etc/rc.d/rc.local //设置可执行权限
//设置前
-rwxr-xr--. 1 root root 473 Aug 5 2017 rc.local
//设置后
-rwxr-xr-x. 1 root root 473 Aug 5 2017 rc.local
9. Enter "halt" to shut down the virtual machine, take a snapshot, and save the current configuration
Fourth, Centos installs MySQL database
The next article is updated, so far I only learned here. WeChat public account pays attention to a wave of not getting lost!
The more you know, the more you don't know. Find the right direction and stick to your own position! Come on, keep moving forward, and there will eventually be a bright future!
It is not easy to create, and your support is the greatest recognition to me!
The article will continue to be updated, see you in the next issue! QQ group: 1076570504 WeChat public account search [Huanshao’s growth path] Please support!