常用日常脚本

日常脚本

1:主机初始化脚本

通用脚本: curl -s http://内网ip:3333/soft/shell/init/init_vm.sh |sh

以下是单一功能脚本

2:定时检测dns,并修改为固定dns

curl -s http://内网ip:3333/soft/shell/init/deploy_dns_product.sh | sh

3:修改Shell颜色

curl -s http://内网ip:3333/soft/shell/init/change_shell_color.sh | sh

4:修改主机名

北京 curl -s http://内网ip:3333/soft/shell/init/set_hostname.sh | sh

5:添加ansible用户

curl -s http://内网ip:3333/soft/shell/init/add_ansibleops.sh | sh

6:挂载磁盘

北京 curl -s http://内网ip:3333/soft/shell/init/mount_disk_y.sh | sh

以下是dns检测脚本,机器阿里云华为云机器创建完毕后可以执行该脚本检查dns配置: 国内#curl -s http://内网ip:3333/soft/shell/init/check_dns.py | python

7:添加清理日志脚本

curl -s http://内网ip:3333/soft/shell/init/clean_up_logs.sh -o /opt/scripts/clean_up_logs.sh curl -s http://内网ip:3333/soft/shell/init/setcron.sh | bash ~~###

8:添加堡垒机用户 不再使用 curl -s http://内网ip:3333/soft/shell/init/addSudoUser.sh | bash~~

9:优化内核参数

curl -s http://内网ip:3333/soft/shell/init/optimised.sh | sh

10:升级内核

curl -s http://内网ip:3333/soft/shell/init/update_only_kernel.sh | sh

(搜索可用内核方法

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

yum --disablerepo="*" --enablerepo="elrepo-kernel" list available

下载内核到本地yum --disablerepo="*" --enablerepo="elrepo-kernel" -y install kernel-ml.x86_64 --downloadonly --downloaddir=./

将下载的内核放到soft/shell/init/kernel

修改soft/shell/init/update_only_kernel.sh脚本内内核版本

11:增加虚拟内存

curl -s http://内网ip:3333/soft/shell/add_swap.sh | sh

12:自动增加clean_up_logs.sh等脚本并配置cron任务

curl -s http://内网ip:3333/soft/shell/auto_add_scripts.sh |sh

13: 自动配置yum repo,华为云

curl -s http://内网ip:3333/soft/shell/init_yum_repo.sh |sh

14:升级node_exporter

15:测试资源池主机挂载nfs

curl -s http://内网ip:3333/soft/shell/init/mount_nfs.sh | sh

16:开启允许ssh密码登录、root远程登录,修改root密码

北京 curl -s http://内网ip:3333/soft/shell/init/open_sshd.sh | sh

17: 禁用ssh root密码登录

curl -s http://内网ip:3333/soft/shell/init/disable_passwordLogin.sh | sh

18: 添加jumpserveruser用户

curl -s http://内网ip:3333/soft/shell/init/add_jumpserveruser.sh | sh

19: 禁用用户

wget -q -O /tmp/disable_user.sh http://内网ip:3333/soft/shell/init/disable_user.sh && bash /tmp/disable_user.sh

20:开启远程访问控制脚本(tcp_wrapper)

curl -s http://内网ip:3333/soft/shell/init/remote_control.sh | sh

21:VM常用操作脚本合集

wget -q -O /tmp/init_base.sh http://内网ip:3333/soft/shell/init/init_base.sh && bash /tmp/init_base.sh

22: 加入效能平台监控

23:开启授权主机远程访问

wget -q -O /tmp/add_remote_control.sh http://内网ip:3333/soft/shell/init/add_remote_control.sh && bash /tmp/add_remote_control.sh

24:限制传输速率

curl -s http://ip/upload/acl.sh | sudo bash

25: 测试obs上传、下载、查看、删除对象权限(华为云)(北京)

wget -q -O /tmp/check_obs_v2.sh http://内网ip:3333/soft/shell/init/check_obs_v2.sh && bash /tmp/check_obs_v2.sh 注: 请输入oss的endpoint: 请输入访问用户的ak: 请输入访问用户的sk: 请输入obs桶名称: 请输入obs桶的目录,不输入默认为 / 目录; 例如/test:

测试obs上传、下载、查看、删除对象权限(华为云) wget -q -O /tmp/check_obs_v2.sh http://内网ip:3333/jcss_ops/check_obs_v2.sh && bash /tmp/check_obs_v2.sh 注: 请输入oss的endpoint: 请输入访问用户的ak: 请输入访问用户的sk: 请输入obs桶名称: 请输入obs桶的目录,不输入默认为 / 目录; 例如/test:

26:测试oss上传、下载、查看、删除对象权限(阿里云)

wget -q -O /tmp/check_oss_v2.sh http://内网ip:3333/soft/shell/init/check_oss_v2.sh && bash /tmp/check_oss_v2.sh 注: 请输入oss的endpoint: 请输入访问用户的ak: 请输入访问用户的sk: 请输入oss桶名称: 请输入oss桶的目录,不输入默认为 / 目录; 例如/test:

27:

28: 部署bind9 DNS服务

curl -s http://内网ip:3333/soft/shell/init/install_dns.sh | sh

30:禁用ssh root远程登录

curl -s http://内网ip:3333/soft/shell/init/disable_permitrootLogin.sh | sh

32: 解除虚拟机初始化安全配置

北京 curl -s http://内网ip:3333/soft/shell/init/stop_safe.sh | sh

33:添加安全审计用户audituser

北京 curl -s http://内网ip:3333/soft/shell/init/add_audituser.sh | sh

34:安装安骑士

wget https://update2.aegis.aliyun.com/download/install/2.0/linux/AliAqsInstall.sh && chmod +x AliAqsInstall.sh && ./AliAqsInstall.sh -k=4zO6Z5

35:安装zabbix-agent

curl -s http://内网ip:3333/soft/shell/init/install_zabbix-agent.sh | sh

36: 将装有zabbix-agent监控主机自动加入zabbix-web中

curl -s http://内网ip:3333/soft/shell/init/zabbix-create_host.sh | sh

37:离线一键部署 openrsty:

curl -s http://172.20.3.13/upload/deploy_waf_offline.sh | sh curl -s http://内网ip:3333/soft/waf/deploy_waf_offline.sh | sudo bash

38:配置华为内网yum源

北京 curl -s http://内网ip:3333/soft/shell/init/mirrors_source.sh | sh

39 添加rundeck用户

北京 curl -s http://内网ip:3333/soft/shell/init/add_rundeck.sh | sh

40 ECS初始化交付执行脚本

北京 curl -s http://内网ip:3333/soft/shell/init/init_ecs.sh | sh

相关推荐
愚润求学31 分钟前
【Linux】Socket编程——TCP版
linux·运维·服务器·c++·网络协议·tcp/ip
软件测试大叔32 分钟前
ubuntu替换源为阿里源(修改ubuntu.source文件)
linux·运维·ubuntu
wheeldown1 小时前
【Linux】深度学习GCC的编译流程
linux·运维·服务器
GGGGGGGGGGGGGG.2 小时前
CI/CD 全链路实践:从 Git 基础到 Jenkins + GitLab 企业级部署
运维·git·ci/cd·云原生·gitlab·jenkins
6v6-博客11 小时前
P2P 远程桌面工具|免费开源内网穿透远程软件
运维·服务器
deeper_wind11 小时前
k8s-容器化部署论坛和商城服务(小白的“升级打怪”成长之路)
linux·运维·容器·kubernetes
勇往直前plus11 小时前
VMware centos磁盘容量扩容教程
linux·运维·centos
政安晨12 小时前
Ubuntu 服务器无法 ping 通网站域名的问题解决备忘 ——通常与网络配置有关(DNS解析)
linux·运维·服务器·ubuntu·ping·esp32编译服务器·dns域名解析
007php00713 小时前
Jenkins+docker 微服务实现自动化部署安装和部署过程
运维·数据库·git·docker·微服务·自动化·jenkins
路溪非溪14 小时前
嵌入式Linux驱动开发杂项总结
linux·运维·驱动开发