linux 系统基础优化(测试环境)
#PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
PermitRootLogin yes
PasswordAuthentication yes
hostnamectl set-hostname "修改主机名称:"
systemctl stop firewalld NetworkManager
systemctl disable firewalld NetworkManager
#会和网卡冲突的服务
systemctl stop avahi-daemon.socket
systemctl disable avahi-daemon.service
sudo systemctl stop avahi-daemon
sudo systemctl disable avahi-daemon
echo '* - nofile 65535' >> /etc/security/limits.conf
setenforce 0
sed -i '/^SELINUX=/c SELINUX=disabled' /etc/selinux/config #关闭selinx
sed -ri 's#(.*UseDNS.*)#\1\nUseDNS no#g' /etc/ssh/sshd_config
mkdir -p /tmp/yum.repo/; mv /etc/yum.repos.d/* /tmp/yum.repo/
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum -y install bash-completion bash-completion-extras net-tools telnet lrzsz sshd vim wget zip uzip #安装基础软件 1
yum -y install expect tree nc nmap tree dos2unix htop iftop iotop psmisc nethogs glances bc #基础软件2
echo 'PS1="\[\e[01;31m\][\[\e[01;34m\]\u\[\e[01;32m\]@\h \[\e[01;35m\]\W\[\e[01;33m\]]\\$\[\e[0m\]"' >> /etc/profile ; source /etc/profile
read -p "输入IP末尾:" IP
w_IP=10.0.0.$IP
n_IP=172.16.1.$IP
sed -i "/^IPADDR/c IPADDR="$w_IP /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i "/^IPADDR/c IPADDR="$n_IP /etc/sysconfig/network-scripts/ifcfg-eth1
echo "$w_IP $n_IP"
echo "正在重启"
init 6
grep -H 在匹配到结果左边显示文件名
grep -r 多级目录匹配
yum install --downloadonly --downloaddir=/opt/ntp ntp
lsblk -f
df -THi
sudo systemctl set-default graphical.target #默认开启图形化界面
sudo systemctl set-default multi-user.target #默认开启命令行界面
PasswordAuthentication
禁止cetnos命令行提示音
修改配置文件
vi /etc/inputrc
//去掉‘#’注释,并将none修改为off,对应指令如下(就在开头)
set bell-style none 改为 set bell-style off

浙公网安备 33010602011771号