#!/bin/bash
##检测网络情况
ping -c 2 www.sdo.com > /dev/null 2>&1
if [ $? -eq 0 ];then
echo ""
else
echo -e "\033[1;31m网络无法连接, 请检查网络\033[0m"
exit 1
fi
# check the OS version
if [ "$(lsb_release -is)" != "Ubuntu" -a "$(lsb_release -cs)" != "jammy" ];then
echo -e "\033[1;31m当前系统版本不支持, 请使用 Ubuntu jammy 版本\033[0m"
exit 2
fi
##SSH远程登录其他主机不进行确认
sed -i 's/# StrictHostKeyChecking ask/StrictHostKeyChecking no/g' /etc/ssh/ssh_config
##安装相关软件
if [ ! -d /etc/apt/bak ]; then
mkdir /etc/apt/bak
cp /etc/apt/sources.list /etc/apt/bak
sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
rm -rf /var/lib/apt/lists/* && apt clean
apt update
apt install -y vim wget bash-completion lrzsz net-tools zip unzip nmap
fi
##关闭防火墙
stop_firewall () {
systemctl stop ufw.service
systemctl disable ufw.service
}
stop_firewall
##配置时间同步
config_chrony () {
apt install chrony -y
cat > /etc/chrony/chrony.conf << EOF
confdir /etc/chrony/conf.d
pool ntp.aliyun.com iburst
pool ntp.tencent.com iburst
keyfile /etc/chrony/chrony.keys
driftfile /var/lib/chrony/chrony.drift
ntsdumpdir /var/lib/chrony
logdir /var/log/chrony
maxupdateskew 1.0
rtcsync
makestep 1 -1
leapsectz Asia/Shanghai
bindcmdaddress 127.0.0.1
EOF
systemctl restart chrony.service
systemctl enable chrony.service
}
config_chrony
##配置时区
timedatectl set-timezone Asia/Shanghai
##关闭ubunut自动更新
sed -i 's/"1"/"0"/g' /etc/apt/apt.conf.d/10periodic
sed -i 's/"1"/"0"/g' /etc/apt/apt.conf.d/20auto-upgrades
##对删除命令进行优化
if [ "$(grep -o rm= /etc/profile)" != "rm=" ]; then
echo 'alias rm="rm -i"' >> /etc/profile
source /etc/profile
fi
##重启
reboot
ubuntu jammy 版本系统优化
原创
©著作权归作者所有:来自51CTO博客作者飞机飞鸡的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:实例出不了外网
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Linux系统Ubuntu部署Python的tensorflow库:CPU+GPU版本
本文介绍在Linux操作系统的发行版本Ubuntu中,配置可以用CPU或GPU运行的Python新版本深度学习库tensorflow的方法~
Linux Ubuntu Python TensorFlow 开发环境 -
Ubuntu的Docker中部署C++与Python版本GDAL
本文介绍在Linux的Ubuntu操作系统中,基于Docker快速配置Python与C++ 这2种不同编程语言可用的地理数据处理库GDAL开发环境的方法~
Ubuntu Docker GDAL C++ Python -
基本系统优化
修改主机名方式一: hostnamectl set-hostname mm (bash解释器)方式二:cat /etc/hostname (重启生效)
linux centos 运维 系统时间 -
织造成本系统
一、织造成本系统功能架构及处理要点 1、功能架构图 2、处理要点说明二、模块功能说明
职场 休闲 织造成本系统