Ubuntu:修订间差异
跳到导航
跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
(→apt) |
(→安裝) |
||
(未显示同一用户的42个中间版本) | |||
第1行: | 第1行: | ||
'''Ubuntu'''是一種[[Linux]]作業系統。 | '''Ubuntu'''是一種[[Linux]]作業系統。 | ||
== 移除 == | |||
目前社群的建議都是先移除掉Snap: | |||
<syntaxhighlight lang="bash"> | |||
sudo apt purge -y snapd | |||
</syntaxhighlight> | |||
並且關閉廣告訊息: | |||
<syntaxhighlight lang="bash"> | |||
sudo pro config set apt_news=false | |||
</syntaxhighlight> | |||
然後刪除ESM的廣告: | |||
<syntaxhighlight lang="bash"> | |||
sudo rm -f /etc/apt/apt.conf.d/20apt-esm-hook.conf | |||
</syntaxhighlight> | |||
== 安裝 == | == 安裝 == | ||
第5行: | 第25行: | ||
=== apt === | === apt === | ||
先更新系統的套件庫: | 先更新系統的套件庫 以及系統 : | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
第14行: | 第34行: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo apt install -y apache2-utils apt-transport-https build-essential curl dnsutils dstat git jq locales moreutils most mtr-tiny net-tools p7zip-full pigz rsync sharutils software-properties-common sysstat unrar unzip vim-nox wget | sudo apt install -y apache2-utils apt-transport-https bash-completion bpfcc-tools build-essential curl dnsutils dstat git jq locales moreutils most mtr-tiny net-tools netcat p7zip-full pigz prometheus-node-exporter rsync sharutils software-properties-common sysstat telnet unrar unzip vim-nox wget zstd; sudo apt clean | ||
</syntaxhighlight> | </syntaxhighlight> | ||
第20行: | 第40行: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo apt install -y keychain mosh; sudo apt clean | sudo apt install -y byobu keychain mosh zsh zsh-syntax-highlighting; sudo apt clean | ||
</syntaxhighlight> | |||
開發機可以裝這些: | |||
<syntaxhighlight lang="bash"> | |||
sudo apt install -y build-essential byobu cmake cvs debhelper default-jdk devscripts git-flow golang mercurial nasm python3-minimal subversion; sudo apt clean | |||
</syntaxhighlight> | </syntaxhighlight> | ||
第35行: | 第61行: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo fallocate -l 512M /swapfile; sudo chmod 600 /swapfile; sudo mkswap /swapfile; sudo swapon /swapfile; echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | sudo fallocate -l 512M /swapfile; sudo chmod 600 /swapfile; sudo mkswap /swapfile; sudo swapon /swapfile; echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | ||
</syntaxhighlight> | |||
但還是要避免使用到Swap: | |||
<syntaxhighlight lang="bash"> | |||
echo "vm.swappiness=1" | sudo tee /etc/sysctl.d/99-vm.conf; sudo sysctl -p /etc/sysctl.d/99-vm.conf | |||
</syntaxhighlight> | </syntaxhighlight> | ||
第54行: | 第86行: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
echo "gslin ALL = (ALL:ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/gslin; sudo useradd -g staff -G adm,sudo -m -s /bin/ | echo "gslin ALL = (ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/gslin; sudo useradd -g staff -G adm,sudo -m -s /bin/bash gslin; sudo passwd gslin | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== 總結 == | == 總結 == | ||
一般性的快速安裝: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo fallocate -l 512M /swapfile; sudo chmod 600 /swapfile; sudo mkswap /swapfile; sudo swapon /swapfile; echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab; echo -e "net.core.default_qdisc=fq\nnet.ipv4.tcp_congestion_control=bbr" | sudo tee /etc/sysctl.d/99-tcp.conf; sudo sysctl -p /etc/sysctl.d/99-tcp.conf; sudo apt update; sudo apt install -y apache2-utils apt-transport-https build-essential curl dnsutils dstat git jq locales moreutils most mtr-tiny net-tools p7zip-full pigz rsync sharutils software-properties-common sysstat unrar unzip vim-nox wget | sudo fallocate -l 512M /swapfile; sudo chmod 600 /swapfile; sudo mkswap /swapfile; sudo swapon /swapfile; echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab; echo "vm.swappiness=1" | sudo tee /etc/sysctl.d/99-vm.conf; sudo sysctl -p /etc/sysctl.d/99-vm.conf; echo -e "net.core.default_qdisc=fq\nnet.ipv4.tcp_congestion_control=bbr" | sudo tee /etc/sysctl.d/99-tcp.conf; sudo sysctl -p /etc/sysctl.d/99-tcp.conf; sudo pro config set apt_news=false; sudo rm -f /etc/apt/apt.conf.d/20apt-esm-hook.conf; sudo apt update; sudo apt purge -y snapd; sudo apt dist-upgrade -y; sudo apt install -y apache2-utils apt-transport-https bash-completion bpfcc-tools build-essential curl dnsutils dstat git jq locales moreutils most mtr-tiny net-tools netcat p7zip-full pigz prometheus-node-exporter rsync sharutils software-properties-common sysstat telnet unrar unzip vim-nox wget zstd; sudo apt clean; sudo locale-gen en_US.UTF-8 zh_TW.UTF-8 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
2023年5月26日 (五) 14:40的版本
Ubuntu是一种Linux操作系统。
移除
目前社群的建议都是先移除掉Snap:
sudo apt purge -y snapd
并且关闭广告讯息:
sudo pro config set apt_news=false
然后删除ESM的广告:
sudo rm -f /etc/apt/apt.conf.d/20apt-esm-hook.conf
安装
apt
先更新系统的套件库以及系统:
sudo apt update; sudo apt upgrade -y
这边列出常用的套件:
sudo apt install -y apache2-utils apt-transport-https bash-completion bpfcc-tools build-essential curl dnsutils dstat git jq locales moreutils most mtr-tiny net-tools netcat p7zip-full pigz prometheus-node-exporter rsync sharutils software-properties-common sysstat telnet unrar unzip vim-nox wget zstd; sudo apt clean
跳板机会多装这些:
sudo apt install -y byobu keychain mosh zsh zsh-syntax-highlighting; sudo apt clean
开发机可以装这些:
sudo apt install -y build-essential byobu cmake cvs debhelper default-jdk devscripts git-flow golang mercurial nasm python3-minimal subversion; sudo apt clean
设定
有些机器没有对应的locale,可以让系统产生:
sudo locale-gen en_US.UTF-8 zh_TW.UTF-8
在VPS或是云端上的机器通常会利用swapfile增加一些内存使用空间:
sudo fallocate -l 512M /swapfile; sudo chmod 600 /swapfile; sudo mkswap /swapfile; sudo swapon /swapfile; echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
但还是要避免使用到Swap:
echo "vm.swappiness=1" | sudo tee /etc/sysctl.d/99-vm.conf; sudo sysctl -p /etc/sysctl.d/99-vm.conf
然后设定TCP BBR,需要Linux Kernel 4.9+(如果是Ubuntu 16.04,预设是4.4,会需要安装linux-image-generic-hwe-16.04
):
echo -e "net.core.default_qdisc=fq\nnet.ipv4.tcp_congestion_control=bbr" | sudo tee /etc/sysctl.d/99-tcp.conf; sudo sysctl -p /etc/sysctl.d/99-tcp.conf
如果无法使用TCP BBR,可以改用Westwood:
echo -e "net.ipv4.tcp_congestion_control=westwood" | sudo tee /etc/sysctl.d/99-tcp.conf; sudo sysctl -p /etc/sysctl.d/99-tcp.conf
使用者
这边是增加我自己的账号(以及Sudo权限),然后设定密码:
echo "gslin ALL = (ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/gslin; sudo useradd -g staff -G adm,sudo -m -s /bin/bash gslin; sudo passwd gslin
总结
一般性的快速安装:
sudo fallocate -l 512M /swapfile; sudo chmod 600 /swapfile; sudo mkswap /swapfile; sudo swapon /swapfile; echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab; echo "vm.swappiness=1" | sudo tee /etc/sysctl.d/99-vm.conf; sudo sysctl -p /etc/sysctl.d/99-vm.conf; echo -e "net.core.default_qdisc=fq\nnet.ipv4.tcp_congestion_control=bbr" | sudo tee /etc/sysctl.d/99-tcp.conf; sudo sysctl -p /etc/sysctl.d/99-tcp.conf; sudo pro config set apt_news=false; sudo rm -f /etc/apt/apt.conf.d/20apt-esm-hook.conf; sudo apt update; sudo apt purge -y snapd; sudo apt dist-upgrade -y; sudo apt install -y apache2-utils apt-transport-https bash-completion bpfcc-tools build-essential curl dnsutils dstat git jq locales moreutils most mtr-tiny net-tools netcat p7zip-full pigz prometheus-node-exporter rsync sharutils software-properties-common sysstat telnet unrar unzip vim-nox wget zstd; sudo apt clean; sudo locale-gen en_US.UTF-8 zh_TW.UTF-8
外部链接
- 官方网站 (英文)