search
HomeOperation and MaintenanceCentOSDetailed explanation of CentOS7 system initialization settings

The following tutorial column of centos will 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


1. Network configuration

Use the nmtui graphical 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

2. Turn off the firewall

2.1 Check the firewall

# 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.

- 此状态表示防火墙处于开启状态 -

2.2 Turn off the firewall

# 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.

- 此状态表示防火墙处于关闭状态 -

2.3 Disable the firewall from starting at boot

# 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.

3. Close SELINUX

[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

4. Change the YUM source

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

4.1 Backup

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

4.2 Download the new CentOS-Base.repo to /etc/yum.repos.d/

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

4.3 Configure epel source

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

4.4 Run yum makecache to generate cache

# yum clean all
# yum makecache
# yum repolist

5. Basic software Tool installation

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!

Statement
This article is reproduced at:cnblogs. If there is any infringement, please contact admin@php.cn delete
CentOS: An Explanation of the Decision-Making ProcessCentOS: An Explanation of the Decision-Making ProcessApr 25, 2025 am 12:03 AM

CentOS is suitable as an enterprise-class server operating system because it is stable, secure and free. 1) It is based on RHEL and provides high compatibility with RHEL. 2) Use yum for package management to ensure that the software is easy to install and update. 3) The community regularly releases security patches, with a support cycle of up to 10 years.

The Discontinuation of CentOS: Understanding the FactorsThe Discontinuation of CentOS: Understanding the FactorsApr 24, 2025 am 12:01 AM

The reason why CentOS stopped maintaining is RedHat's strategic change. User response strategies include: 1. Migrating to other distributions, such as UbuntuServer, Debian or RockyLinux; 2. Continue to use CentOS7 until June 2024; 3. Turning to CentOSStream; 4. Build solutions, such as custom distributions based on RHEL or using container technology.

CentOS: What Led to the Decision to End SupportCentOS: What Led to the Decision to End SupportApr 23, 2025 am 12:10 AM

RedHatendedsupportforCentOStoshifttowardsacommerciallyfocusedmodelwithCentOSStream.1)CentOStransitionedtoCentOSStreamforRHELdevelopment.2)ThisencourageduserstomovetoRHEL.3)AlternativeslikeAlmaLinux,RockyLinux,andOracleLinuxemergedasreplacements.

Using CentOS: A Guide for System AdministratorsUsing CentOS: A Guide for System AdministratorsApr 22, 2025 am 12:04 AM

CentOS is an open source operating system based on RedHatEnterpriseLinux, suitable for server environments. 1. Select the appropriate media and options during installation and configure network, firewall and user permissions. 2. Use useradd, usermod and systemctl commands to manage users and services, and update software packages regularly. 3. Basic operations include using yum installation software and systemctl management services, and advanced features such as SELinux to enhance security. 4. Check the system log to solve common errors. Optimizing performance requires monitoring resources and cleaning of unnecessary files.

CentOS: Security, Stability, and PerformanceCentOS: Security, Stability, and PerformanceApr 21, 2025 am 12:11 AM

CentOS is the first choice for server and enterprise environments for its superior security, stability and performance. 1) Security provides forced access control through SELinux to improve system security. 2) Stability is supported by the LTS version for up to 10 years to ensure the stability of the system. 3) Performance significantly improves system response speed and resource utilization by optimizing kernel and system configuration.

The CentOS Replacement Landscape: Current Trends and ChoicesThe CentOS Replacement Landscape: Current Trends and ChoicesApr 20, 2025 am 12:05 AM

CentOS alternatives should have the characteristics of stability, compatibility, community support and package management. 1.AlmaLinux provides 10 years of support, 2. RockyLinux is initiated by the founder of CentOS to ensure compatibility with CentOS. Migration cost and performance optimization should be considered when choosing.

CentOS: An Introduction to the Linux DistributionCentOS: An Introduction to the Linux DistributionApr 19, 2025 am 12:07 AM

CentOS is an open source distribution based on RedHatEnterpriseLinux, focusing on stability and long-term support, suitable for a variety of server environments. 1. The design philosophy of CentOS is stable and suitable for web, database and application servers. 2. Use YUM as the package manager to release security updates regularly. 3. Simple installation, you can build a web server with a few commands. 4. Advanced features include enhanced security using SELinux. 5. Frequently asked questions such as network configuration and software dependencies can be debugged through nmcli and yumdeplist commands. 6. Performance optimization suggestions include tuning kernel parameters and using a lightweight web server.

CentOS in Action: Server Management and Web HostingCentOS in Action: Server Management and Web HostingApr 18, 2025 am 12:09 AM

CentOS is widely used in server management and web hosting. Specific methods include: 1) using yum and systemctl to manage the server, 2) install and configure Nginx for web hosting, 3) use top and mpstat to optimize performance, 4) correctly configure the firewall and manage disk space to avoid common problems.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software