一、启动、关闭、重置服务 (rhel7 为 systemctl)
linux
[root@rhel-6 ~]# service atd status #关闭atd服务 atd 已停[root@rhel-6 ~]# service atd start #启动atd服务正在启动 atd: [肯定][root@rhel-6 ~]# service atd stop #中止atd服务中止 atd: [肯定][root@rhel-6 ~]# service atd restart #重启atd服务中止 atd: [失败]正在启动 atd: [肯定][root@rhel-6 ~]# service atd reload #重置atd服务 中止 atd: [肯定]正在启动 atd: [肯定]
[root@rhel-6 ~]# chkconfig atd on #设置atd服务开机自启[root@rhel-6 ~]# chkconfig --list atd #查看atd服务各启动级别开机启动状况atd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭[root@rhel-6 ~]# chkconfig atd off #设置atd服务不开机自启[root@rhel-6 ~]# chkconfig --list atd #查看atd服务各启动级别开机启动状况atd 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭
三、清空iptables (关闭防火墙)
windows
[root@rhel-6 ~]# iptables -F #清空防火墙配置[root@rhel-6 ~]# service iptables save #保存防火墙配置iptables:将防火墙规则保存到 /etc/sysconfig/iptables: [肯定][root@rhel-6 ~]# chkconfig iptables off #关闭防火墙自启[root@rhel-6 ~]# chkconfig --list iptables #检查自启状况iptables 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭
[root@rhel-6 ~]# getenforce #检查selinux状态Enforcing #Enforcing 启动状态[root@rhel-6 ~]# vim /etc/selinux/config #修改selinux配置文件# disabled - No SELinux policy is loaded.SELINUX=Disabled #修改成Disabled 并保存# SELINUXTYPE= can take one of these two values:[root@rhel-6 ~]# init 6 #重启后使关闭生效
五、主机名配置
网络
[root@rhel-6 ~]# vim /etc/hosts
六、光盘自动挂载
阿里云
[root@rhel-6 ~]# df -h #df -h 查看挂载状况Filesystem Size Used Avail Use% Mounted on/dev/sda2 20G 4.5G 15G 24% /tmpfs 2.0G 0 2.0G 0% /dev/shm/dev/sda1 194M 34M 150M 19% /boot/dev/sr0 3.6G 3.6G 0 100% /mnt[root@rhel-6 ~]# echo "/dev/sr0 /mnt iso9660 defaults 0 0" >> /etc/fstab #在/etc/fstab 配置文件添加echo ""的内容
七、YUM本地源和网络源
url
[root@rhel-6 ~]# cat /etc/yum.repos.d/rhel-source.repo [rhel6-source] #yum名称 随便取name=rhel-source #yum名称2 随便取baseurl=file:///mnt #yum源路径,/mnt 是光盘挂载点enabled=1 #=1 表示启用此源gpgcheck=0 #=0表示不检查[root@rhel-6 ~]# yum clean all #清空yum缓存[root@rhel-6 ~]# yum list #生成新缓存
- #配置网络源
[root@xuegod63 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo #163的源 [root@xuegod63 ~]# sed -i 's/$releasever/6.8/g' /etc/yum.repos.d/CentOS-Base.repo [root@xuegod63 ~]# yum clean all [root@xuegod63 ~]# yum list
[root@xuegod63 ~]# yum list[root@xuegod63 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo #阿里云的源[root@xuegod63 ~]# sed -i 's/$releasever/6.8/g' /etc/yum.repos.d/CentOS-Base.repo
八、网络配置
spa
[root@rhel-6 ~]# setup #setup进入图形配置界面[root@rhel-6 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 #修改网卡配置文件
九、克隆后工做--修改主机名
rest
[root@rhel-6 ~]# vim /etc/sysconfig/network #RHEL6版本修改主机名[root@rhel7-14 ~]# hostnamectl set-hostname rhel7-14.com #RHEL7版本修改主机名 后面接新主机名 [root@rhel7-14 ~]# hostnamectl status #RHEL7 查看主机名信息 Static hostname: rhel7-14.com Icon name: computer-vm Chassis: vm Machine ID: 5ed0276bb5324c97bdbcd0ec2bf59834 Boot ID: c5ea02318bbe4137a2558b4420a266a6 Virtualization: vmware Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo) CPE OS Name: cpe:/o:redhat:enterprise_linux:7.2:GA:server Kernel: Linux 3.10.0-327.el7.x86_64 Architecture: x86-64[root@rhel-6 ~]# rm /etc/udev/rules.d/70-persistent-net.rules #删除此网络缓存文件。里面有MAC记录