1. yum私有仓库的实现及博客输出
-
yum -y install httpd
systemctl start httpd
dnf reposync --repoid=epel --download-metadata -p /var/www/html
2.画图 TCP协议和三次握手及四次挥手
3. 静态配置网卡IP,centos/ubuntu实现
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
NAME=eth0
BOOTPROTO=static
IPADDR=10.0.0.7
PREFIX=24
GATEWAY=10.0.0.7
DNS1=10.0.0.2
DNS2=180.76.76.76
ONBOOT=yes
#保存
nmcli connection reload
nmcli connection up eth04.实现免密登陆脚本
#!/bin//bash
PS3="请选择你需要的操作:(1-4)"
HOST=243
yellow () {
RES_COL=60
MOVE_TO_COL="echo -en \\033[${RES_COL}G"
SETCOLOR_SUCCESS="echo -en \\033[1;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_WARNING="echo -en \\033[1;33m"
SETCOLOR_NORMAL="echo -en \e[0m"
echo -n "$1" && $MOVE_TO_COL
echo -n "["
if [ $2 = "success" -o $2 = "0" ];then
${SETCOLOR_SUCCESS}
echo -n $" OK "
elif [ $2 = "failure" -o $2 = "1" ];then
${SETCOLOR_FAILURE}
echo -n $"FAILED"
else
${SETCOLOR_WARNING}
echo $"WARNING"
fi
${SETCOLOR_NORMAL}
echo -n "]"
echo
}
touch_public () {
ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa > /dev/null
}
yum_apache () {
yum -y install apache
}
yum_mysql () {
yum -y install mariadb-server
}
ssh_host () {
ssh 192.168.230.${HOST}
}
rpm -q expect &> /dev/null || yum -y install expect &> /dev/null
touch_public
expect << EOF
spawn ssh-copy-id 192.168.230.${HOST}
expect {
"yes/no" { send "yes\n";exp_continue }
"password:" { send "123\n" }
}
expect eof
EOF
ssh_host () {
ssh 192.168.230.${HOST}
}
select service in 安装mysql 安装apache 免密钥登入主机 退出选择; do
case $REPLY in
1)
yum_mysql
color mysql 0
;;
2)
yum_apache
color apache 0
;;
3)
ssh_host
color 免密登入 0
;;
4)
echo "成功退出"
break
;;
*)
echo "未知选择,请重新选择"
;;
esac
done