Ubuntu:修订间差异
跳到导航
跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
(→安裝) |
(→總結) |
||
(未显示同一用户的28个中间版本) | |||
第4行: | 第4行: | ||
=== apt === | === apt === | ||
先更新系統的套件庫以及系統: | |||
<syntaxhighlight lang="bash"> | |||
sudo apt update; sudo apt upgrade -y | |||
</syntaxhighlight> | |||
這邊列出常用的套件: | 這邊列出常用的套件: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo apt install -y apache2-utils build-essential curl dstat git jq most mtr-tiny p7zip-full sharutils software-properties-common sysstat unrar unzip vim-nox wget zsh zsh-syntax-highlighting; sudo apt clean | 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 | ||
</syntaxhighlight> | |||
跳板機會多裝這些: | |||
<syntaxhighlight lang="bash"> | |||
sudo apt install -y keychain mosh; sudo apt clean | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== 設定 == | == 設定 == | ||
有些機器沒有對應的locale,可以讓系統產生: | |||
<syntaxhighlight lang="bash"> | |||
sudo locale-gen en_US.UTF-8 zh_TW.UTF-8 | |||
</syntaxhighlight> | |||
在VPS或是雲端上的機器通常會利用swapfile增加一些記憶體使用空間: | 在VPS或是雲端上的機器通常會利用swapfile增加一些記憶體使用空間: | ||
第17行: | 第35行: | ||
<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> | |||
然後設定TCP BBR,需要Linux Kernel 4.9+(如果是Ubuntu 16.04,預設是4.4,會需要安裝<code>linux-image-generic-hwe-16.04</code>): | |||
<syntaxhighlight lang="bash"> | |||
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 | |||
</syntaxhighlight> | |||
如果無法使用TCP BBR,可以改用Westwood: | |||
<syntaxhighlight lang="bash"> | |||
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 | |||
</syntaxhighlight> | |||
== 使用者 == | |||
這邊是增加我自己的帳號(以及[[Sudo]]權限),然後設定密碼: | |||
<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/zsh gslin; sudo passwd gslin | |||
</syntaxhighlight> | |||
== 總結 == | |||
<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 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 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== 外部連結 == | == 外部連結 == | ||
* {{Official|https://www.ubuntu.com/}} | |||
* {{Official|https://www.ubuntu.com/}} {{en}} | |||
[[Category:軟體]] | [[Category:軟體]] |
2020年3月29日 (日) 07:56的版本
Ubuntu是一种Linux操作系统。
安装
apt
先更新系统的套件库以及系统:
sudo apt update; sudo apt 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 apt install -y keychain mosh; 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 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
外部链接
- 官方网站 (英文)