在本地,安装操作系统Ubuntu,步骤如下:

1. 安装步骤

(1)下载操作系统镜像文件

从Ubuntu官网下载Ubuntu Server版,Get Ubuntu Server | Download,Option 2 - Manual server installation, 下载最新版的LTS,比如ubuntu-20.04.4-live-server-amd64.iso

(2)制作USB系统启动盘

有很多工具可以制作U盘启动盘,可以使用Rufus(便携、轻量级),直接从官网下载。下载完,打开,按下图所示制作启动盘。

rufus-ubuntu

(3)安装操作系统

修改BIOS启动。首先,进入BIOS,将USB放到boot启动顺序的首位,禁用安全启动、使用UEFI模式。

  • 进入BIOS,禁用安全启动(Secure Boot),找到Secure Boot --> Disabled
  • 选择UEFI模式,而不是Legacy。比如在Dell台式机中,设置在Settings --> Boot Sequence --> Boot List Operation --> UEFI

保存退出BIOS,重启计算机,安装Ubuntu服务版,Ubuntu安装指南见:Install Ubuntu Server

2. 遇到问题及解决

安装过程中,提示错误”Block probing did not discover any disks.“,如下图:

Guided storage configuration

原因是找不到硬盘,解决方法:再次进入到BIOS,在System Configuration --> SATA Operation,将硬盘操作改为AHCI模式。

3. 配置静态IP地址

找学校申请一个固定IP地址,

1.VLAN:4017-1911-3009-
2.IP:172.24.216.83,子网掩码:255.255.224.0,网关:172.24.192.1

在服务器上,运行命令ip a查看网卡名称。

打开文件/etc/netplan/01-installer-config.yaml,关闭DHCP,并添加如下内容(enp2so为网卡名称):

network:
  ethernets:
    enp2so:     
      addresses: [172.24.216.83/19]    
      dhcp4: no  
      optional: true
      gateway4: 172.24.192.1    
      nameservers:
         addresses: [210.34.128.33,210.34.128.32]    
  version: 2

保存退出后,运行如下命令,让配置生效。

sudo netplan apply

注:服务器重启后,也需要运行上行命令。

4. 允许root用户登录SSH

用安装实例的用户名登录,默认为ubuntu,为root用户设置密码。

$ sudo passwd root
New password: 
Retype new password: 
passwd: password updated successfully

打开文件/etc/ssh/sshd_config,找到PermitRootLogin,将值改为yes

PermitRootLogin yes

重启ssh服务器,

sudo service ssh restart

5. 其他配置

运行命令timedatectl输出系统的日期时间时区信息。

# timedatectl
               Local time: Tue 2022-05-17 15:53:18 UTC
           Universal time: Tue 2022-05-17 15:53:18 UTC
                 RTC time: Tue 2022-05-17 15:53:18
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

运行命令timedatectl list-timezones列出所有时区,再用grep工具过滤下,找到自己的时区,这里有Asia/Shanghai

timedatectl list-timezones | grep -i 'Asia'

设置时区,

sudo timedatectl set-timezone Asia/Shanghai
本文系Spark & Shine原创,转载需注明出处本文最近一次修改时间 2023-04-11 16:38

results matching ""

    No results matching ""