Centos7 Minimal version basic configuration record

Before setting up a test environment, you need to install a clean virtual machine first. However, after the Centos7 Minimal version is quickly installed, you need to configure: network, domestic sources, some basic tools (net-tools, vim), etc. to connect and use remotely . Record it for quick configuration and use next time.

Table of contents

1. Network configuration:

2. Change source

3. Install net-tools, vim, epel-release

4. Turn off the firewall and turn off autostart

5. Change the host name (required when building a cluster


1. Network configuration:

The minimal version does not have ipv4: no ip address is displayed in CentOS7_Wayfreem's Blog-CSDN Blog

Configure DNS: Linux Centos7 network configuration cannot ping the external network, internal network and gateway - Programmer Sought

// 第一步输入,查看网卡的名称
ip addr

// 第二步修改,网卡的配置文件,先切换到对应的路径
cd  /etc/sysconfig/network-scripts/

// 修改文件中的 ONBOOT 对应的值改为 yes,保存退出
vi ifcfg-ens33

// 配置固定ip
BOOTPROTO=static
IPADDR=192.168.139.110
NETMASK=255.255.255.0
GATEWAY=192.168.139.2
取消networkmanager 管理
NM_CONTROLLED=no
       

// 重启网络服务
service network restart

//配置 dns
//切到networkmanager目录
cd /etc/NetworkManager
//修改 NetworkManager.conf配置文件,在最后添加
dns=none
//修改resolv.conf,新增dns配置 
vi /etc/resolv.conf
// 添加:
#主DNS
nameserver 8.8.8.8
#备DNS
nameserver 114.114.114.114

// 重启网络服务
systemctl restart network       

2. Change source

Reference: Linux Centos7-change source_Manba_77's blog-CSDN blog_centos7 change source

(1) Install wget first

yum install -y  wget

If an error is reported: 

Solution: linux yum install **** Tip: Loaded plugins: fastestmirror_Mr. Xu Paul's Blog-CSDN Blog

// 1.修改插件的配置文件   enabled = 1 #由1改为0,禁用该插件
vi /etc/yum/pluginconf.d/fastestmirror.conf

//2. 修改yum的配置文件   plugins=1 #改为0,不使用插件
vi /etc/yum.conf

//3 清除缓存并重新构建yum 源
yum clean all
yum clean dbcache
yum makecache

(2) Change to Aliyuan

// 1. 备份原来的源
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bk

// 2. 下载阿里源
cd /etc/yum.repos.d

sudo wget -nc http://mirrors.aliyun.com/repo/Centos-7.repo

// 3.更改阿里yum源为默认源
sudo mv Centos-7.repo CentOS-Base.repo

// 4.更新本地yum缓存
# 全部清除
sudo yum clean all
# 更新列表
sudo yum list
# 缓存yum包信息到本机,提高搜索速度
sudo yum makecache

3. Install net-tools, vim, epel-release

yum -y install net-tools

yum -y install vim

yum install -y epel-release

(Note: Extra Packages for Enterprise Linux is to provide additional software packages for the "Red Hat" operating system, applicable to RHEL, CentOS and Scientific Linux. It is equivalent to a software warehouse, and most rpm packages cannot be found in the official repository arrived)

4. Turn off the firewall and turn off autostart

systemctl stop firewalld
systemctl disable firewalld.service
// 查看防火墙状态(Active: inactive (dead))
systemctl status firewalld

5. Change the host name (required when building a cluster)

// newname 为要改的名字
hostnamectl set-hostname hadoop101
// 改完后需要重启
reboot

//修改前:
[root@localhost ~]#
// 修改后:
[root@hadoop101 ~]#

 

Guess you like

Origin blog.csdn.net/qq_42183414/article/details/128673002