本地PowerShell连接Linux虚拟机

1.查看内核版本

[root@localhost ~]# uname -r 
4.18.0-477.10.1.el8_8.x86_64

2.查看系统版本

[root@localhost ~]# cat /etc/redhat-release
Rocky Linux release 8.6 (Green Obsidian)

3.查看 SELinux 状态

[root@localhost ~]# getenforce
Disabled

返回值可能为 EnforcingPermissiveDisabled

  • Enforcing:SELinux 安全策略被强制执行。
  • Permissive:SELinux 打印警告而不是强制执行。
  • Disabled:SELinux 策略没有被加载 。

通过修改/etc/selinux/config配置文件永久关闭SELinux 安全策略

[root@localhost ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

4.关闭防火墙

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

5.修改内核参数

修改/etc/sysctl.d/docker.conf配置文件

[root@localhost ~]# vi /etc/sysctl.d/docker.conf

添加以下参数

net.bridge.bridge-nf-call-ip6tables = 1 
net.bridge.bridge-nf-call-iptables = 1 
net.ipv4.ip_forward = 1 

6.配置yum源

安装wget

[root@localhost ~]# yum -y install wget

到/etc/yum.repos.d/目录下

[root@localhost ~]# cd /etc/yum.repos.d/

安装阿里Centos-8源

[root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-8.repo

清除缓存

[root@localhost yum.repos.d]# yum clean all

加载缓存

[root@localhost yum.repos.d]# yum makecache

下载所需的安装包

[root@localhost yum.repos.d]# yum -y install lresz net-tools epel-release
  • lrzsz:一组用于在 Linux 和类 Unix 系统之间通过串行端口或网络连接传输文件的工具。
  • net-tools:提供了一系列基本的网络配置和诊断工具,比如 ifconfig(虽然在最新系统中 ifconfig 已被 ip 命令取代)。
  • epel-release:是 EPEL(Extra Packages for Enterprise Linux)仓库的包,提供了额外的软件包,不包含在默认的 Fedora 或 CentOS 仓库中。安装 epel-release 会自动配置 EPEL 仓库,使其可用于你的系统。

7.使用PowerShell窗口通过ssh连接Linux虚拟机

查看是否安装ssh服务

[root@localhost ~]# systemctl status ssh

安装ssh服务

[root@localhost ~]# yum install openssh-server

本地PowerShell连接Linux虚拟机

PS C:\Users\yeqic> ssh root@192.168.1.10
The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established.
ED25519 key fingerprint is SHA256:vloS6xosdeVb5N6TwX5M4BaY90+Yx0OB0AtML5P//XQ.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.1.10' (ED25519) to the list of known hosts.
root@192.168.1.10's password:
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Mon Aug 19 02:12:53 2024 from 192.168.1.19
  • 6
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值