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 [email protected]

Permission denied, please try again.

相关推荐
whp40413 分钟前
windows server2019 不成功的部署docker经历
运维·docker·容器
Mike_6661 小时前
win10安装WSL2、Ubuntu24.04
windows·ubuntu·wsl2
IT界小黑的对象1 小时前
virtualBox部署ubuntu22.04虚拟机 NAT+host only 宿主机ping不通虚拟机
linux·运维·服务器
SilentCodeY1 小时前
Ubuntu 系统通过防火墙管控 Docker 容器
linux·安全·ubuntu·系统防火墙
weixin_527550401 小时前
Linux 环境下高效视频切帧的实用指南
linux·运维·音视频
keson要进步1 小时前
CICD实战(一) -----Jenkins的下载与安装
运维·ci/cd·centos·自动化·jenkins
keson要进步1 小时前
CICD实战(二)-----gitlab的安装与配置
linux·运维·gitlab
藥瓿亭2 小时前
K8S认证|CKS题库+答案| 4. RBAC - RoleBinding
linux·运维·服务器·云原生·容器·kubernetes·cks
发非人非2 小时前
Shell编程核心符号与格式化操作详解
运维
吐泡泡_2 小时前
Linux(线程控制)
linux