CenOS6.7没法上网
1.将网络链接模式设置成NAT模式,不能设置成仅主机模式 2.查看IP网段与网关网段是否一致, 若是不一致:将IP网段设置成与网管网段一致 3.将ONBOOT设置成yes 4.将网关设置成与非虚拟机不一样的网关地址, 如:非虚拟机地址为192.168.179.1,那么虚拟机的地址应改成192.168.179.2(除192.168.179.1之外的地址) 5.编辑->虚拟网络编辑器->NAT模式->NAT设置,将网关设置成与4中的网关地址一致
网卡eth0启动失败
1.查看/etc/sysconfig/network-scripts/ifcfg-eth0下和/etc/udev/rules.d/70-perisitent-net.rules的HWADDR值是否一致,若不一致,则修改HWADDR的值.以70-perisitent-net.rules下的ATTR{address}值为准. 2.查看/etc/udev/rules.d/70-perisitent-net.rules文件,将不是eth0的网卡注释或者删除 3.而后重启网卡 注意:记得配置DNS
设置虚拟机与系统时间同步问题
在安装完CentOS系统后发现时间与如今时间相差8小时,这是因为咱们在安装系统的时选择的时区是上海,
而CentOS默认bios时间是utc时间,因此时间相差了8小时。这个时候的bios的时间和系统的时间是不一致的,一个表明 utc 时间,一个表明cst(+8时区),即上海时间linux
下面是同步时间的解决方法:
1.编辑文件/etc/sysconfig/clock文件ios
sudo vi /etc/sysconfig/clock
ZONE="Asia/Shanghai" #将时区设为上海 UTC=false #设置为false,硬件时钟不于utc时间一致 ARC=false
2.将linux的时区设置为上海时区shell
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
3.对准时间,须要先安装ntp服务器centos
yum install ntp
sudo ntpdate asia.pool.ntp.org
4.设置硬件时间和系统时间一致并校准服务器
sudo /sbin/hwclock --systohc
至此,linux系统时间和计算机硬件时间都是cst时间了,而且为上海时区。网络
配置主从节点NTP服务
1.安装NTP服务app
yum install ntp
2.配置NTP服务, prefer意味着首选IP地址,在主节点设置对准 65.55.56.206 时间,从节点设置主节点IP编辑器
vi /etc/ntp.conf
主: server 65.55.56.206 prefer server 0.asia.pool.ntp.org server 1.asia.pool.ntp.org server 2.asia.pool.ntp.org
副: server m1 prefer #m1为主节点IP
3.设置开机启动NTP服务ui
chkconfig ntpd on
4.检查是否设置成功,其中2-5为on状态就表明成功阿里云
chkconfig --list ntpd
启动linux时, 没法进入系统, 显示错误:
Kernel panic - not syncing: Attemted to kill init! Pid 1, comm: init not tainted 2.6.32-358.e16.x86_64 #1 Call Trace: [<ffffffff8150cfc8>] ? panic+0xa7/0/0x16f [<ffffffff81073ae2>] ? do_exit+0xa7862/0x870 [<ffffffff81182885>] ? fput+0x25/0x870 [<ffffffff81073b48>] ? do+group_exit+0x58/0x20 [<ffffffff81073bd7>] ? sys_exit_group+0x17/0x20 [<ffffffff8100b072>] ? system_call_fastpath+0x16/0x161b
1.系统启动的时候,倒数三秒内按下'e'
键进入grub编辑界面,编辑grub
菜单,选择"kernel /vmlinuz-2.6.23.1-42.fc8 ro root=/dev/vogroup00/logvol00 rhgb quiet"
一栏,按'e'
键进入编辑,在末尾增长enforcing=0
,即:
kernel /vmlinuz-2.6.23.1-42.fc8 ro root=/dev/vogroup00/logvol00 rhgb quiet enforcing=0
而后回车, 按下"b"
重启Linux
2.在重启linux以后, 输入用户名密码进入系统, 而后修改/etc/selinux/config配置文件, 即:
vi /etc/selinux/config
SELINUX=disabled
而且在控制台输入如下命令:
setenforce 0
3.修改(2)中这两项以后, 再次重启Linux.
当虚拟机没法ping通主机时
控制面板-> 网络和Internet-> 网络共享中心-> Windows防火墙-> 高级设置-> 入站规则-> 选择"文件和打印共享(回显请求 – ICMPv4-In" "公用和专用"项, 禁用规则(默认为启动规则)
在yum运行时强制关闭,后启动yum报错
[centos@h1 ~]$ sudo yum search parquet Loaded plugins: fastestmirror, refresh-packagekit, security Existing lock /var/run/yum.pid: another copy is running as pid 4292. Another app is currently holding the yum lock; waiting for it to exit... The other application is: yum Memory : 24 M RSS (863 MB VSZ) Started: Mon Dec 5 23:45:51 2016 - 09:56 ago State : Traced/Stopped, pid: 4292
rm -f /var/run/yum.pid
yum下载慢或yum没法下载
更换yum源
163 <=> wget http://centos.ustc.edu.cn/CentOS-Base.repo 搜狐 <=> wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo 阿里云 <=> wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 网易 <=> wget http://mirrors.163.com/.help/CentOS-Base-163.repo
(1) cd /etc/yum.repos.d (2) mv CentOS-Base.repo CentOS-Base.repo.backup (3) wget http://mirrors.163.com/.help/CentOS6-Base-163.repo (4) mv CentOS6-Base-163.repo CentOS-Base.repo (5) yum clean all (6) yum makecache
linux扩展磁盘空间
http://www.jianshu.com/p/ba7090b1ef38
报错信息以下:
crontab中启动的shell脚本不能正常运行,可是使用手动执行没有问题
在脚本第一行写上source /etc/profile,由于cront进程不会自动加载用户目录下的.profile文件