Home>Article>Operation and Maintenance> Detailed explanation of CentOS7 system initialization settings
The following tutorial column ofcentoswill introduce you to the CentOS7 system initialization settings. I hope it will be helpful to friends in need!
CentOS7 system initialization settings
March 07, 2019
System version: CentOS Linux release 7.3-1611
Use thenmtuigraphical tool to configure the IP address and host name
IP:192.168.82.103/24 主机名:leanote.jmkf.com
You can also change the configuration file
[root@leanote ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens32 TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens32 UUID=eb220f0e-779d-48c6-8e1b-093b2f9eff0f DEVICE=ens32 ONBOOT=yes IPADDR=192.168.55.58 PREFIX=24 IPADDR1=192.168.82.103 PREFIX1=24 GATEWAY=192.168.82.254 DNS1=192.168.94.201 IPV6_PEERDNS=yes IPV6_PEERROUTES=yes
# systemctl status firewalld.service
[root@leanote ~]# systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: active (running) since 五 2017-12-29 12:10:34 CST; 3s ago Docs: man:firewalld(1) Main PID: 11473 (firewalld) CGroup: /system.slice/firewalld.service └─11473 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid 12月 29 12:10:33 leanote.jmkf.com systemd[1]: Starting firewalld - dynamic firewall daemon... 12月 29 12:10:34 leanote.jmkf.com systemd[1]: Started firewalld - dynamic firewall daemon. - 此状态表示防火墙处于开启状态 -
# systemctl stop firewalld.service
[root@leanote ~]# systemctl stop firewalld.service [root@leanote ~]# systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1) 12月 29 12:10:33 leanote.jmkf.com systemd[1]: Starting firewalld - dynamic firewall daemon... 12月 29 12:10:34 leanote.jmkf.com systemd[1]: Started firewalld - dynamic firewall daemon. 12月 29 13:43:31 leanote.jmkf.com systemd[1]: Stopping firewalld - dynamic firewall daemon... 12月 29 13:43:31 leanote.jmkf.com systemd[1]: Stopped firewalld - dynamic firewall daemon. - 此状态表示防火墙处于关闭状态 -
# systemctl enable firewalld.service 启用 # systemctl disable firewalld.service 禁用
[root@leanote ~]# systemctl enable firewalld.service Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service. Created symlink from /etc/systemd/system/basic.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service. ----------------------------------------------------------------------------------------------------------------- [root@leanote ~]# systemctl disable firewalld.service Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@leanote ~]# setenforce 0 临时关闭
Permanently close the configuration file that needs to modify SELINUX/etc/selinux/config
将SELINUX=enforcing 改为 SELINUX=disable
[root@leanote ~]# vi /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 - No SELinux policy is loaded. #SELINUX=enforcing SELINUX=disable # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
You can choose Alibaba Cloud, NetEase Cloud, other websites or intranet yum sources
Back up the files under /etc/yum.repos.d/ and download the corresponding repo files
https:// opsx.alibaba.com/mirror
Back up all
# mkdir /etc/yum.repos.d/bak # mv /etc/yum.repos.d/* /etc/yum.repos.d/bak
or only back up the CentOS-Base.repo file
# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
CentOS 5
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo 或者 # curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 或者 # curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 或者 # curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
epel(RHEL 7) wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo epel(RHEL 6) wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo epel(RHEL 5) wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo
# yum clean all # yum makecache # yum repolist
Install common software and tools through the configured YUM library
# yum install -y vim # yum install -y wget # yum install -y lrzsz
Minimal installation without ifconfig command solution
# yum search ifconfig # yum install -y net-tools # yum provides ifconfig
Command paste
nmtui systemctl stop firewalld.service systemctl disable firewalld.service setenforce 0 vi /etc/selinux/config SELINUX=disable mkdir /etc/yum.repos.d/bak mv /etc/yum.repos.d/* /etc/yum.repos.d/bak curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum clean all yum makecache yum repolist yum install -y vim yum install -y wget yum install -y lrzsz yum install -y net-tools
For more programming-related knowledge, please visit:Programming Teaching! !
The above is the detailed content of Detailed explanation of CentOS7 system initialization settings. For more information, please follow other related articles on the PHP Chinese website!