ubuntu20.04初始化的部分操作

本文最后更新于:December 20, 2020 am

本文主要讲解在ubuntu20.04系统安装后需要进行的一些初始化事项。

1、安装ssh服务

1
2
# ubuntu默认情况下需要自己安装ssh服务
sudo apt install openssl-server

2、更换镜像源(清华)

参考的官方链接,Ubuntu 的软件源配置文件是 /etc/apt/sources.list。将系统自带的该文件做个备份,将该文件替换为下面内容,即可使用 TUNA 的软件源镜像。

1
2
3
4
5
6
7
8
9
10
11
12
13
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse

3、防火墙

1
2
3
# 禁用防火墙
tinychen@tiny-server:~$ sudo ufw disable
Firewall stopped and disabled on system startup

4、禁用IPv6

1
2
3
4
echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6=1" >> /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6=1" >> /etc/sysctl.conf
sudo sysctl -p

5、安装nvidia显卡驱动

1
2
3
4
5
6
7
8
9
10
11
12
# 查看显卡型号和推荐安装的驱动
tinychen@tiny-server:~$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:1c.7/0000:08:00.0 ==
modalias : pci:v000010DEd00000A66sv00001B0Asd00009060bc03sc00i00
vendor : NVIDIA Corporation
model : GT218 [GeForce 310]
driver : nvidia-340 - distro non-free recommended
driver : xserver-xorg-video-nouveau - distro free builtin

# 自动安装默认推荐的驱动
tinychen@tiny-server:~$ sudo ubuntu-drivers autoinstall
[sudo] password for tinychen: