ubuntu 22.04 server 安装 和 初始化 LTS

ubuntu 22.04 server 安装 和 初始化

下载地址

https://releases.ubuntu.com/jammy/

使用的镜像是

ubuntu-22.04.5-live-server-amd64.iso

usb 启动盘制作工具

https://rufus.ie/zh/

rufus-4.6p.exe

需要主板 支持 UEFI 启动

Ubuntu22.04.4-server安装 流程

https://blog.csdn.net/q276250281/article/details/141363313

从上到下依次为:你的名称,计算机名称,用户名,密码,确认密码;

选择安装openssh后,再选择最下面的Done回车

先不设置静态IP,先用自动IP

设置镜像源地址的时候

先用默认镜像源地址,这个地方等20秒,再下一步

磁盘分区的 地方

取消选择

set up this disk as an lvm group 去掉

设置root账户密码

输入:sudo passwd root 设置root账户密码,这里会要你先输入当前账户密码回车,再输入你要设置的root账户密码回车,接着重复输入一遍root账户密码确认,回车。

手动设置静态IP

/etc/netplan/50-cloud-init.yaml

原来的内容

c 复制代码
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        enp0s31f6:
            dhcp4: true
    version: 2

修改后的 内容

c 复制代码
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        enp0s31f6:
            dhcp4: no
            addresses: [192.168.99.66/24]
            routes:
              - to: default
                via: 192.168.99.1
            nameservers:
              addresses:
                - 114.114.114.114
                - 8.8.8.8    
    version: 2

同时需要修改

sudo vi /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

c 复制代码
network: {config: disabled}

sudo netplan apply

关闭防火墙

sudo ufw status查看防火墙状态,inactive是关闭,active是开启。

如果是开启状态则关闭防火墙

防火墙基本命令:

sudo ufw enable 开启防火墙

sudo ufw disable 关闭防火墙

设置时区 和 时区同步

执行命令:

timedatectl set-timezone "Asia/Shanghai"

执行命令:

timedatectl set-ntp yes

系统备份

ubuntu server 20.04 备份和恢复 系统 LTS
https://blog.csdn.net/wowocpp/article/details/134824060

备份的时候,需要先将 命令 复制到 一个txt文件中,别直接粘贴。

因为 网页会给 自动添加 后缀

修改ssh 端口号

修改端口号的 原因是

如果 把 ssh 端口号22 映射到 公网的 一个 普通端口比如 98765上面

某天重装系统,没有来得及 开启防火墙,可能会 被趁机连接

或者是会忘记这件事情

是一个安全隐患

还是修改端口号的好

只要是 可能 对外的 机器,都要 修改一下 端口

sudo vi /etc/ssh/sshd_config

sudo systemctl restart sshd

把port设置成7000以上端口比较安全

不允许root通过ssh登录,再增加安全性

允许指定用户登录,再减小被暴力破解可能性。

Port 7896

#PermitRootLogin prohibit-password

这个默认 是no

ssh -p 7896 root@192.168.99.46

Permission denied, please try again.

相关推荐
wdfk_prog2 小时前
[Linux]学习笔记系列 -- [drivers][input]input
linux·笔记·学习
七夜zippoe3 小时前
CANN Runtime任务描述序列化与持久化源码深度解码
大数据·运维·服务器·cann
盟接之桥3 小时前
盟接之桥说制造:引流品 × 利润品,全球电商平台高效产品组合策略(供讨论)
大数据·linux·服务器·网络·人工智能·制造
忆~遂愿3 小时前
ops-cv 算子库深度解析:面向视觉任务的硬件优化与数据布局(NCHW/NHWC)策略
java·大数据·linux·人工智能
湘-枫叶情缘3 小时前
1990:种下那棵不落叶的树-第6集 圆明园的对话
linux·系统架构
Fcy6484 小时前
Linux下 进程(一)(冯诺依曼体系、操作系统、进程基本概念与基本操作)
linux·运维·服务器·进程
袁袁袁袁满4 小时前
Linux怎么查看最新下载的文件
linux·运维·服务器
代码游侠5 小时前
学习笔记——设备树基础
linux·运维·开发语言·单片机·算法
Gary Studio5 小时前
rk芯片驱动编写
linux·学习
mango_mangojuice5 小时前
Linux学习笔记(make/Makefile)1.23
java·linux·前端·笔记·学习