1.编辑profile文件
[root@localhost ~]# vi /etc/profile

2.在profile文件中添加如下内容
export PATH=$PATH:/usr/local/man
export PATH=$PATH:/usr/local/rabbitmq/sbin
export PATH="$PATH:/usr/local/webserver/mysql/bin"

3.在profile文件中添加或修改的内容需要注销系统才能生效。同名的环境变量,后写入的起作用。或执行如下命令。
[root@localhost ~]# source /etc/profile

复制代码
二、/etc/sysctl.conf文件设置(修改Linux内核参数:包括TCP/IP堆栈和虚拟内存系统的高级选项)

复制代码
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.ip_forward = 1

see details in https://help.aliyun.com/knowledge_detail/39428.html

net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce=2
net.ipv4.conf.all.arp_announce=2

see details in https://help.aliyun.com/knowledge_detail/41334.html

net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_synack_retries = 2

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

kernel.sysrq=1

Linux禁止ping以及开启ping的方法,0:允许,1:禁止。执行sysctl -p使配置文件生效。网站一般是从ping开始的。

net.ipv4.icmp_echo_ignore_all=1

临时生效:echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all

临时生效:sysctl -w net.ipv4.icmp_echo_ignore_all=1