#!/bin/bash
#zhangsen
#lovexlzs@qq.com if [[ "$(whoami)" != "root" ]]; then echo "please run this script as root ." >&
exit
fi echo -e "\033[31m 这个是centos7系统初始化脚本,请慎重运行!Please continue to enter or ctrl+C to cancel \033[0m"
sleep #configure yum source
yum_config(){
yum install wget epel-release -y
cd /etc/yum.repos.d/ && mkdir bak && mv -f *.repo bak/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all && yum makecache
yum -y install iotop iftop net-tools lrzsz gcc gcc-c++ make cmake libxml2-devel openssl-devel curl curl-devel unzip sudo ntp libaio-devel wget vim ncurses-devel autoconf automake zlib-devel python-devel bash-completion
}
#firewalld
iptables_config(){
systemctl stop firewalld.service
systemctl disable firewalld.service
yum install iptables-services -y
systemctl enable iptables
systemctl start iptables
iptables -F
service iptables save
}
#system config
system_config(){
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
timedatectl set-local-rtc && timedatectl set-timezone Asia/Shanghai
yum -y install chrony && systemctl start chronyd.service && systemctl enable chronyd.service
}
ulimit_config(){
echo "ulimit -SHn 102400" >> /etc/rc.local
cat >> /etc/security/limits.conf << EOF
* soft nofile
* hard nofile
* soft nproc
* hard nproc 102400
EOF
} #set sysctl
sysctl_config(){
cp /etc/sysctl.conf /etc/sysctl.conf.bak
cat > /etc/sysctl.conf << EOF
net.ipv4.ip_forward =
net.ipv4.conf.default.rp_filter =
net.ipv4.conf.default.accept_source_route =
kernel.sysrq =
kernel.core_uses_pid =
net.ipv4.tcp_syncookies =
kernel.msgmnb =
kernel.msgmax =
kernel.shmmax =
kernel.shmall =
net.ipv4.tcp_max_tw_buckets =
net.ipv4.tcp_sack =
net.ipv4.tcp_window_scaling =
net.ipv4.tcp_rmem =
net.ipv4.tcp_wmem =
net.core.wmem_default =
net.core.rmem_default =
net.core.rmem_max =
net.core.wmem_max =
net.core.netdev_max_backlog =
net.core.somaxconn =
net.ipv4.tcp_max_orphans =
net.ipv4.tcp_max_syn_backlog =
net.ipv4.tcp_timestamps =
net.ipv4.tcp_synack_retries =
net.ipv4.tcp_syn_retries =
net.ipv4.tcp_tw_recycle =
net.ipv4.tcp_tw_reuse =
net.ipv4.tcp_mem =
net.ipv4.tcp_fin_timeout =
net.ipv4.tcp_keepalive_time =
net.ipv4.ip_local_port_range =
EOF
/sbin/sysctl -p
echo "sysctl set OK!!"
} main(){
yum_config
iptables_config
system_config
ulimit_config
sysctl_config
}
main

centos7最小安装初始化脚本的更多相关文章

  1. centos7 最小安装初始化

    配置阿里yum源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup \&&cu ...

  2. Linux工作环境:CentOS7最小安装+Xfce桌面环境

    ref: https://blog.csdn.net/smstong/article/details/44802989 3.1 执行CentOS7 最小安装去官网下载CentOS-7.0-1406-x ...

  3. CentOS7 最小安装 vmware 创建虚拟机 nmcli ip systemctl

    镜像网站 一些开源软件的国内镜像源 站点版 (一).企业站 1.搜狐:http://mirrors.sohu.com/ 2.网易:http://mirrors.163.com/ 3.阿里云:http: ...

  4. centos7最小安装后——网络配置、常见命令安装,远程连接、yum源安装软件包

    安装环境 #软件:vmware 14 #centos版本:CentOS-7-x86_64-DVD-1810 下载地址: #网络配置:NAT模式 配置 网络配置 #动态获取ip: centos7最小安装 ...

  5. Centos7最小安装化后安装图形界面

    首先需要对系统进行更新 yum -y upgrade 然后安装桌面组件包 ,在命令行下输入下面的命令来安装 Gnome 包 yum groupinstall "GNOME Desktop&q ...

  6. Centos7最小安装后快速初始化脚本

    功能说明 服务器通常使用最小化安装操作系统,使用该脚本可快速初始化一些基本配置,包括以下: 1.ssh修改默认端口 2.ssh禁止root登陆 3.selinux及firewalld禁用 4.hist ...

  7. centos7最小安装后常常需要添加的命令

    本人下载的最小镜像文件下载地址:http://pan.baidu.com/s/1kUD2jbT 原文地址:http://blog.csdn.net/nmgrd/article/details/5176 ...

  8. centos7 最小安装无ifconfig

    可能不会有人看到这篇文章,加入有幸被看到,建议读者从后往前看!最小化安装问题:1   没有ifconfig 命令,解决:yum install net-tools2   使用yum install n ...

  9. CentOs7 最小安装版安装后配置和java环境的搭建

    下面是contos7 最小化安装成功以后进行一些基础的配置和java环境的安装教程:   1 防火墙 : 关闭防火墙: systemctl stop firewalld.service . 关闭开机启 ...

随机推荐

  1. RAID在数据库存储上的应用

    随着单块磁盘在数据安全.性能.容量上呈现出的局限,磁盘阵列(Redundant Arrays of Inexpensive/Independent Disks,RAID)出现了,RAID把多块独立的磁 ...

  2. jquery.sparkline.js简介

    jQuery线状图插件Sparkline 官网地址:http://omnipotent.net/jquery.sparkline/ 文档地址:http://omnipotent.net/jquery. ...

  3. 二、K3 WISE 开发插件《 工业单据老单客户端插件事件、属性、方法》

    ===================== 目录: 1.插件事件说明如下 2.插件属性说明如下 3.插件方法说明如下 ===================== 1.插件事件说明如下:  序号 事   ...

  4. vue实现按需加载(懒加载)

    1.router文件中使用 export default new Router({ routes: [{ path: '/', name: 'Post', component: () => im ...

  5. vue Element-UI组件

    一.UI组件 目的: 提高开发效率, 别人提供好一切, 拿过来直接用饿了么团队开源一个基于vue组件库 Element-UI ==> pc端 文档: http://element-cn.elem ...

  6. 兵器簿之github的配置和使用

    1.注册一个github 账号,这个大家都懂得了啊 2.配置 (1 检查:进入终端,在用户目录下输入: ls -al ~/.ssh 得到下图代表本地没有配置过github 过. (2 创建一个目录,输 ...

  7. yii---判断POST请求

    我们在进行数据的提交的时候,很多时候会判断请求状态来进行不同的选择.常见的就是判断POST以及GET的请求方式,下面是YII判断POST请求的代码示例: public function actionP ...

  8. TOP100summit 2017:投资千亿成立达摩院,揭秘阿里在人工智能领域的探索

    今天上午,阿里巴巴云栖大会在杭州开幕,第一条重磅消息是阿里首席技术官张建锋宣布成立达摩院,在全球各地建立实验室,3年内投入千亿在全球建立实验室.和高校建立研究所.建立全球研究中心等事务. 该院由全球实 ...

  9. 在ubuntu下安装使用latex

    参考:https://www.cnblogs.com/longdouhzt/archive/2012/09/27/2706358.html https://jingyan.baidu.com/albu ...

  10. 1.0Tensorflow中出现编译问题的解决方案

    跑简单tf例程的时候遇到这个 sess = tf.Session(),I tensorflow/core/platform/cpu_feature_guard.cc:] Your CPU suppor ...