Centos 8 常用基础配置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos 8 常用基础配置相关的知识,希望对你有一定的参考价值。

参考技术A $ sudo vi /etc/hostname
改为正确机器名,重启生效

$ sudo vi /etc/sysconfig/network-scripts/ifcfg-xxxx #对应的网卡名

$ sudo vi /etc/chrony.conf

$ sudo systemctl restart chronyd #重启服务
$ chronyc tracking #检查结果

$ sudo sestatus #查看状态
$ sudo setenforce 0 #临时关闭
$ sudo vi /etc/selinux/config #永久关闭

重启生效

centos基础环境配置

1.常用软件安装

yum install  vim iotop bc gcc gcc-c++ glibc glibc-devel pcre \\
pcre-devel openssl openssl-devel zip unzip zlib-devel net-tools \\
lrzsz tree ntpdate telnet lsof tcpdump wget libevent libevent-devel \\
bc systemd-devel bash-completion traceroute firewalld bridge-utils -y

2.CentOS Linux release 7.2.1511 (Core) 修改网卡名

原网卡名为:ifcfg-eno16777736

#1.
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# mv eno16777736 ifcfg-eth0
[root@localhost network-scripts]# vi ifcfg-eth0
NAME=eth0 #修改
DEVICE=eth0 #修改

#2.
[root@localhost ~]# vim /etc/sysconfig/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

#3.
[root@localhost ~]# cd /etc/udev/rules.d
[root@localhost ~]# vi 70-persistent-net.rules
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTRaddress=="00:0c:29:44:17:2b",ATTR{type}=="1" ,KERNEL=="eth*",NAME="eth0"
00:0c:29:44:17:2b #为Mac地址

#4.
[root@localhost ~]# reboot

3.内核版本查看

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

 ​4.关闭防火墙/NetworkManager/selinux

#1.
systemctl stop firewalld && systemctl disable firewalld

#2.
systemctl stop NetworkManager && systemctl disable NetworkManager

#3.
sed -i -r s@(^SELINUX=).*$@\\1disabled@ /etc/selinux/config

5.常用yum源

#CentOS 5
wget -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

#CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo



















以上是关于Centos 8 常用基础配置的主要内容,如果未能解决你的问题,请参考以下文章

Linux基础环境_安装配置教程(CentOS7.2 64JDK1.8Tomcat8)

centos基础环境配置

Linux基础

Centos7基础设置

基于RHEL8/CentOS8的网络基础配置

Linux系统安装与使用基础之第一篇安装并配置Linux(CentOS 7)操作系统