Table of Contents
1. Network configuration
2.2 Turn off the firewall
2.1 Check the firewall
2.3 Disable the firewall from starting at boot
3. Close SELINUX
4. Change the YUM source
4.1 Backup
4.2 Download the new CentOS-Base.repo to /etc/yum.repos.d/
4.3 Configure epel source
4.4 Run yum makecache to generate cache
5. Basic software Tool installation
Home Operation and Maintenance CentOS Detailed explanation of CentOS7 system initialization settings

Detailed explanation of CentOS7 system initialization settings

Jan 05, 2021 pm 04:54 PM
centos

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
Copy after login

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
Copy after login

2. Turn off the firewall

2.1 Check the firewall

# systemctl status firewalld.service
Copy after login
[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.

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

2.2 Turn off the firewall

# systemctl stop firewalld.service
Copy after login
[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.

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

2.3 Disable the firewall from starting at boot

# systemctl enable firewalld.service    启用  
# systemctl disable firewalld.service   禁用
Copy after login
[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.
Copy after login

3. Close SELINUX

[root@leanote ~]# setenforce 0      临时关闭
Copy after login

Permanently close the configuration file that needs to modify SELINUX/etc/selinux/config

将SELINUX=enforcing 改为 SELINUX=disable
Copy after login
[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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

4.4 Run yum makecache to generate cache

# yum clean all
# yum makecache
# yum repolist
Copy after login

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
Copy after login

Minimal installation without ifconfig command solution

# yum search ifconfig
# yum install -y net-tools
# yum provides ifconfig
Copy after login

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
Copy after login

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 of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the backup methods for GitLab on CentOS What are the backup methods for GitLab on CentOS Apr 14, 2025 pm 05:33 PM

Backup and Recovery Policy of GitLab under CentOS System In order to ensure data security and recoverability, GitLab on CentOS provides a variety of backup methods. This article will introduce several common backup methods, configuration parameters and recovery processes in detail to help you establish a complete GitLab backup and recovery strategy. 1. Manual backup Use the gitlab-rakegitlab:backup:create command to execute manual backup. This command backs up key information such as GitLab repository, database, users, user groups, keys, and permissions. The default backup file is stored in the /var/opt/gitlab/backups directory. You can modify /etc/gitlab

How to optimize CentOS HDFS configuration How to optimize CentOS HDFS configuration Apr 14, 2025 pm 07:15 PM

Improve HDFS performance on CentOS: A comprehensive optimization guide to optimize HDFS (Hadoop distributed file system) on CentOS requires comprehensive consideration of hardware, system configuration and network settings. This article provides a series of optimization strategies to help you improve HDFS performance. 1. Hardware upgrade and selection resource expansion: Increase the CPU, memory and storage capacity of the server as much as possible. High-performance hardware: adopts high-performance network cards and switches to improve network throughput. 2. System configuration fine-tuning kernel parameter adjustment: Modify /etc/sysctl.conf file to optimize kernel parameters such as TCP connection number, file handle number and memory management. For example, adjust TCP connection status and buffer size

Centos stops maintenance 2024 Centos stops maintenance 2024 Apr 14, 2025 pm 08:39 PM

CentOS will be shut down in 2024 because its upstream distribution, RHEL 8, has been shut down. This shutdown will affect the CentOS 8 system, preventing it from continuing to receive updates. Users should plan for migration, and recommended options include CentOS Stream, AlmaLinux, and Rocky Linux to keep the system safe and stable.

Centos shutdown command line Centos shutdown command line Apr 14, 2025 pm 09:12 PM

The CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.

What are the common misunderstandings in CentOS HDFS configuration? What are the common misunderstandings in CentOS HDFS configuration? Apr 14, 2025 pm 07:12 PM

Common problems and solutions for Hadoop Distributed File System (HDFS) configuration under CentOS When building a HadoopHDFS cluster on CentOS, some common misconfigurations may lead to performance degradation, data loss and even the cluster cannot start. This article summarizes these common problems and their solutions to help you avoid these pitfalls and ensure the stability and efficient operation of your HDFS cluster. Rack-aware configuration error: Problem: Rack-aware information is not configured correctly, resulting in uneven distribution of data block replicas and increasing network load. Solution: Double check the rack-aware configuration in the hdfs-site.xml file and use hdfsdfsadmin-printTopo

How to check CentOS HDFS configuration How to check CentOS HDFS configuration Apr 14, 2025 pm 07:21 PM

Complete Guide to Checking HDFS Configuration in CentOS Systems This article will guide you how to effectively check the configuration and running status of HDFS on CentOS systems. The following steps will help you fully understand the setup and operation of HDFS. Verify Hadoop environment variable: First, make sure the Hadoop environment variable is set correctly. In the terminal, execute the following command to verify that Hadoop is installed and configured correctly: hadoopversion Check HDFS configuration file: The core configuration file of HDFS is located in the /etc/hadoop/conf/ directory, where core-site.xml and hdfs-site.xml are crucial. use

Centos install mysql Centos install mysql Apr 14, 2025 pm 08:09 PM

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.

How to install mysql in centos7 How to install mysql in centos7 Apr 14, 2025 pm 08:30 PM

The key to installing MySQL elegantly is to add the official MySQL repository. The specific steps are as follows: Download the MySQL official GPG key to prevent phishing attacks. Add MySQL repository file: rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm Update yum repository cache: yum update installation MySQL: yum install mysql-server startup MySQL service: systemctl start mysqld set up booting

See all articles