增加了bzip2、和PS1

This commit is contained in:
wzj 2022-11-24 10:15:21 +08:00
parent 296f31f110
commit 9c49f3c8a7

View File

@ -27,7 +27,7 @@ do
\mv /etc/yum.repos.d/${i} /etc/yum.repos.d/bak/${DATE}
done
wget http://mirrors.aliyun.com/repo/Centos-7.repo -O /etc/yum.repos.d/CentOS-Base.repo
wget http://mirrors.aliyun.com/repo/Centos-7.repo -P /etc/yum.repos.d
wget http://mirrors.aliyun.com/repo/Centos-7.repo -P /etc/yum.repos.d/
wget http://mirrors.aliyun.com/repo/epel-7.repo -P /etc/yum.repos.d/
yum clean all
yum makecache
@ -37,7 +37,7 @@ TOOL_INSTALL()
{
echo -e "\033[32m-------------------------------------------- 安装常用工具 --------------------------------------------\033[0m"
sleep 1.5
for TOOL in net-tools lrzsz vim unzip git screen nethogs speedtest-cli lm_sensors
for TOOL in net-tools lrzsz vim unzip git screen nethogs speedtest-cli lm_sensors bzip2
do
echo -e "\033[33m安装${TOOL}...\033[0m"
sleep 1
@ -68,9 +68,38 @@ cp -r /etc/selinux/config /etc/selinux/config.bak
fi
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
}
PS1(){
cat>>/etc/profile<<EOF
##########以下是用户登录及操作记录代码##############
PS1='\e[1;37m[\e[m\e[1;32m\u\e[m\e[1;33m@\e[m\e[1;35m\H\e[m \e[4m`pwd`\e[m\e[1;37m]\e[m\e[1;36m\e[m\n$'
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
if [ "$USER_IP" = "" ]
then
USER_IP=`hostname`
fi
if [ ! -d /var/log/history ]
then
mkdir -p /var/log/history
chmod 777 /var/log/history
fi
if [ ! -d /var/log/history/${LOGNAME} ]
then
mkdir -p /var/log/history/${LOGNAME}
chmod 300 /var/log/history/${LOGNAME}
fi
export HISTSIZE=4096
DT=`date "+%Y-%m-%d_%H:%M:%S"`
export HISTFILE="/var/log/history/${LOGNAME}/${USER_IP}-log.$DT"
chmod 600 /var/log/history/${LOGNAME}/*log* 2>/dev/null
######################代码结束#######################
EOF
source /etc/profile
}
BASE_INSTALL
REPO_REPLACE
TOOL_INSTALL
FIREWALLD
IPTABLES
PS1