01@架构系统基础优化
系统优化
[root@localhost ~]# cat >> /etc/hosts <<EOF
192.168.15.5 172.16.1.5 lb01
192.168.15.6 172.16.1.6 lb02
192.168.15.7 172.16.1.7 web01
192.168.15.8 172.16.1.8 web02
192.168.15.9 172.16.1.9 web03
192.168.15.31 172.16.1.31 nfs
192.168.15.41 172.16.1.41 backup
192.168.15.51 172.16.1.51 db01
192.168.15.61 172.16.1.61 m01
192.168.15.71 172.16.1.71 zabbix prometheus
EOF
[root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1775 0 1775 0 0 5637 0 --:--:-- --:--:-- --:--:-- 5652
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
[root@localhost yum.repos.d]# yum makecache
# 创建自动化修改IP、主机名脚本
[root@template opt]# cat changeIp
#!/bin/bash
sed -i "s#.100#.$1#g" /etc/sysconfig/network-scripts/ifcfg-eth[01]
hostnamectl set-hostname $2
systemctl restart network
# 安装基础软件包
[root@template opt]# yum install net-tools vim tree htop iftop \
iotop lrzsz sl wget unzip telnet nmap nc psmisc \
dos2unix bash-completion bash-completion-extra sysstat \
rsync nfs-utils httpd-tools -y
# 3.关闭防⽕墙firewalld
[root@template opt]# systemctl disable --now firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
# 关闭Selinux
[root@template opt]# sed -i '/^SELINUX=/c SELINUX=disabled' /etc/selinux/config
# 5.调整单个进程最⼤能打开⽂件的数量
[root@template opt]# echo '* - nofile 65535' >> /etc/security/limits.conf
本文来自博客园,作者:ଲ一笑奈&何,转载请注明原文链接:https://www.cnblogs.com/zeny/p/15121588.html