[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
#虚拟机先连接光盘,再配置以下 [root@localhost ~]# vim /etc/fstab #添加以下行 /dev/sr0 /mnt/cdrom iso9660 defaults 0 0
[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
[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
[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
[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
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# shutdown -h now
原文:https://www.cnblogs.com/hovin/p/12925034.html