##删掉home和swap默认逻辑卷并扩容根目录 sed -i s#' rd.lvm.lv=centos/swap'##g /etc/grub2.cfg /boot/grub2/grub.cfg sed -i '/swap\|home/d' /etc/fstab umount /home swapoff -a lvremove -f /dev/centos/swap lvremove -f /dev/centos/home #lvextend -l +100%free /dev/centos/root xfs_growfs /dev/centos/root #停止防火墙 systemctl disable firewalld systemctl stop firewalld systemctl disable NetworkManager systemctl stop NetworkManager #禁用selinux sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config setenforce 0 #增强历史命令 echo 'UserIP=$(who -u am i | cut -d"(" -f 2 | sed -e "s/[()]//g")' | sudo tee -a /etc/profile echo 'export HISTTIMEFORMAT="[%F %T] [${UserIP}] "' | sudo tee -a /etc/profile #echo 'TMOUT=1800'|sudo tee -a /etc/profile #配置yum源和工具 timedatectl set-timezone Asia/Shanghai curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo yum install zip unzip telnet wget lrzsz ntpdate net-tools chrony bash-completion yum-utils nfs-utils tree -y yum-config-manager --add-repo http://mirrors.aliyun.com/repo/epel-7.repo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo #时间同步 systemctl enable chronyd sed -i '/^server/s/^/#/g' /etc/chrony.conf sed -i '/Please consider/a\server ntp.aliyun.com iburst\nserver ntp1.aliyun.com iburst\nserver ntp2.aliyun.com iburst\nserver ntp3.aliyun.com iburst' /etc/chrony.conf systemctl restart chronyd chronyc sources -v chronyc tracking hwclock -w #配置ssh sed -i '/AddressFamily/iPort 22' /etc/ssh/sshd_config sed -i '/AddressFamily/iPort 5837' /etc/ssh/sshd_config systemctl restart sshd #创建用户 sed -i '/Same thing without/{n;d}' /etc/sudoers sed -i '/Same thing without/a\ %wheel ALL=(ALL) NOPASSWD: ALL' /etc/sudoers sed -i '/Allows people in group/{n;d}' /etc/sudoers sed -i '/Allows people in group/a# %wheel ALL=(ALL) ALL' /etc/sudoers useradd yunwei -G wheel #echo 'honojn0#UrpQ!UHj'|passwd --stdin root echo 'Cptbtptp999gml'|passwd --stdin root echo 'O2gff2KST@!mNTm$'|passwd --stdin yunwei #私钥服务器192.168.3.1 root mkdir -p /root/.ssh echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCXEni+ljY1ve8vG4pQN8sqUz9Bn75MJQTrPlbj6m0m/hwtg50IAO8L2aUKaih9kDgdBD8F0kUPOnqe915N5w/QJXU71GF5M8ds7JGWh3alLssmdEvHyji2E8K+4LlDCIAvPNImCQ4syH3tny8l7sdIOtCxcvgXG60CEmVAmMCqWwkxTPUW0Xk3oa4Roz2BIXW/fcAY1tE+3TJlTAUK3yD9wbBAOHjZD1gqKNXLxHIUhEl6jtSfCQbXOt5kC8Xasa8o0qmRFIWo377jT/5/clHkYikbKb4ae3uXW3Fl83PviDV+/dAouS/8IrqCxLcjFxeVPwh8hwjUjMpCguMV8s3hLktp51wJZd1Rj3s1P5KJC4IOH3IiYeau6ZFEfqn529y+POQelLRcY+RXzd/yl14e3tKf1Crbhpqh2Y+wqHQhKaFWztGY0lLXY7ZDjsdHiRRI0jOaxv6gTg8UhCvFAs12dUn2D+RXOGO5rrnob6rejXmKA1B39ed7EG9CTbtVm5MNBs9NLJGvrXvcevnX/N9MjZn1RRFB/e+WU+cIihPR4M19qoL8owjFIxojyYLVxJKcwfQ3cdkGJA3wgrFXiaEgWdTyGfRridF9LjaA/IFMWCW3XB8vsooNBhdklAP+galAos9zMfYk0AFctsactQ/j3e9Cy/9ncogbrB8XMhA9sQ== root@jump' >>/root/.ssh/authorized_keys #更新软件包 yum upgrade --exclude=kernel* -y #安装监控客户端 ###d0-test curl https://zhengyu1992.cn/file/exporter/script-exporter/script-exporter-install.sh|bash curl https://zhengyu1992.cn/file/exporter/node_exporter/node_exporter-install.sh|bash curl https://zhengyu1992.cn/file/deploy/monitoring/consul/d0-script-exporter-res.sh|bash curl https://zhengyu1992.cn/file/deploy/monitoring/consul/d0-node-exporter-res.sh|bash ###d1-prod curl https://zhengyu1992.cn/file/exporter/script-exporter/script-exporter-install.sh|bash curl https://zhengyu1992.cn/file/exporter/node_exporter/node_exporter-install.sh|bash curl https://zhengyu1992.cn/file/deploy/monitoring/consul/d1-script-exporter-res.sh|bash curl https://zhengyu1992.cn/file/deploy/monitoring/consul/d1-node-exporter-res.sh|bash ##数据库 curl https://zhengyu1992.cn/file/exporter/script-exporter/script-exporter-install.sh|bash curl https://zhengyu1992.cn/file/exporter/node_exporter/node_exporter-install.sh|bash curl https://zhengyu1992.cn/file/install/dbinstall.sh|bash -s 数据库用途(支持中文)