首页 > 其他 > 详细

最小化CentOS安装后的基础优化

时间:2020-05-20 19:20:56      阅读:36      评论:0      收藏:0      [点我收藏+]

一、安装完成后基础配置

1、修改IP地址

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 

TYPE=Ethernet
BOOTPROTO=static
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.11.12
NETMASK=255.255.255.0
GATEWAY=192.168.11.2
DNS1=180.76.76.76

2、配置光盘自动挂载

#虚拟机先连接光盘,再配置以下
[root@localhost ~]# vim /etc/fstab 
#添加以下行
/dev/sr0                /mnt/cdrom              iso9660 defaults        0 0

3、配置YUM源

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# mv *.repo bak/
[root@localhost yum.repos.d]# vi base.repo 
[development]
name=dvdbase repo
baseurl=file:///mnt/cdrom/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-7

[aliyunEpel]
name=aliyun epel
baseurl=https://mirrors.aliyun.com/epel/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-$releasever

4、安装基础命令

[root@localhost ~]# yum install  -y 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

5、配置时间同步

[root@localhost ~]# yum install -y chrony
[root@localhost ~]# vim /etc/chrony.conf 
#注释centos的时间同步节点,添加aliyun的
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
#下面行的注释去掉
local stratum 10

[root@localhost ~]# systemctl start chronyd
[root@localhost ~]# systemctl enable chronyd

6、禁用SELinux

[root@localhost ~]# sed -ri s/SELINUX=enforcing/SELINUX=disabled/ /etc/sysconfig/selinux 

#或vim打开
/etc/sysconfig/selinux修改 [root@localhost ~]# vim /etc/sysconfig/selinux #SELINUX=enforcing改为disabled,如下 SELINUX=disabled

7、禁用防火墙

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

8、关闭虚拟机、做快照

[root@localhost ~]# shutdown -h now

 

最小化CentOS安装后的基础优化

原文:https://www.cnblogs.com/hovin/p/12925034.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!