ubuntu国内下载源

免密登陆root的用户名& root终端字颜色
#!/bin/bash
NOW_USER_NAME=$(whoami)
NOW_USER_HOME=$(echo ~)
NOW_USER_HOME_BASHRC="$NOW_USER_HOME/.bashrc"

if [[ $NOW_USER_NAME != "root" ]];then

exec_shell='echo "'"$NOW_USER_NAME"' ALL=(ALL) NOPASSWD: NOPASSWD: ALL" >  "/etc/sudoers.d/'"$NOW_USER_NAME"'"'
su root -c "$exec_shell"


if [[ -c  /etc/.color.bashrc ]];then

sudo su <<HERE
sudo cp $NOW_USER_HOME_BASHRC /etc/.color.bashrc
sudo echo '. /etc/.color.bashrc' >> /root/.bashrc
sudo echo "sudo su" >> $NOW_USER_HOME_BASHRC
HERE

fi

fi

sudo su
查看系统版本Codename
lsb_release -a
vi /etc/apt/sources.list
元配置中所有jammy替换为当前系统Codename
# 阿里源
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
linux mint sylvia版
# 阿里镜像站
deb http://mirrors.ustc.edu.cn/linuxmint sylvia main upstream import backport 
deb http://mirrors.ustc.edu.cn/ubuntu bionic main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu bionic-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ xenial partner
添加需要的密钥
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
更新源
sudo apt update
更新系统依赖
sudo apt --fix-broken install
sudo apt-get upgrade
解决依赖冲突
先试下卸载当前冲突包
sudo apt purge <冲突包名>
不能卸载再执行
sudo apt-get -f install
sudo apt autoremove
手动删除破损包
sudo dpkg --remove --force-remove-reinstreq 包名

你可能感兴趣的:(ubuntu,服务器,linux)