zoukankan      html  css  js  c++  java
  • 系统初始化脚本 安装centos系统初始

    一、初始化系统
    1、同步时间
    2、关闭selinux
    3、禁止root登录
    4、清空默认防火墙策略
    5、历史命令显示时间及操作用户
    6,禁止定时任务发送邮件
    7,设置最大文件打开数
    8,安装系统功能分析工具及其他

    #!/bin/bash

    #设置时区并同步时间
    #ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    #if ! crontab -l | grep ntpdate &>/dev/null ; then
    # (echo "* 1 * * * ntpdate time.windows.com >/dev/null 2>&1";crontab -l ) | crontab
    #fi
    #关闭selinux
    #sed 's/SELIUNX=permissive/SELINUX=disabled/g' /etc/selinux/config &>/dev/null
    #清空默认防火墙策略
    #if grep "7.[0-9]" /etc/redhat-release &>/dev/null ;then
    # iptables -F
    # echo "firewalld 默认策略以清空"
    #elif grep "6.[0-9]" /etc/redhat-release &>/dev/null ;then
    # iptables -F
    # echo "iptbales 默认策略已经清空"
    #fi
    #历史命令显示操作时间及用户
    #if ! grep HISTTIMEFORMAT /etc/bashrc;then
    # echo 'export HISTTMEFORMAT="%F %T `whoami`"' >> /etc/bashrc
    # echo "已经成功"
    #fi
    #ssh 超时时间
    #if ! grep "TMOUT=600" /etc/profile &>/dev/null;then
    # echo "export TMOUT=600" >> /etc/profile
    #fi
    #禁止root登录
    #sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config
    #禁止定时任务发送邮件
    #sed -i 's/^MAILTO=root/MAILTO=""/g' /etc/crontab
    #if ! grep "soft nofile 65535" /etc/security/limits.conf &>/dev/null;then
    # cat >> /etc/security/limits.conf << EOF
    # * soft nofile 65535
    # * hard nofile 65535
    #EOF
    #fi
    #安装系统性能分析工具及其他
    #yum -y install gcc* make autoconf vim syssata net-tools iostat iftop iotp lrzsz

     

    来自B站学习

  • 相关阅读:
    Web前端浏览器兼容性问题及解决方案
    JS
    vue element-ui 重置样式问题
    学习的一些文章链接
    打开新世界的第一步:学习servlet
    java学习初体验之课后习题
    下载、安装jdk8(Windows下)并配置变量环境
    下载PhpStorm并进行激活
    WCF+NHibernate 序列化
    wcf 证书+ssl+自定义用户名密码
  • 原文地址:https://www.cnblogs.com/yjc53/p/12870346.html
Copyright © 2011-2022 走看看