[linux] step by step operation and maintenance - CentOS7 basic configuration

Posted by MBenefactor on Sun, 02 Jan 2022 21:32:03 +0100

Article catalog

  1. Fixed networking IP
    Modify IP using command
    Open the network card configuration file VIM / etc / sysconfig / network scripts / ifcfg-ens32
    Question 1: if you still can't ping Baidu after setting it, what's the reason?
  2. Turn off the firewall and set it to turn off automatically after startup
  3. Set selinux to turn off automatically after startup
    1) Temporary closure
    2) Automatic shutdown after startup
  4. Set CD boot auto mount
  5. Configure the local yum source
    summary
    Before learning, we first configure the initial available environment. The purpose of the initial available environment is to make our experiments in an available environment and reduce the probability of making mistakes Some students may want to ask, shouldn't we make more mistakes in the early stage of learning? Indeed, it is important to make more mistakes, but the premise is not to erode your interest in learning.
    Then follow me step by step to build up the available experimental environment and strive not to make mistakes in the early stage of learning

1. Fixed networking IP

[root@centos7-test1 ~]# systemctl status  NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running) since II. 2019-10-15 05:44:03 CST; 10s ago
     Docs: man:NetworkManager(8)
 Main PID: 22427 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           ├─22427 /usr/sbin/NetworkManager --no-daemon
           └─22458 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-ens32.pid -lf /var/lib/Networ...


[root@centos7-test1 ~]# 

Seeing the word running indicates that the network is in the startup state. Next, we use the command to modify the ip address

Modify IP using command
Open the network card configuration file VIM / etc / sysconfig / network scripts / ifcfg-ens32

DNS2=192.168.1.1 is added here because some routers have their own DNS forwarding function

Question 1: if you still can't ping Baidu after setting it, what's the reason?

If there is no problem with DNS and network, another possibility is that 360 guard has turned on the LAN stealth function. As long as you enter 360 guard - traffic Firewall - LAN protection, just turn off LAN stealth.

2. Turn off the firewall and set automatic shutdown after startup
[root@localhost ~]# Systemctl  status  firewalld  #View service running status

[root@localhost ~]# systemctl stop firewalld closes the current protective wall
[root@localhost ~]# systemctl disable firewalld automatic shutdown after startup
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.

3. Set selinux to turn off automatically after startup
1) Temporary closure
[root@centos7-test1 ~]# setenforce 0

2) Automatic shutdown after startup

vim /etc/sysconfig/selinux

4. Set the CD to mount automatically after startup

[root@localhost ~]# echo "/dev/sr0 /mnt iso9660 defaults 0 0" >> /etc/fstab


mount -a mount all

5. Configure the local yum source

All configuration information about Yum is stored in a file called yum repos. The configuration file of D is usually located in the / etc directory, which is the top priority of the whole Yum system
Delete existing files
rm -rf /etc/yum.repo.d/*

[root@centos7-test1 yum.repos.d]# pwd
/etc/yum.repos.d

[root@centos7-test1 yum.repos.d]# cat rhel7.repo 
[rhel7]
name=rhel7
baseurl=file:///mnt
enabled=1
gpgcheck=0
[root@centos7-test1 yum.repos.d]# 

Explanation:
[rhel7 source] name
Name = RHEL server description
baseurl=file:///mnt (system disk) file path
enabled=1 enabled
gpgcheck=0 cancel validation

summary

1. Fixed networking IP address
2. Turn off firewall
3. Close selinux
4. CD auto mount
5. Configure the local yum source

Next, create a snapshot for easy use

This article is from ID: Internet old Xin more content is concerned about the official account of the "geek operation and maintenance home".

Topics: Linux