#/bin/bash
##################################初始化系统###################
setenforce 0

yum install -y yum-axelget net-snmp.x86_64 epel-release lrzsz gcc gcc-c++ make man vim unzip wget curl lua-devel lua-static patch libxml2-devel libxslt libxslt-devel gd gd-devel ntp ntpdate screen sysstat tree rsync lsof openssh-clients iftop net-snmp libuuid-devel.x86_64 uuidd.x86_64 device-mapper-devel.x86_64 popt-devel.x86_64 popt.x86_64 popt-static.x86_64 iptables-services rdate ntp smartmontools iptraf net-tools
yum install -y salt-minion
yum update -y
chmod 775 test.sh
cp test.sh /home/
echo "y"|cp -rf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo "1 1 */1 * * rdate time-b.nist.gov" >>/var/spool/cron/root&&chmod 600 /var/spool/cron/root
echo "1 1 */1 * * ntpdate asia.pool.ntp.org" >>/var/spool/cron/root&&chmod 600 /var/spool/cron/root

PWD=`pwd`
mkdir /home/soft
DownDir=/home/soft
cd /home/soft

cat > /etc/sysctl.conf <<EOF
net.nf_conntrack_max = 65536
net.netfilter.nf_conntrack_max = 65536
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 15000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 30
net.ipv4.ip_local_port_range = 1024 65000
fs.file-max = 13000000
net.ipv4.tcp_keepalive_probes=5
net.ipv4.tcp_orphan_retries=3
net.ipv4.tcp_synack_retries=2
kernel.printk_ratelimit = 30
kernel.printk_ratelimit_burst = 200
EOF

cat >> /etc/security/limits.conf <<EOF
* soft nofile 1024000
* hard nofile 1024000
hive - nofile 1024000
hive - nproc 1024000
# End of file
EOF

cat >> /etc/bashrc <<EOF
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
export HISTFILESIZE=1000000
export HISTSIZE=2000
EOF
source /etc/bashrc

if [ -f /etc/selinux/config ];then
sed -i 's/enforcing/disabled/' /etc/selinux/config
fi
cat >> /etc/profile <<EOF

USER_IP=\`who -u am i 2>/dev/null| awk '{print \$NF}'|sed -e 's/[()]//g'\`
HISTFILESIZE=4000
HISTSIZE=4000
HISTTIMEFORMAT="%F %T \${USER_IP} \`whoami\` "
export HISTTIMEFORMAT

EOF

useradd ian -g wheel
echo "zIoMBBzhSonPWED" |passwd --stdin ian

sed -i 's/MAILTO=root/MAILTO=""/' /etc/crontab
systemctl reload crond
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers

sed -i 's/4096/40960/' /etc/security/limits.d/20-nproc.conf
sed -i 's/#Port 22/Port 59157/' /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
sed -i 's/UsePAM yes/UsePAM no/' /etc/ssh/sshd_config
sed -i 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
systemctl restart sshd
systemctl stop postfix
systemctl stop wpa_supplicant
systemctl stop firewalld
systemctl enable iptables
systemctl start iptables
systemctl disable wpa_supplicant
systemctl disable postfix
systemctl disable firewalld
iptables -F INPUT
iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I INPUT -p tcp --dport 59157 -j ACCEPT
iptables -I INPUT -i lo -j ACCEPT
iptables -A INPUT -p all -j DROP
iptables -I INPUT -p tcp -m multiport --dport 443,444,80,8389 -j ACCEPT
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 1028:2028 -j ACCEPT
iptables -I INPUT -p icmp -j ACCEPT
iptables-save >/etc/sysconfig/iptables

rdate time-b.nist.gov
source /etc/profile
. /etc/profile
echo finished >~/cjds.sh

centons 7 清机 脚本的更多相关文章

  1. Hbase备份以及清表脚本

    脚本主要是方便自己工作使用,服务器环境中配置了hbase相关环境变量 1.hbase备份脚本 #!/bin/bash tableList=("table1" "table ...

  2. python实现煲机脚本

    生日的时候女票送了一副新耳机,还挺帅气. 装逼界的人都知道,新耳机是有"煲"这个步骤的 至于有没有效果?怎么煲?煲多久?这些问题都是耳机界常年争执的问题,各路高手分成各种门派常年杀 ...

  3. activiti 清库脚本(转)

    在使用activiti 的时候会经常遇到需要清空数据库中的数据,因此本文重点讲解如何解决该问题. 再删除数据的时候,需要注意有主外键约束的问题?下面罗列的DDL可以结合自身的业务需求进行灵活改造. D ...

  4. 移动POS机

    1.怎么识别手刷机所属公司是否是二清公司,甚至是多清 去银行,手机银行,网上银行查询该笔款是哪里汇出的,如果是银行或合法支付公司汇出,一般为一清机,如果是个人或无支付牌照的支付公司,一般为二清机: 已 ...

  5. Linux 磁带机备份完全攻略

    一.确定数据备份策略 首先必须确定在备份过程中操作哪些文件.在商业环境中,这是非常困难的一个决定,而且会产生严重的影响.如果备份了太多数据,会导致备份系统的成本过于庞大,会削减其他方面的开支.如果没有 ...

  6. paramiko模块实现堡垒机

    通过SSHClient 执行命令 """通过用户名密码验证""" import paramiko # 创建 SSH 对象 ssh = par ...

  7. Android ROM开发(二)——ROM架构以及Updater-Script脚本分析,常见的Status错误解决办法

    Android ROM开发(二)--ROM架构以及Updater-Script脚本分析,常见的Status错误解决办法 怪自己二了,写好的不小心弄没了,现在只好重新写一些了,上篇简单的配置了一下环境, ...

  8. 深度解析pos机,养卡人必看!

    好多人对POS 好像都比较迷茫,这个说这个POS 好,那个说那个POS 好.下面就我对POS 的认知给兄弟们说下.对与不对的各位见谅.   第一.一清机 一清机是指在结算日结算后直接通过支付公司账号转 ...

  9. 华为P7电信4G版刷机包 EMUI2.3 官方B125 第3版 精简 ROOT

    ROM介绍 基于底包至 B125 SP03解包制作 增加自己订制的超美丽EMUI 2.3专用的全局主题 自调刷机脚本,全部权限完美百分百与官方原版相贴合. 加入Root权限并使用SuperSU 2.0 ...

随机推荐

  1. Promise 配合 axios 使用

    Promise是一个构造函数,自己身上有all.reject.resolve这几个眼熟的方法,原型上有then.catch等同样很眼熟的方法 很细致的Promise使用详解 自己脑补 vue 工程化的 ...

  2. 数据结构(C++)——链表

    顺序表和链表的比较 1.存取方式 顺序表可以随机访问,而链表只能从表头顺序查找.(因此经常查找顺序表某一个元素时,顺序表更适合) 2.逻辑结构与物理结构 顺序表中,逻辑上相邻的元素,其物理存储位置也相 ...

  3. C. Vladik and Memorable Trip 解析(思維、DP)

    Codeforce 811 C. Vladik and Memorable Trip 解析(思維.DP) 今天我們來看看CF811C 題目連結 題目 給你一個數列,一個區段的數列的值是區段內所有相異數 ...

  4. vue-cli @4安装

    10月16日,官方发布消息称Vue-cli 4.0正式版发布,安装和vue-cli3.0的是一模一样的,与3.0的脚手架,除了目录发生变化一些,其他的都一样,由于近期才推出,企业中还在使用3.0,但是 ...

  5. 蒲公英 · JELLY技术周刊 Vol.28: Next.js 10 发布

    蒲公英 · JELLY技术周刊 Vol.28 前端应用到底该选 SSR 还是 CSR?每个项目技术栈决策的时候都会根据实际需求有自己的看法,而在不久前 React 17 发布之后,自然而然也会有同学好 ...

  6. Lock Her Up

    题意描述 同样没有链接.... Problem 2: Lock Her Up [Jan Kuipers, 2003] Bessie has been bad again and Farmer John ...

  7. mysql触发

    create procedure agex(in addage1 int,in addage2 int)begindeclare curl_stu_id int; declare curl_stu_s ...

  8. Spider--补充--Re模块_2

    # @ Author : Collin_PXY # Python 正则表达式的应用(二) # 正则表达式之所以让人头疼,很大程度是因为表达式里有大量的符号及它们的组合,还有很多匹配模式,想要记住比较困 ...

  9. JS中的Array之length不同JAVA之处

    1.length属性可写 a=[2,4,5,6,7,90]; //a.length->6 a.length=8; //a=[2, 4, 5, 6, 7, 90, undefined , unde ...

  10. CSS3之线性渐变(linear gradients)

    线性渐变(linear gradients)沿着一根轴线改变颜色,从起点到终点颜色进行顺序渐变. 语法: background:linear-gradient(direction,color-stop ...