- 第一步:制作启动U盘
- 第二步:服务器进入安装程序(U盘)
- 第三步:安装Ubuntu
最近给服务器重装系统,前前后后折腾了不少时间,特地记录一下
硬件需要: windows系统电脑;U盘一个
软件需求:Win32DishImager(写iso至U盘的);系统镜像文件iso
整体分三步:
1. 制作启动U盘
2. 让服务器进入安装程序(U盘)
3. 安装ubuntu
第一步:制作启动U盘
将iso拷到电脑(windosws系统)中某个地方;然后制作U盘启动,这里采用软件win32 disk imager(UltrISO软件制作出错,所以改用此软件)
步骤:
解压,运行Win32DiskImager.exe;
插入U盘;
选择镜像iso,确认Device是你的U盘;
点击Write,开始制作,等待完成;
注意:采用win32diskimager 写入之后,U盘容量会变小!不要担心,依据如下方法即可恢复:
采用win7/8/10电脑,搜索处输入 cmd;右键,管理者身份运行;
DISKPART,按回车,会显示计算机名,及DISKPART>命令行;
LIST DISK,回车,会列出电脑上所有硬盘和U盘;
SELECT DISK 2,回车选定磁盘;
CLEAN,回车删除整个磁盘数据;
CREATE PARTITION PRIMARY,回车创建主磁盘分区;
ACTIVE,回车激活磁盘分区;
FORMAT FS=FAT32 QUICK,回车,以FAT32格式快速格式化磁盘分区;
至此,U盘修复完成;
第二步:服务器进入安装程序(U盘)
首先设置U盘启动项
重启服务器;
按F2 = System Setup;
System BIOS 回车;
Boot Settings 回车;
BIOS Boot Settings 回车;
Boot Sequence 中设置U盘为第一启动项;
(当Boot Sequence中找不到U盘时,从Hard-Disk Drive Sequence中找)
退出,点击yes;
重启时,按F11,进入Boot manager,等待一会儿;
进入Boot manager之后,选择One-Shot BIOS Boot Menu;
接着选择你的U盘,回车即可进入安装界面
第三步:安装Ubuntu
- 选择English
- 选择Install Ubuntu Server
- 选择English
- 选择 United States
- Detect keyboard layout? No
- preimary network interfaces: 选择第一个 eno1 (注意看网线插在哪个口,eno1-4,要对应的选择)
(若网线拔出之后,会报错) - Network Configuration failed. 点击Yes
- Network Configuration method: 选Do not configure the network at this time
- Hostname : 设置ubuntu
- Full name for new user : 设置为 myname
- Username for your accout: 设置为 myname
- Choose a password for the new user: 设置为 lkailkai
- Re-enter password to verify: 你懂的
- Use weak password? : Yes
- Encrypt your home directory ? (是否加密home文件夹?) : No
(若有网线安装,会自动检测时区,供选择) - Select your time zone: Eastern
- Unmount partitions that are in use? Yes ,应为是重装,磁盘已经mount,因此需要unmount.
- Partitioning method: 选择 Guided - use entrie disk and set up LVM
- Select disk to partition: 选择 sda :999.7GB DELL PERC H330 Mini , 另外一个sdb就是U盘啦
- Remove existing logical volume data? Yes
- Write the changes to disks and configure LVM? Yes
- Amout of volume group to use for guided partitioning: 共999G,设置为960G
- Write the changes to disk? Yes
(若有网线会出现,设置HTTP代理,无需填写)
23+. HTTP proxy information(blank for none): 选择 continue - How do you want to manage upgrades on this system? No automatic updates
- Choose software to install: 选择 standard system utilities and OpenSSH server(空格选择,回车continue)
- Install the GRUB boot loader to the master boot record? Yes
- Device for boot loader installation: 选择 /dev/sda
- Installation Complete
- 重启,用账户名 myname 密码: liadmin 登陆
- 设置root密码: 输入命令 sudo passwd ,依据提示进行 . lk123456
重装OpenSSH之后,用电脑远程登陆服务器时,会报错:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:ohZTTHv6Canfsiw/5Qc/a5yDz2vfKUfwp+0ksfCDxeE.
Please contact your system administrator.
Add correct host key in /Users/tingsongyu/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/tingsongyu/.ssh/known_hosts:2
ECDSA host key for 192.168.40.39 has changed and you have requested strict checking.
Host key verification failed.
这是Linux重装或则openssh-server重装引起的,本地计算机执行以下命令即可
ssh-keygen -R IP
eg: ssh-keygen -R 192.168.40.39
把IP换成你要连的服务器就可以了。