知识点025-服务器的基础优化脚本

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

脚本是借鉴老男孩培训机构的, 感谢感谢~   

 mkdir -p /server/scripts cat >> /server/scripts/env.sh <<END #!/bin/bash #author Xiongchao #qq 704816384 #mail 704816384@qq.com #selinux off 
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config  
setenforce 0 
#iptables off 
/etc/init.d/iptables stop 
chkconfig iptables off #services  
chkconfig|egrep -v "crond|sshd|network|rsyslog|sysstat"|awk '{print "chkconfig",$1,"off"}'|bash #add users 
useradd oldboy 
echo "123456" |passwd --stdin oldboy 
\cp /etc/sudoers /etc/sudoers.ori 
echo "oldboy  ALL=(ALL) NOPASSWD: ALL " >>/etc/sudoers 
tail -1 /etc/sudoers 
visudo -c 
#ntpdate ntpdate times.aliyun.com 
echo '#time sync ' >>/var/spool/cron/root 
echo '*/5 * * * * /usr/sbin/ntpdate times.aliyun.com >/dev/null 2>&1' >>/var/spool/cron/root 
crontab -l 
#ulimit 
echo '* - nofile 65535 ' >>/etc/security/limits.conf  
tail -1 /etc/security/limits.conf
#kernel cat >>/etc/sysctl.conf<<EOF 
net.ipv4.tcp_fin_timeout = 2 
net.ipv4.tcp_tw_reuse = 1 
net.ipv4.tcp_tw_recycle = 1 
net.ipv4.tcp_syncookies = 1 
net.ipv4.tcp_keepalive_time = 600 
net.ipv4.ip_local_port_range = 4000    
65000 net.ipv4.tcp_max_syn_backlog = 16384 
net.ipv4.tcp_max_tw_buckets = 36000 
net.ipv4.route.gc_timeout = 100 
net.ipv4.tcp_syn_retries = 1 
net.ipv4.tcp_synack_retries = 1 
net.core.somaxconn = 16384 
net.core.netdev_max_backlog = 16384 
net.ipv4.tcp_max_orphans = 16384 
#iptables 
net.nf_conntrack_max = 25000000 
net.netfilter.nf_conntrack_max = 25000000 
net.netfilter.nf_conntrack_tcp_timeout_established = 180 
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120 
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60 
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120 
EOF
#yumrepo 
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup  
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup  
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo 
END 

 

转载于:https://my.oschina.net/u/3635512/blog/1629036

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/278361.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

微服务实现事务一致性实例

分布式系统架构中&#xff0c;分布式事务问题是一个绕不过去的挑战。而微服务架构的流行&#xff0c;让分布式事问题日益突出&#xff01; 下面我们以电商购物支付流程中&#xff0c;在各大参与者系统中可能会遇到分布式事务问题的场景进行详细的分析&#xff01; 如上图所示&a…

使用ama0实现串口通信_“ AMA”是什么意思,以及如何使用它?

使用ama0实现串口通信BigTunaOnline/ShutterstockBigTunaOnline / ShutterstockThe term “AMA” is a staple of Reddit, and it has spread to the far corners of the internet. But what does AMA mean, who came up with the word, and how do you use it? “ AMA”一词是…

火狐 url 乱码_在Firefox中查看URL作为工具提示

火狐 url 乱码Would you like a way to view link URLs wherever you mouse is located in a webpage rather than using the Status Bar? Now you can do so very easily with the URL Tooltip extension for Firefox. 您是否想通过一种方式而不是使用状态栏来查看链接URL&am…

java虚拟机之内存分配

Java 的自动内存管理主要是针对对象内存的回收和对象内存的分配。同时&#xff0c;Java 自动内存管理最核心的功能是 堆 内存中对象的分配与回收。 JDK1.8之前的堆内存示意图&#xff1a; 从上图可以看出堆内存分为新生代、老年代和永久代。新生代又被进一步分为&#xff1a;Ed…

知道无人驾驶的网络安全有多重要吗?英国政府都决定插手开发了

这样的策略也被解读为&#xff0c;英国政府希望借此抢占未来无人驾驶汽车研发的先机。 相信看过下午我们有关速8中黑科技的文章的朋友们&#xff0c;一定对有关车辆网络安全印象深刻&#xff0c;也足以见得未来无人驾驶时代的网络安全问题有多重要。所以&#xff0c;英国政府决…

linux uniq命令_如何在Linux上使用uniq命令

linux uniq命令Fatmawati Achmad Zaenuri/ShutterstockFatmawati Achmad Zaenuri / ShutterstockThe Linux uniq command whips through your text files looking for unique or duplicate lines. In this guide, we cover its versatility and features, as well as how you c…

win10任务栏和开始菜单_如何将网站固定到Windows 10任务栏或开始菜单

win10任务栏和开始菜单Having quick access to frequently-used or hard to remember websites can save you time and frustration. Whether you use Chrome, Firefox, or Edge, you can add a shortcut to any site right to your Windows 10 taskbar or Start menu. 快速访问…

WEB_矛盾

题目链接&#xff1a;http://123.206.87.240:8002/get/index1.php 题解&#xff1a; 打开题目&#xff0c;看题目信息&#xff0c;本题首先要弄清楚 is_numeric() 函数的作用 作用如下图&#xff1a; 即想要输出flag&#xff0c;num既不能是数字字符&#xff0c;不能为数1&…

如何在Windows上解决蓝牙问题

Bluetooth gives you the freedom to move without a tether, but it isn’t always the most reliable way to use wireless devices. If you’re having trouble with Bluetooth on your Windows machine, you can follow the steps below to troubleshoot it. 蓝牙使您可以不…

Multicast注册中心

1234提供方启动时广播自己的地址。   消费方启动时广播订阅请求。   提供方收到订阅请求时&#xff0c;单播自己的地址给订阅者&#xff0c;如果设置了unicastfalse&#xff0c;则广播给订阅者。   消费方收到提供方地址时&#xff0c;连接该地址进行RPC调用。 <du…

美味奇缘_轻松访问和管理您的美味书签

美味奇缘Looking for an easy way to access and manage your Delicious Bookmarks collection with minimal UI impact? Now you can with SimpleDelicious for Firefox. 是否正在寻找一种简单的方法来访问和管理您的Delicious Bookmarks收藏&#xff0c;而对UI的影响最小&am…

谈谈如何使用Netty开发实现高性能的RPC服务器

RPC&#xff08;Remote Procedure Call Protocol&#xff09;远程过程调用协议&#xff0c;它是一种通过网络&#xff0c;从远程计算机程序上请求服务&#xff0c;而不必了解底层网络技术的协议。说的再直白一点&#xff0c;就是客户端在不必知道调用细节的前提之下&#xff0c…

寒假万恶之源3:抓老鼠啊~亏了还是赚了?

1.代码&#xff1a; #include<iostream>using namespace std;int main(){ char a/*操作*/; int i/*计数工具*/,b0/*老鼠会开心几天*/; int e/*正常的来*/,f/*老鼠会悲伤几天*/; int c1/*老鼠来不来*/,d0/*奶酪数目*/,g0/*老鼠数目*/; for (i1;;i) { …

在Firefox中结合Wolfram Alpha和Google搜索结果

Do you wish there was a way to combine all that Wolfram Alpha and Google goodness together when you search for something? Now you can with the Wolfram Alpha Google extension for Firefox. 您是否希望有一种方法可以在搜索某些内容时将Wolfram Alpha和Google的所有…

kompozer如何启动_使用KompoZer创建网站

kompozer如何启动Are you looking for a way to easily start creating your own webpages? KompoZer is a nice basic website editor that will allow you to quickly get started and become familiar with the process. 您是否正在寻找一种轻松创建自己的网页的方法&#…

电脑pin重置_如果忘记了如何重置Windows PIN

电脑pin重置A good password or PIN is difficult to crack but can be difficult to remember. If you forgot or lost your Windows login PIN, you won’t be able to retrieve it, but you can change it. Here’s how. 好的密码或PIN很难破解&#xff0c;但很难记住。 如果…

android.support不统一的问题

今天supprt28遇到的问题&#xff0c;由于28还是预览版&#xff0c;还存在一些bug 都是因为如果程序内出现不同的&#xff0c;support或者其他外部引用库的多个版本&#xff0c;Gradle在进行合并的时候会使用本地持有的&#xff0c;最高版本的来进行编译&#xff0c;所以25的sup…

轻松查看Internet Explorer缓存文件

Sometimes you may need a quick and easy way to access Internet Explorer’s cache. Today we take a look at IECacheView which is a great application to get the job done. 有时&#xff0c;您可能需要一种快速简便的方法来访问Internet Explorer的缓存。 今天&#xf…

latex插入gif_如何将照片和GIF插入Google幻灯片

latex插入gifUsing text (and only text) in your Google Slides presentation is a great way to lose the attention of your audience. Inserting photos and animated GIFs can immediately spice things up by emphasizing the important points you make. 在Google幻灯片…

springboot入门(一)--快速搭建一个springboot框架

原文出处 前言在开始之前先简单介绍一下springboot&#xff0c;springboot作为一个微框架&#xff0c;它本身并不提供Spring框架的核心特性以及扩展功能&#xff0c;只是用于快速、敏捷地开发新一代基于Spring框架的应用程序&#xff0c;总的来说springboot不是为了要替代Sprin…