「Ubuntu」:修訂間差異

出自Gea-Suan Lin's Wiki
跳至導覽 跳至搜尋
本頁面具有訪問限制。如果您看見此訊息,這代表您沒有訪問本頁面的權限。
(未顯示同一使用者於中間所作的 1 次修訂)
行 14: 行 14:


<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 prometheus-node-exporter rsync sharutils software-properties-common sysstat unrar unzip vim-nox wget zsh zsh-syntax-highlighting zstd; sudo apt clean
sudo apt install -y apache2-utils apt-transport-https bpfcc-tools build-essential curl dnsutils dstat git jq locales moreutils most mtr-tiny net-tools p7zip-full pigz prometheus-node-exporter rsync sharutils software-properties-common sysstat unrar unzip vim-nox wget zsh zsh-syntax-highlighting zstd; sudo apt clean
</syntaxhighlight>
</syntaxhighlight>


行 68: 行 68:


<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 dist-upgrade -y; 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 prometheus-node-exporter rsync sharutils software-properties-common sysstat unrar unzip vim-nox wget zsh zsh-syntax-highlighting zstd; sudo apt clean
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 dist-upgrade -y; sudo apt install -y apache2-utils apt-transport-https bpfcc-tools build-essential curl dnsutils dstat git jq locales moreutils most mtr-tiny net-tools p7zip-full pigz prometheus-node-exporter rsync sharutils software-properties-common sysstat unrar unzip vim-nox wget zsh zsh-syntax-highlighting zstd; sudo apt clean
</syntaxhighlight>
</syntaxhighlight>



於 2021年9月19日 (日) 09:45 的修訂

Ubuntu是一種Linux作業系統。

安裝

apt

先更新系統的套件庫以及系統:

sudo apt update; sudo apt upgrade -y

這邊列出常用的套件:

sudo apt install -y apache2-utils apt-transport-https bpfcc-tools build-essential curl dnsutils dstat git jq locales moreutils most mtr-tiny net-tools p7zip-full pigz prometheus-node-exporter rsync sharutils software-properties-common sysstat unrar unzip vim-nox wget zsh zsh-syntax-highlighting zstd; sudo apt clean

跳板機會多裝這些:

sudo apt install -y keychain mosh; sudo apt clean

開發機可以裝這些:

sudo apt install -y build-essential cmake debhelper default-jdk devscripts golang python3-minimal; 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

然後設定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" | tee /etc/sudoers.d/gslin; sudo useradd -g staff -G adm,sudo -m -s /bin/zsh 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 -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 dist-upgrade -y; sudo apt install -y apache2-utils apt-transport-https bpfcc-tools build-essential curl dnsutils dstat git jq locales moreutils most mtr-tiny net-tools p7zip-full pigz prometheus-node-exporter rsync sharutils software-properties-common sysstat unrar unzip vim-nox wget zsh zsh-syntax-highlighting zstd; sudo apt clean

外部連結