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.

相关推荐
java叶新东老师3 小时前
git stash 命令详解
linux·运维·flink
写bug的羊羊4 小时前
CentOS 9 配置国内 YUM 源
linux·运维·centos
国科安芯5 小时前
抗辐照芯片在低轨卫星星座CAN总线通讯及供电系统的应用探讨
运维·网络·人工智能·单片机·自动化
gx23486 小时前
HCLP--MGER综合实验
运维·服务器·网络
angushine6 小时前
鲲鹏服务器部署Kafka2.8.1
运维·服务器
Johny_Zhao7 小时前
CentOS Stream 9上部署FTP应用服务的两种方法(传统安装和docker-compose)
linux·网络安全·信息安全·kubernetes·云计算·containerd·ftp·yum源·系统运维
一个网络学徒7 小时前
MGRE综合实验
运维·服务器·网络
守望时空337 小时前
RustDesk搭建指南
linux
C++ 老炮儿的技术栈7 小时前
在 Scintilla 中为 Squirrel 语言设置语法解析器的方法
linux·运维·c++·git·ubuntu·github·visual studio
白鹭8 小时前
基于LNMP架构的分布式个人博客搭建
linux·运维·服务器·网络·分布式·apache