使用windows disk genius 先清空要安装的系统盘
系统安装
1. 选择语言
2. 选择键盘布局
3. 选择ubuntu server
Tip
不要使用最小化安装minimized 这个版本不含驱动和基础软件
4. 网络设置
跳过
5. 代理设置
跳过
6. 镜像源设置
跳过
7. 选择安装盘
8. 确认盘符架构
(可选)调整盘符大小到1T 方便后续copy
提示格式化
9. 创建名字、系统名、账号、密码
Your name : ev
Your Servers name : ubuntu-test
pick a username: ev
choose a password : 123
confirm your password : 123
10. ubuntu pro登录
跳过
11. openSSHserver安装
空格勾选 install openSSH server
12. 开始安装
提示installation complete后
选择reboot now
13. 拔掉安装U盘 enter后 自动重启
系统内
1. 启用root账号
登录系统后 使用如下指令进行root账户初始化
sudo passwd root
依次输入当前用户密码、root账户密码、重复root账户密码
完成 提示 密码变更成功
2. 登录root 账户
使用 su root 并输入root密码
登录root账户
3.固定ip设置
root账户登录后
查看网卡名称
ip addr
3.1 net plan 管理(推荐)
编辑如下文档
vi /etc/netplan/01-netcfg.yaml
如果目录没有 则先创建
sudo touch /etc/netplan/01-netcfg.yaml
# /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
ens33: # 替换为你的接口名称 静态ip设置
dhcp4: no
addresses: [192.168.1.100/24] # 设置你的IP地址和子网掩码
gateway4: 192.168.1.1 # 设置网关地址 直连时留空
nameservers:
addresses: [8.8.8.8, 8.8.4.4] # 设置DNS服务器地址 直连时留空
all-usb-ethernet: #全局匹配USB网卡名称 然后dhcp4自适应
match:
name: "enx*"
dhcp4: true
optional: true
保存并退出
wq
应用新的网络配置
#sudo netplan generate
sudo netplan apply
如果有如下提示
permissions for /etc/netplan/01-netcfg.yaml are too open netplan configuration should not be accessible by others
则先使用如下命令
sudo chown root:root /etc/netplan/01-netcfg.yaml
sudo chmod 600 /etc/netplan/01-netcfg.yaml
3.2 network管理
编辑如下文件
vi /etc/network/interfaces
auto ens33 # 替换为你的接口名称
iface ens33 inet static
address 192.168.1.100 # 设置你的IP地址
netmask 255.255.255.0 # 设置子网掩码
gateway 192.168.1.1 # 设置网关地址 直连时留空
dns-nameservers 8.8.8.8 8.8.4.4 # 设置DNS服务器地址 直连时留空
保存并退出
wq
重启网络服务
sudo systemctl restart networking
4. 设置root账户自动登录
使用如下指令编辑文件
sudo systemctl edit getty@tty1.service
新增如下内容
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear %I $TERM
位置需要添加到指定位置 如下
### Editing /etc/systemd/system/getty@tty1.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear %I $TERM
### Lines below this comment will be discarded
### /usr/lib/systemd/system/getty@.service
# [Unit]
# ...
保存文件
ctrl+s
退出文件
ctrl+x
重新载入配置文件
sudo systemctl daemon-reload
使用如下指令重新tty1 测试root账户是否自动登录
sudo systemctl restart getty@tty1.service
5. 设置系统时间
默认系统内时间与bios内相同
如遇到OS时间与实际不符 需改成测试时间 防止客户追问
时区查看
timedatectl status
时区列表
timedatectl list-timezones
时区设置
timedatectl set-timezone Asia/Shanghai
时间查看
date
时间设置
date -s "YYYY-MM-DD HH:MM:SS"
6. SOL设置
7. SOL设置后系统卡在网口加载
报错log
[ OK ] Started snapd.service - Snap Daemon.
[ OK ] Started ModemManager.service - Modem Manager.
[ OK ] Finished grub-initrd-fallback.service - GRUB failed boot detection.
Starting systemd-timedated.service - Time & Date Service...
[ OK ] Started systemd-timedated.service - Time & Date Service.
[ OK ] Finished snapd.seeded.service - Wait until snapd is fully seeded.
[*** ] Job systemd-networkd-wait-online.se…ice/start running (55s / no limit)
解决方法
关闭networkd-wait-online服务
sudo systemctl mask systemd-networkd-wait-online.service
如需要恢复服务
sudo systemctl unmask systemd-networkd-wait-online.service
sudo systemctl enable systemd-networkd-wait-online.service