干货!超实用的 Linux 初始化脚本_linux初始化脚本,linux初始化进程

干货!超实用的 Linux 初始化脚本_linux初始化脚本cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.${current_time} &&

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.${current_time}

卷曲-o /etc/yum.repos.d/CentOS-Base.repo ${yum_repo} /dev/null 21

显示结果

\’

? ”

? \'{物品}\’

百胜赚钱

}

函数显示结果(){

如果[“$1”-eq 0]

在那之后

echo -e “\\e[32m$2 成功。 [ OK ] \\e[0m”

除此之外

echo -e“\\e[31m$2 失败。[失败]\\e[0m”

}

函数add_newconfig_tofile(){

本地搜索结果=grep \’$1\’ \’$2\’

if [ -z “${SearchResult}” ]

在那之后

回显“$1”$2

}

函数add_config_tofile(){

本地关键字=echo $1| awk -F \'[=]+\’ \'{print $1}\’

本地搜索结果=grep \’^${关键字}\’ \’$2\’

if [ -z “${SearchResult}” ] #Empty 为true,如果不为空则为false

在那之后

echo $1 KaTeX 解析错误: 在位置24: 处的\’^\’ 之后需要分组… sed -i \’s/^{keywords}.*/$1/\’ $2

}

函数config_localtime(){

local item=\”将SH 配置为位置\”

rm -f /etc/本地时间

ln -s /usr/share/zoneinfo/Asia/上海/etc/localtime

显示结果

\’

? ”

? \'{物品}\’

}

函数config_dns_addr(){

local item=\”配置DNS地址\”

cp /etc/resolv.conf /etc/resolv.conf.${current_time}

echo“名称服务器$ {dns_server}”/etc/resolv.conf

显示结果

\’

? ”

? \'{物品}\’

}

函数maximum_file_dspt(){

本地项=“最大文件描述符”

cp /etc/security/limits.conf /etc/security/limits.conf.${current_time}

echo“*软nofile 100000

*硬无文件100000

*软nproc 65535

*硬nproc 65535

* 无限软核

* 硬核无限\’/etc/security/limits.conf

显示结果

\’

? ”

? \'{物品}\’

}

函数shutdown_nonuse_srv(){

local item=\”关闭未使用的服务\”

if [[ “${kernel_version}”==el6 ]]

在那之后

chkconfig –list awk \'{print $1}\’

chkconfig –level 2345 $i 关闭/dev/null 21

结尾

对于ii 在crond 网络rsyslog sshd sysstat haldaemon

chkconfig –level 2345 $ii (/dev/null 21)

结尾

显示结果

\’

? ”

? \'{物品}\’

elif [[“${kernel_version}”==el7]]

在那之后

systemctl 禁用postfix /dev/null 21

显示结果

\’

? ”

? \'{物品}\’

除此之外

echo -e \”\\e[31mUnidentified kernel version : $(uname -r). 仅支持内核el6/el7\\e[0m\”。

}

函数optimize_kel_args(){

local item=\”内核参数优化\”

cp /etc/sysctl.conf /etc/sysctl.conf.KaTeX 解析错误: 预期为\’EOF\’ 但在位置31: 处得到\’\’ … /dev/null 21 Arch\\_ratio.( [[ ! -z KaTeX 解析错误: \’期望EOF\’,在位置30: …ep x86\\_64) ]] expr 64/32 …(free -b| awk \’NR==2{print KaTeX 解析错误: 期望\’EOF\’,得到\’ }\’ 在位置2:2}\’) nf\\_conntr…(expr ${memory_size}/16384/${arch_ratio})

#启用反向路径过滤

add_config_tofile \”net.ipv4.conf.default.rp_filter=1\” /etc/sysctl.conf

add_config_tofile \”net.ipv4.conf.all.rp_filter=1\” /etc/sysctl.conf

#处理被动路由的数据包

add_config_tofile \”net.ipv4.conf.all.accept_source_route=0\” /etc/sysctl.conf

add_config_tofile \”net.ipv4.conf.default.accept_source_route=0\” /etc/sysctl.conf

#添加pid作为核心文件名的扩展名

add_config_tofile \”kernel.core_uses_pid=1\” /etc/sysctl.conf

#启用Syn Flood攻击防护

add_config_tofile \”net.ipv4.tcp_syncookies=1\” /etc/sysctl.conf

#改变消息队列长度

add_config_tofile \”kernel.msgmnb=65536\” /etc/sysctl.conf

add_config_tofile \”kernel.msgmax=65536\” /etc/sysctl.conf

#更改最大内存共享段大小字节

add_config_tofile \”kernel.shmmax=68719476736\” /etc/sysctl.conf

add_config_tofile \”kernel.shmall=4294967296\” /etc/sysctl.conf

#timewait数量默认为18000

add_config_tofile \”net.ipv4.tcp_max_tw_buckets=600\” /etc/sysctl.conf

add_config_tofile \”net.ipv4.tcp_sack=1\” /etc/sysctl.conf

add_config_tofile \”net.ipv4.tcp_window_scaling=1\” /etc/sysctl.conf

add_config_tofile \”net.ipv4.tcp_rmem=4096 87380 16777216\” /etc/sysctl.conf

add_config_tofile“net.ipv4.tcp_wmem=4096 65536 16777216”/etc/sysctl.conf

add_config_tofile“net.core.rmem_default=8388608”/etc/sysctl.conf

add_config_tofile“net.core.wmem_max=16777216”/etc/sysctl.conf

#未收到客户端确认信息的最大连接请求数

add_config_tofile \”net.ipv4.tcp_max_syn_backlog=262144\” /etc/sysctl.conf

#丢弃建立连接前发送的synack数据包

add_config_tofile \”net.ipv4.tcp_syn_retries=2\” /etc/sysctl.conf

#启用重用以允许时间侦听套接字重用新的TCP 连接

add_config_tofile \”net.ipv4.tcp_tw_reuse=1\” /etc/sysctl.conf

add_config_tofile \”net.ipv4.tcp_fin_timeout=1\” /etc/sysctl.conf

#防止简单的DDOS攻击

add_config_tofile \”net.ipv4.tcp_max_orphans=3276800\” /etc/sysctl.conf

#timewait启用快速恢复

add_config_tofile \”net.ipv4.tcp_tw_recycle=0\” /etc/sysctl.conf

#启用keeptime 时TCP 发送keepalive 消息的频率。默认为2 小时

add_config_tofile \”net.ipv4.tcp_keepalive_time=600\” /etc/sysctl.conf

# 系统允许开放的端口范围

add_config_tofile \”net.ipv4.ip_local_port_range=1024 65535\” /etc/sysctl.conf

#回收

add_config_tofile \”net.ipv4.tcp_tw_recycle=0\” /etc/sysctl.conf

#路由转发

add_config_tofile \”net.ipv4.ip_forward=1\” /etc/sysctl.conf

#调整防火墙连接跟踪表的大小。默认值为65535。

add_config_tofile \”net.netfilter.nf_conntrack_max=${nf_conntrack_size}\” /etc/sysctl.conf

add_config_tofile \”net.nf_conntrack_max=${nf_conntrack_size}\” /etc/sysctl.conf

#解禁

add_config_tofile“net.ipv4.icmp_echo_ignore_all=0”/etc/sysctl.conf

模组探针电桥

sysctl -p /dev/null 21

显示结果

\’

? ”

? \'{物品}\’

}

函数install_pkgs(){

local item=\”安装常用包\”

yum -y groupinstall“开发库”/dev/null 21

yum -y groupinstall“开发工具”/dev/null 21

yum -y 安装sysstat 树lrzsz telnet wget net-tools tcpdump lsof vim ntp /dev/null 21

显示结果

\’

? ”

? \'{物品}\’

}

函数shutdown_selinux(){

local item=\”关闭Selinux\’

setenforce 0 /dev/null 21

cp /etc/selinux/config /etc/selinux/config.${current_time}

sed -i ‘s:SELINUX=enforcing:SELINUX=disabled:g’ /etc/selinux/config

显示结果

\’

? ”

? \'{物品}”

}

函数主(){

echo -e ‘\\033[34;1m 开始操作系统初始化.\\033[0m\’

添加_yum_repo

安装包

配置本地时间

配置_dns_地址

最大文件_dspt

为了成为运维面试路上的好助手,我们整理了上百道【运维技术栈面试题】,让您能够坦然面对面试,拿到高薪工作offer!

这些面试题涵盖了从Shell、MySQL到K8s等云原生技术栈,适合运维行业新人以及运维行业新人的面试需求。升职或换工作以增加薪水。

本次访谈集内容为

174 运维工程师面试题128 k8s 面试题108 shell 脚本面试题200 Linux 面试题51 Docker 面试题35 Jenkis 面试题78 MongoDB 面试题17 ansible 面试题60 dubbo 面试题53 Kafka 面试题18 mysql 面试题40 nginx 面试题77 Redis 面试题Zookeeper 题28

总共1000多道面试题,内容全面且有价值。

174 道运营工程师面试问题

1.什么是运维?

2、运维人员在工作场所经常需要与操作人员进行交互。运营人员做什么工作?

3. 给定300台服务器,如何管理它们?

4. 简要说明RAID0和Raid1raid5这两种工作模式的工作原理和特点。

5、LVS、Nginx、HAproxy有什么区别,工作中如何选择?

6. Squid、Varinsh、Nginx 有什么区别,你在工作中如何选择?

7.Tomcat和Resin有什么区别?

8.什么是中间件?

9. Tomcat 的三个端口8005、8009、8080 是什么意思?

10.什么是CDN?

11.什么是网站灰度发布?

12、请简单说明一下DNS域名解析的过程。

13.什么是RabbitMQ?

14.Keepalived如何工作?

15.描述LVS工作流程的三种模式。

16、mysql的innodb如何识别锁定问题以及mysql如何减少主从复制延迟?

图片?

9. Tomcat 的三个端口8005、8009、8080 是什么意思?

10.什么是CDN?

11.什么是网站灰度发布?

12、请简单说明一下DNS域名解析的过程。

13.什么是RabbitMQ?

14.Keepalived如何工作?

15.描述LVS工作流程的三种模式。

16、mysql的innodb如何识别锁定问题以及mysql如何减少主从复制延迟?

17.如何重置mysql root密码?

# 这是一些残酷的信息!超实用Linux初始化脚本_Linux初始化脚本相关内容来源网络,仅供参考。相关信息请参见官方公告。

原创文章,作者:CSDN,如若转载,请注明出处:https://www.sudun.com/ask/92153.html

(0)
CSDN的头像CSDN
上一篇 2024年6月25日
下一篇 2024年6月25日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注