Linux基础-模板机优化

1.selinux和firewalld关闭
//临时关闭selinux,立即生效
[root@wll ~]# setenforce 0
[root@wll ~]# getenforce
Disabled
//永久关闭selinux,重启生效
[root@wll ~]#sed -i 's#SELINUX=disabled#SELINUX=enforcing#g' /etc/selinux/config

//临时关闭firewalld,立即生效
[root@wll yum.repos.d]# systemctl stop firewalld
//永久关闭firewalld,重启生效
[root@wll yum.repos.d]# systemctl disable firewalld

2.yum源
[root@wll ~]# cd /etc/yum.repos.d/
[root@wll yum.repos.d]#mkdir repo_bak && cp * repo_bak

//base
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
//epel
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
//nginx
[root@wll ~]# vim nginx.repo

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

//mysql
yum install -y https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
//zabbix
rpm -i https://repo.zabbix.com/zabbix/3.4/rhel/6/x86_64/zabbix-release-3.4-1.el6.noarch.rpm

3.sshd
UseDNS # 是否进行dns反向解析,影响ssh连接效率参数
GSSAPIAuthentication # 是否进行认证,影响ssh连接效率参数

都改成no

4.vimrc设置
/etc/vimrc
set nu

5.bashrc设置
/etc/bashrc

echo "################################################################"
df -h
echo "################################################################"
echo $(hostname)$(hostname -I)$USER
echo "################################################################"

起别名,简化yum安装软件包的命令

alias yy='yum install -y'

source /etc/bashrc

6.yum安装bash补全,git工具
yum install -y git bash-completion*

7.简化yum下载命令,下载软件包可以使用yy package(临时生效)
[root@wll ~]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@wll ~]# alias yy='yum install -y'
[root@wll ~]# yy tree

原文地址:https://www.cnblogs.com/s-sx/p/11840152.html