一、安装好新系统之后,先安装几个重要工具
进入终端,使用sudo su登录管理员进行操作
使用vim编辑,不要问为啥,vi真难用,55555.....
apt-get install vim
新系统无法用ifconfig查看网络
apt-get install net-tools
二、换源(这里用的是阿里云的源)
打开源文件目录
cd /etc/apt/
先备份一下原始源
cp source.list source.list.backup
修改源文件
vim source.list
将里面所有内容删掉,删干净,是所有!!!
将下面内容复制进去并保存退出:
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal universe
deb http://mirrors.aliyun.com/ubuntu/ focal-updates universe
deb http://mirrors.aliyun.com/ubuntu/ focal multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal-security universe
deb http://mirrors.aliyun.com/ubuntu/ focal-security multiverse
保存后,即可执行更新
apt update
apt upgrade
这里也提供清华源的地址:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
三、固定IP
使用ifconfig查看网卡和当前IP地址
ifconfig
可以看到网卡为ens33,IP地址为192.168.174.131
修改网络配置文件
cd /etc/netplan/
修改配置文件
vim 01-network-manager-all.yaml
network:
version: 2
renderer: NetworkManager
ethernets:
ens33: #配置的网卡名称,使用ifconfig -a查看得到
dhcp4: no #dhcp4关闭
optional: true
addresses: [192.168.174.100/24] #设置本机IP及掩码
gateway4: 192.168.174.2 #设置网关
nameservers:
addresses: [192.168.174.2,8.8.8.8,114,114,114,114] #设置DNS
退出并保持后,重启网络服务
netplan apply
再使用ifconfig查看IP地址是否修改成功
四、连接Xshell
查看ssh服务,
ps -e|grep ssh
如果只出现ssh -agent,没有sshd就还需要安装openssh-server
apt-get install openssh-server
启动服务
service ssh start
再次输入ps -e|grep ssh查看服务,应该ssh -agent和sshd都有了
咋子就可以用Xshell连接了,使用用户名和密码登录