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.

相关推荐
Bruce_Liuxiaowei2 小时前
MQTT协议在物联网环境中的安全风险与防范指南
运维·网络·物联网·安全·网络安全
Lu Zelin6 小时前
单片机为什么不能跑Linux
linux·单片机·嵌入式硬件
-dzk-7 小时前
【3DGS复现】Autodl服务器复现3DGS《简单快速》《一次成功》《新手练习复现必备》
运维·服务器·python·计算机视觉·3d·三维重建·三维
CS Beginner7 小时前
【Linux】 Ubuntu 开发环境极速搭建
linux·运维·ubuntu
ajassi20007 小时前
开源 C++ QT QML 开发(二)工程结构
linux·qt·qml
致宏Rex8 小时前
Docker 实战教程(7) | 镜像管理和仓库操作
运维·docker·容器
今天只学一颗糖8 小时前
Linux学习笔记--insmod 命令
linux·笔记·学习
摩羯座-185690305948 小时前
爬坑 10 年!京东店铺全量商品接口实战开发:从分页优化、SKU 关联到数据完整性闭环
linux·网络·数据库·windows·爬虫·python
irisart9 小时前
4.1 > Linux 文件/目录权限管理【理论】
linux
---学无止境---9 小时前
Linux中poll的实现
linux