ntpdate同步时间,时间跳跃,引起服务中断。
计划任务
#
0 4 * * * /usr/sbin/ntpdate 10.200.3.71
日志
#
Dec 30 04:00:01 localhost systemd: Created slice user-0.slice.
Dec 30 04:00:01 localhost systemd: Starting user-0.slice.
Dec 30 04:00:01 localhost systemd: Started Session 16 of user root.
Dec 30 04:00:01 localhost systemd: Starting Session 16 of user root.
Dec 29 20:09:59 localhost systemd: Time has been changed
Dec 29 20:09:59 localhost systemd: Removed slice user-0.slice.
Dec 29 20:09:59 localhost systemd: Stopping user-0.slice.
故障
#
因为跳跃的时间太大,导致系统的各种服务中断(网络中断和systemctl管理的服务也有问题)。
...错误提示
#
warning: rabbitmq-server-3.6.6-1.el6.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 6026dfca: NOKEYerror: Failed dependencies:
erlang >= R16B-03 is needed by rabbitmq-server-3.6.6-1.el6.noarch
socat is needed by rabbitmq-server-3.6.6-1.el6.noarch
解决方法
#
cd /etc/yum.repos.d/
cat erlang.repo
[erlang-solutions]
name=Centos $releasever - $basearch - Erlang Solutions
baseurl=http://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch
gpgcheck=0
gpgkey=http://packages.erlang-solutions.com/debian/erlang_solutions.asc
enabled=1
然后再安装rabbitmq
yum localinstall rabbitmq-server-3.6.6-1.el6.noarch.rpm
其他问题
#
# /etc/init.d/rabbitmq-server start
Starting rabbitmq-server: FAILED - check /var/log/rabbitmq/startup_{log, _err}
rabbitmq-server.
# vim /var/log/rabbitmq/startup_err
init terminating in do_boot (noproc)
Crash dump is being written to: erl_crash.dump...done
如果出现以上问题,说明erlang和rabbitmq的版本不相符。只能重新安装erlang了。
...在Linux Bash中分别使用basename、dirname、${},提取文件名和目录名。
通过变量方式
#
${}用于字符串的读取,提取和替换功能,可以使用${} 提取字符串
...htpasswd默认使用crypt()加密,创建的密码只有前8位有效
问题
#
htpasswd -c /etc/nginx/.htpasswd test
假如,密码为abcd12345
那么在登录的时候,不管是输入“abcd1234”、”abcd12345“或”abcd123456789sdjkal“ 都能通过验证。
...解决Nginx的connect() to xxx failed (13: Permission denied) 和 Nginx 403 forbidden 错误
查看SeLinux状态
#
getenforce
如果是enabled则继续往下看。
临时关闭(不需要重启机器)
#
setenforce 0
修改配置
#
vim /etc/selinux/config #将SELINUX=enforcing改为SELINUX=disabled
如果你执行了临时关闭SeLinux并机器上跑了重要的业务,那可以不需要马上重启机器,等待下次重启配置生效即可。
...安装软件
#
yum install -y xinetd rdate
修改配制
#
vim /etc/xinetd.d/time-stream
# 将disable = yes 改为 disable = no
启动服务
#
# 启动xinetd
systemctl start xinetd
# 添加开启启动
systemctl enable xinetd
同步时间
#
服务端
#
首先在服务端执行以下命令(到底哪个是服务端呢?就是你在哪台机器上面执行了以上三个步骤就是服务端),在服务端上同步网络标准时间,然后再同步到内网各台机器上。
...查看内核
#
cat /boot/grub2/grub.cfg |grep menuentry
menuentry 'CentOS Linux (3.10.0-327.36.3.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-80b9b662-0a1d-4e84-b07b-c1bf19e72d97' {
menuentry 'CentOS Linux (3.10.0-327.22.2.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-80b9b662-0a1d-4e84-b07b-c1bf19e72d97' {
menuentry 'CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-80b9b662-0a1d-4e84-b07b-c1bf19e72d97' {
menuentry 'CentOS Linux (0-rescue-7d26c16f128042a684ea474c9e2c240f) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-7d26c16f128042a684ea474c9e2c240f-advanced-80b9b662-0a1d-4e84-b07b-c1bf19e72d97'
修改默认
#
grub2-set-default "CentOS Linux (3.10.0-327.22.2.el7.x86_64) 7 (Core)"
查看生效
#
grub2-editenv list
saved_entry=CentOS Linux (3.10.0-327.22.2.el7.x86_64) 7 (Core)
准备环境
#
首先查看系统是否支持pptpd服务:
#
modprobe ppp-compress-18 && echo yes
安装ppp , pptpd,iptables
#
yum install -y ppp pptpd iptables
systemctl mask firewalld
systemctl stop firewalld
修改配制
#
vi /etc/pptpd.conf #找到配制文件中默认的值,去掉注释即可
localip 192.168.0.1 #本机VPN IP
remoteip 192.168.0.234-238,192.168.0.245 客户端可以获取到的ip网段
#修改DNS
vi /etc/ppp/options.pptpd #末尾添加dns
ms-dns 8.8.8.8
ms-dns 114.114.114.114
#添加vpn账户
vi /etc/ppp/chap-secrets
# client server secret IP addresses
user pptpd passwd *
#开启路由转发
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1 #添加在配制文件的末尾即可
sysctl -p #运行这个命令会输出上面添加的那一行信息,意思是使内核修改生效
#在防火墙上开启nat转发
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE #IP和网口根据实际情况修改即可
开启服务
#
service iptables save
systemctl restart iptables
systemctl restart pptpd
内核模块
#
通过modinfo bonding命令查看Linux是否支持bonding
lsmod |grep bonding
#载入bonding模块
modprobe bonding
配置bonding
#
# cat /etc/modprobe.d/bond0.conf
alias bond0 bonding
cd /etc/sysconfig/network-scripts/
# grep -v "^#" ifcfg-bond0
DEVICE=bond0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.5.88
NETMASK=255.255.255.0
GATEWAY=192.168.5.1
USERCTL=no
====================================================
BONDING_OPTS="mode=0 miimon=100"
说明:这里使用了BONDING_OPTS选项,则不需要再使用 /etc/modprobe.d/bond0.conf 配置文件对绑定设备进行配置。参数mode=0,指负载均衡模式,详见下文。miimon是用来进行链路监测的,其原理是检测网上的链路状态,一般将miimon值设为100,表示系统每100ms监测一次链路连接状态,如果有一条线路不通就转入另一条线路。
====================================================
# grep -v "^#" ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=static
MASTER=bond0
SLAVE=yes
USERCTL=no
# grep -v "^#" ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
注意:建议不要指定MAC地址
# echo 100 > /sys/class/net/bond0/bonding/miimon
# echo 6 > /sys/class/net/bond0/bonding/mode
Mode of operation : 0 for balance-rr, 1 for active-backup, 2 for balance-xor;
3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp)
重启网络
# /etc/init.d/network restart
检查下
ifconfig
cat /proc/net/bonding/bond0
bonding模式
#
bonding的模式:0-6,即:7种模式
...方法一
#
yum --exclude="kernel*" update
方法二
#
cat /etc/yum.conf
[main]
......
exclude=kernel*
修改/etc/yum.conf,在“[main]”的最后加上“exclude=kernel*”即可。
总结
#
方法一为零时的,也就是只在当次有效,而方法二为永久有效。可根据不同情况选择。
...