-
Notifications
You must be signed in to change notification settings - Fork 1
Linux Alpine相关
Kervin edited this page Jul 5, 2021
·
10 revisions
OS | Vesion | Image | LTS |
---|---|---|---|
Ubuntu | 22.04 | - | √ |
Ubuntu | 21.10 | - | x |
Ubuntu | 21.04 | hirsute | x |
Ubuntu | 20.10 | groovy | x |
Ubuntu | 20.04 | focal | √ |
Ubuntu | 19.10 | eoan | x |
Ubuntu | 19.04 | disco | x |
Ubuntu | 18.10 | cosmic | x |
Ubuntu | 18.04 | bionic | √ |
Ubuntu | 17.10 | artful | x |
Ubuntu | 17.04 | zesty | x |
Ubuntu | 16.10 | yakkety | x |
Ubuntu | 16.04 | xenial | √ |
Ubuntu | 15.10 | wily | x |
Ubuntu | 15.04 | vivid | x |
Ubuntu | 14.04 | trusty | √ |
Ubuntu | 12.04 | precise | √ |
lsb_release -a
输出
root@server:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal
vim /etc/apt/sources.list
# tsinghua
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# aliyun
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
# tsinghua
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# aliyun
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# tsinghua
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-security main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ disco-proposed main restricted universe multiverse
# aliyun
deb http://mirrors.aliyun.com/ubuntu/ disco main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ disco-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ disco-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ disco-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ disco-backports main restricted universe multiverse
# tsinghua
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-proposed main restricted universe multiverse
# aliyun
deb http://mirrors.aliyun.com/ubuntu/ eoan main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ eoan-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ eoan-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ eoan-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ eoan-backports main restricted universe multiverse
#tsinghua
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
#deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
#aliyun
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
#deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
#tencent
deb http://mirrors.cloud.tencent.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.cloud.tencent.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.cloud.tencent.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.cloud.tencent.com/ubuntu/ focal-backports main restricted universe multiverse
#deb http://mirrors.cloud.tencent.com/ubuntu/ focal-proposed main restricted universe multiverse
# 163
deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
#deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
apt-get clean all
apt-get update --fix-missing
apt list --upgradable
apt-get dist-upgrade -y
系统清理
apt-get autoremove -y
apt-get autoclean -y
卸载软件
apt-get autoremove --purge -y xxx
系统升级
apt-get dist-upgrade -y
do-release-upgrade
或
apt upgrade -y
do-release-upgrade --allow-third-party -q -d
若版本不是LTS,无法升级则修改源为低版本的LTS再升级
- 关闭防火墙:通过crontab -e添加@reboot systemctl stop ufw > /dev/null 2>&1进行关闭(/var/spool/cron/crontabs/root)
- 常用插件
apt-get install -y net-tools sysstat htop glances zip gzip curl aptitude apt-transport-https ca-certificates mercurial nfs-common dos2unix
- JDK安装
apt-get install -y openjdk-8-jdk-headless openjdk-8-jdk gedit
curl -sSL https://get.docker.com/ | sh
aptitude install -y docker.io
事件说明
- aptitude也会想apt那样检测到依赖冲突,然后给出一个解决方案将会自动降级安装依赖的软件(如果是一系列软件版本过高的话),这个时候选择同意基本都可以安装成功,不过唯一美中不足的问题在于,这样安装之后的软件版本会比较低,不过好在确实可以用了。
- aptitude在删除一个包时,会同时删除本身所依赖的包。这样,系统中不会残留无用的包,整个系统更为干净
apt-get install sl
sl
systemctl stop docker
apt-get autoremove --purge -y docker-ce
rm -rf /usr/share/bash-completion/completions/docker
rm -rf /usr/bin/docker*
rm -rf /usr/libexec/docker
rm -rf /etc/init.d/docker
rm -rf /etc/default/docker
rm -rf /etc/init/docker.conf
rm -rf /run/docker.sock
rm -rf /var/lib/docker
rm -rf /etc/docker
rm -rf /var/lib/systemd/deb-systemd-helper-enabled/*/docker*
rm -rf /var/lib/systemd/deb-systemd-helper-enabled/docker*
rm -rf /var/crash/docker*
rm -rf /var/cache/apt/archives/docker*
rm -rf /usr/share/doc/docker*
rm -rf /usr/share/fish/vendor_completions.d/docker.fish
rm -rf /usr/share/man/*/docker*
rm -rf /usr/lib/systemd/system/docker*
chattr -R -i /sys/fs/cgroup/*/*/docker*/*
rm -rf /sys/fs/cgroup/*/*/docker*
rm -rf /etc/systemd/system/*/docker*
rm -rf /var/lib/systemd/deb-systemd-helper-enabled/*/containerd*
rm -rf /var/lib/systemd/deb-systemd-helper-enabled/containerd*
rm -rf /var/lib/containerd
rm -rf /usr/share/doc/containerd*
rm -rf /usr/share/man/*/containerd*
rm -rf /usr/bin/containerd*
rm -rf /usr/lib/systemd/system/containerd*
rm -rf /etc/systemd/system/*/containerd*
rm -rf /etc/containerd
rm -rf /run/containerd
rm -rf /opt/containerd
systemctl daemon-reload
#apt-get purge docker.io
# find / -name docker*
# apt-get install -y docker.io
# apt-get remove docker docker-engine docker.io containerd runc
curl -fsSL https://get.docker.com/ | sh
apt-get update
apt-get install -y apt-transport-https ca-certificates curl
curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add
#echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" > /etc/apt/sources.list.d/docker.list
#echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu disco stable" > /etc/apt/sources.list.d/docker.list
#echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu eoan stable" > /etc/apt/sources.list.d/docker.list
echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" > /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y --no-install-recommends docker-ce
#apt-get install -y --no-install-recommends containerd
#apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd
#systemctl daemon-reload & systemctl restart containerd & systemctl restart docker
docker version
ufw disable
swapoff -a
apt-get update
apt-get install -y apt-transport-https ca-certificates curl
curl -fsSL "https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg" | apt-key add
echo "deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-yakkety main" > /etc/apt/sources.list.d/kubernetes.list
apt-get update
apt-get install -y kubelet kubeadm kubectl
snap install microk8s --classic
microk8s.start
microk8s.stop
如启动不起来
#修改pod的sandbox
pod的sandbox 默认是 k8s.gcr.io/pause:3.1,这个镜像是无法获取的。需要将sandbox修改为国内可以获取的镜像。
修改/var/snap/microk8s/current/args/kubelet。 添加--pod-infra-container-image=s7799653/pause:3.1
修改/var/snap/microk8s/current/args/containerd-template.toml的plugins -> plugins.cri -> sandbox_image为s7799653/pause:3.1
重启服务
curl -sfL https://get.k3s.io | sh -
#看一下执行命令
kubectl get nodes
apt-get install -y vsftpd
修改配置(/etc/vsftpd.conf)
#允许匿名访问
anonymous_enable=YES
#匿名目录
anon_root=/data/logs
no_anon_password=YES
重启服务
#/etc/init.d/vsftpd restart
systemctl restart vsftpd
systemctl status vsftpd
访问服务: ftp://127.0.0.1