首页
留言
导航
统计
Search
1
追番推荐!免费看动漫的网站 - 支持在线观看和磁力下载
829 阅读
2
PVE自动启动 虚拟机 | 容器 顺序设置及参数说明
491 阅读
3
一条命令,永久激活!Office 2024!
452 阅读
4
优选 Cloudflare 官方 / 中转 IP
334 阅读
5
[Windows] MicroSoft Office LTSC Professional Plus 2024 官方安装部署工具
328 阅读
默认分类
服务器
宝塔
VPS
Docker
OpenWRT
Nginx
群晖
前端编程
Vue
React
Angular
NodeJS
uni-app
后端编程
Java
Python
SpringBoot
SpringCloud
流程引擎
检索引擎
Linux
CentOS
Ubuntu
Debian
数据库
Redis
MySQL
Oracle
虚拟机
VMware
VirtualBox
PVE
Hyper-V
计算机
网络技术
网站源码
主题模板
登录
Search
标签搜索
Java
小程序
Redis
SpringBoot
docker
Typecho
Cloudflare
虚拟机
WordPress
uni-app
CentOS
docker部署
Vue
Java类库
群晖
Linux命令
防火墙配置
Mysql
脚本
计算机网络
流年微醺
累计撰写
256
篇文章
累计收到
8
条评论
首页
栏目
默认分类
服务器
宝塔
VPS
Docker
OpenWRT
Nginx
群晖
前端编程
Vue
React
Angular
NodeJS
uni-app
后端编程
Java
Python
SpringBoot
SpringCloud
流程引擎
检索引擎
Linux
CentOS
Ubuntu
Debian
数据库
Redis
MySQL
Oracle
虚拟机
VMware
VirtualBox
PVE
Hyper-V
计算机
网络技术
网站源码
主题模板
页面
留言
导航
统计
搜索到
32
篇与
的结果
2025-03-11
CentOS 7 ens33获取不到ip地址和启动网卡报错的解决方法
当我们启动虚拟机输入 ifconfig 查看 IP 地址时出现下图这样的情况,发现没有 ens33 移动到 /etc/sysconfig/network-scripts 编辑 ifcfg-ens33cd /etc/sysconfig/network-scripts vim ifcfg-ens33将 ONBOOT=NO 改成 ONBOOT=yes 输入 i 进行编辑;将最后 ONBOOT=no 改为 yes 即可;单击 esc 键,然后输入 :wq 保存退出。这样就开启了 ens33 ;接着重启网络服务就可以看到 ip 地址。重启网络服务service network restart 出现下图表示已经重启成功输入 ifconfig ens33 有了 ip 地址。出现 异常# 关闭NetworkManager服务 systemctl stop NetworkManager systemctl restart network.service service network restart # 问题解决
2025年03月11日
17 阅读
0 评论
0 点赞
2024-10-19
apt 和 apt-get的区别
前言在开始对比 apt 与 apt-get 命令的区别之前,我们先来看看这两个命令的背景,以及它们要试图达到的目的。Debian 作为 Ubuntu、Linux Mint 和 elementary OS 等 Linux 操作系统的母板,其具有强健的 「包管理」 系统,它的每个组件和应用程序都内置在系统中安装的软件包中。Debian 使用一套名为 Advanced Packaging Tool(APT) 的工具来管理这种包系统,不过请不要把它与 apt 命令混淆,它们之间是其实不是同一个东西。在基于 Debian 的 Linux 发行版中,有各种工具可以与 APT 进行交互,以方便用户安装、删除和管理的软件包。apt-get 便是其中一款广受欢迎的命令行工具,另外一款较为流行的是 Aptitude 这一命令行与 GUI 兼顾的小工具。如果你已阅读过我们的 apt-get 命令指南,可能已经遇到过许多类似的命令,如 apt-cache、apt-config 等。如你所见,这些命令都比较低级又包含众多功能,普通的 Linux 用户也许永远都不会使用到。换种说法来说,就是最常用的 Linux 包管理命令都被分散在了 apt-get、apt-cache 和 apt-config 这三条命令当中。apt 命令的引入就是为了解决命令过于分散的问题,它包括了 apt-get 命令出现以来使用最广泛的功能选项,以及 apt-cache 和 apt-config 命令中很少用到的功能。在使用 apt 命令时,用户不必再由 apt-get 转到 apt-cache 或 apt-config ,而且 apt 更加结构化,并为用户提供了管理软件包所需的必要选项。简单来说就是:apt = apt-get、apt-cache 和 apt-config 中最常用命令选项的集合。虽然 apt 与 apt-get 有一些类似的命令选项,但它并不能完全向下兼容 apt-get 命令。也就是说,可以用 apt 替换部分 apt-get 系列命令,但不是全部。apt 命令取代的命令命令的功能apt installapt-get install安装软件包apt removeapt-get remove移除软件包apt purgeapt-get purge移除软件包及配置文件apt updateapt-get update刷新存储库索引apt upgradeapt-get upgrade升级所有可升级的软件包apt autoremoveapt-get autoremove自动删除不需要的包apt full-upgradeapt-get dist-upgrade在升级软件包时自动处理依赖关系apt searchapt-cache search搜索应用程序apt showapt-cache show显示装细节当然,apt 还有一些自己的命令:新的apt命令命令的功能apt list列出包含条件的包(已安装,可升级等)apt edit-sources编辑源列表需要大家注意的是: apt 命令也还在不断发展, 因此,你可能会在将来的版本中看到新的选项。apt-get已弃用?目前还没有任何 Linux 发行版官方放出 apt-get 将被停用的消息,至少它还有比 apt 更多、更细化的操作功能。对于低级操作,仍然需要 apt-get。我应该使用 apt 还是 apt-get ?既然两个命令都有用,那么我该使用 apt 还是 apt-get 呢?作为一个常规 Linux 用户,系统极客建议大家尽快适应并开始首先使用 apt。不仅因为广大 Linux 发行商都在推荐 apt,更主要的还是它提供了 Linux 包管理的必要选项。最重要的是,apt 命令选项更少更易记,因此也更易用,所以没理由继续坚持 apt-get。小结最后结大家提供两点使用上的建议:apt 可以看作 apt-get 和 apt-cache 命令的子集, 可以为包管理提供必要的命令选项。apt-get 虽然没被弃用,但作为普通用户,还是应该首先使用 apt。
2024年10月19日
9 阅读
0 评论
0 点赞
2024-09-26
Linux ubuntu debian ufw (防火墙) 使用指南
前言UFW 是 “简单防火墙” 的缩写,是更复杂的 iptables 实用程序的前端。它旨在使管理防火墙变得像设置端口打开和关闭以及调节允许通过的流量一样简单。ufw 可以在 Debian 和 Ubuntu 系统中使用,是默认的防火墙配置工具,默认 ufw 是禁用状态,支持 IPv4 和 IPv6。国内的服务器,一般都会有安全组,如果有安全组,则无须使用 ufw国外的服务器,一般端口全都是放行的,所以有必要使用 ufw如果是 CentOS 系统,可以使用 firewalld,强烈建议弃用 CentOS 系统,官方早已经不维护了,会有很多漏洞无法修复。推荐系统:Debian > Ubuntu >>>>> CentOS提示:以下所有命令默认在 root 环境下运行,如果是非 root 环境,则命令需要加前缀:sudoufw 使用更新软件包apt update apt upgrade -y安装# 安装 apt-get install ufw # 帮助命令 ufw --help推荐配置如果要开启防火墙的话,建议先拒绝所有入站流量,然后逐一打开需要的端口。# 默认阻止入站(不会立即切断你的 SSH 连接,因为防火墙尚未启用) ufw default deny incoming # 默认允许出站 ufw default allow outgoing # 拒绝所有访问(如果配置了入站/出战,这个可以不配置) ufw default deny # 根据需求开启端口 ufw allow 22⚠注意确保在修改 SSH 端口后,不要关闭当前 SSH 窗口,尝试使用新的端口进行 SSH 登录,以确保没有防火墙或其他网络配置问题,以免被自己锁定出服务器。启用禁用# 启用 ufw enable # 查看状态 ufw status verbose # 禁用 ufw disable # 防火墙规则存放位置 # /etc/ufw 中的规则文件(后缀名:.rules)允许拒绝allow 例子:# 接受 97 端口的 tcp/udp 流量 ufw allow 97 # 接受 97 端口的 tcp/udp 流量,并添加备注 ufw allow 97 comment 'open 97 port' # 接受 97 端口的 tcp 流量 ufw allow 97/tcp # 接受 97 端口的 udp 流量 ufw allow 97/udp # 通过服务名来处理, 会从 /etc/services 中查找端口 ufw allow ssh # 允许特定IP访问 ufw allow from 1.2.3.4 # 允许特定子网访问 ufw allow from 1.2.3.4/97 # 允许特定IP使用任何协议访问22端口 ufw allow from 1.2.3.4 to any port 22 # 允许特定IP使用任何TCP协议访问22端口 ufw allow from 1.2.3.4 to any port 22 proto tcpdeny 例子:# 拒绝 97 端口的 tcp/udp 流量 ufw deny 97 # 拒绝 97 端口的 tcp 流量 ufw deny 97/tcp # 拒绝 97 端口的 udp 流量 ufw deny 97/udp # 通过服务名来处理, 会从 /etc/services 中查找端口 ufw deny ssh # 拒绝特定IP访问 ufw deny from 1.2.3.4 # 同allow ufw deny from 1.2.3.4 to any port 22 ufw deny from 1.2.3.4 to any port 22 ufw allow from 1.2.3.4/97 to any port 22 proto tcp删除# 要删除规则,只需在原始规则前加上删除,删除 80 端口的 tcp 配置 ufw delete deny 80/tcp # 显示规则的顺序和ID号 ufw status numbered # 删除编号规则(删除规则,规则将向上移动以填充列表) ufw delete 1日志# 启用日志 ufw logging on # 禁用日志 ufw logging off
2024年09月26日
11 阅读
0 评论
0 点赞
2024-09-26
Linux ufw(防火墙)使用指南,解决ufw和docker冲突问题,保护你的服务器/VPS
前言如果你在服务端使用 Docker 映射了某个宿主机端口,然后公网访问这个端口的话,你会发现仍然可以访问,即使 ufw 禁用了这个端口,却不起效果。因为默认状态下的 Docker 并不遵守 ufw 的防火墙规则解决ufw和docker的问题解决方案:https://github.com/chaifeng/ufw-docker目前新的解决方案只需要修改一个 UFW 配置文件即可,Docker 的所有配置和选项都保持默认。修改 UFW 的配置文件 /etc/ufw/after.rules ,在最后添加上如下规则:# BEGIN UFW AND DOCKER *filter :ufw-user-forward - [0:0] :ufw-docker-logging-deny - [0:0] :DOCKER-USER - [0:0] -A DOCKER-USER -j ufw-user-forward -A DOCKER-USER -j RETURN -s 10.0.0.0/8 -A DOCKER-USER -j RETURN -s 172.16.0.0/12 -A DOCKER-USER -j RETURN -s 192.168.0.0/16 -A DOCKER-USER -p udp -m udp --sport 53 --dport 1024:65535 -j RETURN -A DOCKER-USER -j ufw-docker-logging-deny -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 192.168.0.0/16 -A DOCKER-USER -j ufw-docker-logging-deny -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 10.0.0.0/8 -A DOCKER-USER -j ufw-docker-logging-deny -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 172.16.0.0/12 -A DOCKER-USER -j ufw-docker-logging-deny -p udp -m udp --dport 0:32767 -d 192.168.0.0/16 -A DOCKER-USER -j ufw-docker-logging-deny -p udp -m udp --dport 0:32767 -d 10.0.0.0/8 -A DOCKER-USER -j ufw-docker-logging-deny -p udp -m udp --dport 0:32767 -d 172.16.0.0/12 -A DOCKER-USER -j RETURN -A ufw-docker-logging-deny -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW DOCKER BLOCK] " -A ufw-docker-logging-deny -j DROP COMMIT # END UFW AND DOCKER或者使用 ufw-docker 工具下载脚本,修改 after.rules 文件配置:# 下载脚本 wget -O /usr/local/bin/ufw-docker https://github.com/chaifeng/ufw-docker/raw/master/ufw-docker # 赋予权限 chmod +x /usr/local/bin/ufw-docker # 修改配置文件 ufw-docker installufw-docker install 命令做了以下事情:备份文件 /etc/ufw/after.rules把 UFW 和 Docker 的相关规则添加到文件 after.rules 的末尾然后重启 UFW ,systemctl restart ufw 。现在外部就已经无法访问 Docker 发布出来的任何端口了,但是容器内部以及私有网络地址上可以正常互相访问,而且容器也可以正常访问外部的网络。可能由于某些未知原因,重启 UFW 之后规则也无法生效,请重启服务器。如果希望允许外部网络访问 Docker 容器提供的服务,比如有一个容器的服务端口是 80。那就可以用以下命令来允许外部网络访问这个服务:ufw route allow proto tcp from any to any port 80这个命令会允许外部网络访问所有用 Docker 发布出来的并且内部服务端口为 80 的所有服务。请注意,这个端口 80 是容器的端口,而非使用 -p 0.0.0.0:8080:80 选项发布在服务器上的 8080 端口。如果有多个容器的服务端口为 80 ,但只希望外部网络访问某个特定的容器。比如该容器的私有地址为 172.17.0.2 ,就用类似下面的命令:ufw route allow proto tcp from any to 172.17.0.2 port 80如果一个容器的服务是 UDP 协议,假如是 DNS 服务,可以用下面的命令来允许外部网络访问所有发布出来的 DNS 服务:ufw route allow proto udp from any to any port 53同样的,如果只针对一个特定的容器,比如 IP 地址为 172.17.0.2ufw route allow proto udp from any to 172.17.0.2 port 53ufw-docker 也是支持 Docker Swarm 的,详细教程及配置参考文章:https://github.com/chaifeng/ufw-docker
2024年09月26日
133 阅读
0 评论
1 点赞
2024-06-06
解决 /usr/bin/xauth: file /.../.Xauthority does not exist 报错
root账户下执行命令:find / |grep ".Xauthority"普通账户下执行命令:find ~ |grep ".Xauthority"找了下原因,没找到,然后我重新登陆,发现,居然可以了。简直就是大无语事件!!!
2024年06月06日
218 阅读
0 评论
0 点赞
2024-06-06
Linux SSH Access denied(拒绝访问)解决方案
新安装的 CentOS 7 使用 SSH 连接出现 Access denied,记录一下这个坑。详细问题如下(见图):解决方案查了下资料,Linux 系统默认就是禁止远程登录的。那就打开权限就行了。因为需要修改系统设置,普通用户会出现没有权限,所以在超级管理员下操作!编辑配置文件:vim /etc/ssh/sshd_config修改 PermitRootLogin 为 yes退出编辑:按下 'Esc' 键,输入 ':wq',回车保存即可。重启 SSH:systemctl restart sshd大功告成,可以使用 ssh 链接了~~
2024年06月06日
139 阅读
0 评论
0 点赞
2024-02-03
ubuntu 利用systemback制作镜像备份(可用)
前言在ubuntu 22.04版本下,安装 systemback 成功制作出 iso 镜像文件,并在 VM虚拟机 下进行还原安装;移植好的镜像文件包含了当前的系统环境依赖,部署服务,系统文件内的图片,视频等内容。安装软件安装systemback安装make安装cdtools安装systembacksystemback 用来打包系统成压缩包,后再利用 cdtools 将其转换为iso镜像文件。安装systemback工具直接全部复制,粘贴到终端运行:sudo sh -c 'echo "deb [arch=amd64] http://mirrors.bwbot.org/ stable main" > /etc/apt/sources.list.d/systemback.list' sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key 50B2C005A67B264F sudo apt-get update sudo apt-get install systemback安装make编译器sudo apt-get install make安装gcc环境包sudo apt update sudo apt install build-essential安装cdtoolssudo apt install aria2 aria2c -s 10 https://nchc.dl.sourceforge.net/project/cdrtools/alpha/cdrtools-3.02a07.tar.gz下载完成后打开对应文件夹进行解压tar -xzvf cdrtools-3.02a07.tar.gz cd cdrtools-3.02 make make installsystemback系统打包进行 live 打包,执行下面命令:systemback-sustart点击 创建Live 系统可以 包含用户数据文件 点击 创建新的 如果出现报错:错误会在终端中显示出来(大概率由于snap文件内的内容报错)解决方法——卸载报错的软件或者删除报错的文件打包好的文件会生成在上一步选择好的工作目录(默认为 /home )到此已经结束!
2024年02月03日
180 阅读
0 评论
0 点赞
2024-01-29
使用Ubuntu|Debian的 UFW 禁止 ICMP 协议访问(禁 ping)
打开 UFW 配置文件vim /etc/ufw/before.rules修改配置允许 ping-A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT禁止 ping-A ufw-before-input -p icmp --icmp-type echo-request -j DROP让配置生效ufw reload
2024年01月29日
23 阅读
0 评论
0 点赞
2024-01-29
Debian/Ubuntu 中安装和配置 UFW 防火墙
前言UFW 是一个 Arch Linux、Debian 或 Ubuntu 中管理防火墙规则的前端,可大大简化防火墙的配置过程。安装 UFW如还没有安装,可以使用 apt 命令来安装apt-get update && apt-get install ufw在使用前,你应该检查下 UFW 是否已经在运行。ufw status如果你发现状态是 inactive ,意思是没有被激活或不起作用。启用/禁用ufw enable #启用 ufw disable #禁用使用与配置列出当前UFW规则ufw status verbose添加规则允许入站(allow)默认情况,没有允许就是拒绝(入站),使用 ufw allow <端口> 来添加允许访问的端口或协议。ufw allow ssh #添加22端口 ufw allow http #添加80端口 ufw allow https #添加443端口 ufw allow 2333/tcp #添加2333端口,仅TCP协议 ufw allow 6666/udp #添加6666端口,仅UDP协议 ufw allow 8888:9999 #添加8888到9999之间的端口拒绝访问(deny)使用 ufw deny <端口> 来添加拒绝入站的端和协议,与添加允许的类似。删除规则先使用 ufw status 查看规则,再使用 ufw delete [规则] <端口> 来删除规则。ufw delete allow 2333/tcp如果你有很多条规则,使用 numbered 参数,可以在每条规则上加个序号数字。然后使用 ufw delete <序号> 来删除规则。root@p3terx:~# ufw status numbered #列出规则,并加上序号。 Status: active To Action From -- ------ ---- [ 1] 20,21,22,80,888,8888/tcp ALLOW IN Anywhere [ 2] 39000:40000/tcp ALLOW IN Anywhere [ 3] 8896/tcp ALLOW IN Anywhere [ 4] 8896/udp ALLOW IN Anywhere [ 5] 443/tcp ALLOW IN Anywhere [ 6] 20,21,22,80,888,8888/tcp (v6) ALLOW IN Anywhere (v6) [ 7] 39000:40000/tcp (v6) ALLOW IN Anywhere (v6) [ 8] 8896/tcp (v6) ALLOW IN Anywhere (v6) [ 9] 8896/udp (v6) ALLOW IN Anywhere (v6) [10] 443/tcp (v6) ALLOW IN Anywhere (v6) root@p3terx:~# ufw delete 4 #删除上面的第4条规则 Deleting: allow 8896/udp Proceed with operation (y|n)? y #最后会询问你是否进行操作以上都是一些简单常用的一些命令,想要深入了解,可以输入 man ufw 查看 ufw 用户手册。
2024年01月29日
12 阅读
0 评论
0 点赞
2024-01-17
Linux如何配置VNC远程桌面?
VNC介绍1.1 VNC简介VNC (Virtual Network Console) 是虚拟网络控制台的缩写。它是一款优秀的远程控制工具软件,可以实现远程控制计算机的功能。1.2 VNC组成VNC基本上是由两部分组成,在任何安装了客户端的应用程序(vncviewer)的计算机都能十分方便地与安装了服务器端的应用程序(vncserver)的计算机相互连接。客户端的应用程序vncviewer服务器端的应用程序vncserver1.3 常见的VNC工具RealVNC:是一款功能强大的VNC工具,支持多种操作系统,包括Windows、Linux、Mac OS X等,具有高安全性和可靠性。UltraVNC:是一款免费的VNC客户端和服务器软件,支持Windows操作系统,提供了远程桌面、文件传输、文本聊天等功能。TightVNC:是一个小巧而强大的VNC工具,支持Windows、Linux以及Unix等多种操作系统,具有较高的安全性和性能。TigerVNC:是一个开源的VNC工具,支持Windows、Linux以及Mac OS X等多种操作系统,具有稳定性和高性能。TeamViewer:是一款针对远程支持、远程控制和在线协作的应用软件,可以实现桌面共享、远程协助、文件传输等功能。本地环境介绍本次实践为个人测试环境,服务器操作系统版本为Rocky Linux 8.9,客户端主机使用Windows10操作系统角色主机名主机IP操作系统版本内核版本vncserverlocalhost192.168.3.168Rocky Linux 8.9 (Green Obsidian)4.18.0-513.5.1.el8_9.x86_64vncviewerN/A192.168.3.35Windows 10 ProN/A安装vncserver3.1 使用yum源安装tigervnc-server包dnf -y install tigervnc-server3.2 检查vncserver安装状态[root@localhost ~]# rpm -qa | grep tigervnc tigervnc-license-1.13.1-2.el8.noarch tigervnc-server-1.13.1-2.el8.x86_64 tigervnc-server-minimal-1.13.1-2.el8.x86_64 tigervnc-selinux-1.13.1-2.el8.noarch创建VNC用户4.1 分别创建vncuser01、vncuser02用户,并设置密码[root@localhost ~]# useradd vncuser01 [root@localhost ~]# useradd vncuser02 [root@localhost ~]# echo 123 | passwd --stdin vncuser01 # 设置密码为123 Changing password for user vncuser01. passwd: all authentication tokens updated successfully. [root@localhost ~]# echo 123 | passwd --stdin vncuser02 # 设置密码为123 Changing password for user vncuser02. passwd: all authentication tokens updated successfully.配置vncserver服务5.1 切换到vncuser01用户,启动vncserver服务,设置vnc连接密码[root@localhost ~]# su - vncuser01 [vncuser01@localhost ~]$ vncserver WARNING: vncserver has been replaced by a systemd unit and is now considered deprecated and removed in upstream. Please read /usr/share/doc/tigervnc/HOWTO.md for more information. You will require a password to access your desktops. Password: Password must be at least 6 characters - try again # 密码长度至少6位 Password: # 设置密码为123456 Verify: # 再次输入密码 Would you like to enter a view-only password (y/n)? n # 询问你是否要再输入一个只有观看权限而被禁止操作的远程桌面的密码 A view-only password is not used xauth: file /home/vncuser01/.Xauthority does not exist New 'localhost.localdomain:1 (vncuser01)' desktop is localhost.localdomain:1 Creating default startup script /home/vncuser01/.vnc/xstartup Creating default config /home/vncuser01/.vnc/config Starting applications specified in /home/vncuser01/.vnc/xstartup Log file is /home/vncuser01/.vnc/localhost.localdomain:1.log5.2 切换到vncuser02用户,启动vncserver服务,设置vnc连接密码[vncuser01@localhost ~]$ exit logout [root@localhost ~]# su - vncuser02 [vncuser02@localhost ~]$ vncserver WARNING: vncserver has been replaced by a systemd unit and is now considered deprecated and removed in upstream. Please read /usr/share/doc/tigervnc/HOWTO.md for more information. You will require a password to access your desktops. Password: Verify: Would you like to enter a view-only password (y/n)? n A view-only password is not used xauth: file /home/vncuser02/.Xauthority does not exist New 'localhost.localdomain:2 (vncuser02)' desktop is localhost.localdomain:2 Creating default startup script /home/vncuser02/.vnc/xstartup Creating default config /home/vncuser02/.vnc/config Starting applications specified in /home/vncuser02/.vnc/xstartup Log file is /home/vncuser02/.vnc/localhost.localdomain:2.log后面如果需要修改vnc连接密码,可以切换到对应用户执行vncpasswd进行修改5.3 查看服务端口[root@localhost ~]# netstat -tulnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 33743/Xvnc tcp 0 0 0.0.0.0:5902 0.0.0.0:* LISTEN 34664/Xvnc tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1709/dnsmasq tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1145/sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1148/cupsd tcp6 0 0 :::5901 :::* LISTEN 33743/Xvnc tcp6 0 0 :::5902 :::* LISTEN 34664/Xvnc tcp6 0 0 :::111 :::* LISTEN 1/systemd tcp6 0 0 :::22 :::* LISTEN 1145/sshd tcp6 0 0 ::1:631 :::* LISTEN 1148/cupsd udp 0 0 0.0.0.0:5353 0.0.0.0:* 938/avahi-daemon: r udp 0 0 0.0.0.0:50923 0.0.0.0:* 938/avahi-daemon: r udp 0 0 192.168.122.1:53 0.0.0.0:* 1709/dnsmasq udp 0 0 0.0.0.0:67 0.0.0.0:* 1709/dnsmasq udp 0 0 0.0.0.0:111 0.0.0.0:* 1/systemd udp 0 0 127.0.0.1:323 0.0.0.0:* 957/chronyd udp6 0 0 :::5353 :::* 938/avahi-daemon: r udp6 0 0 :::34264 :::* 938/avahi-daemon: r udp6 0 0 :::111 :::* 1/systemd udp6 0 0 ::1:323 :::* 可以看到vnc服务端口已经处于监听状态了。5.4 设置vncserver开机自启动第一个桌面环境[root@localhost ~]# systemctl enable vncserver@:1.service # 注意:此处服务名称不能tab键补全,需手动敲完整,对应5901端口 Created symlink /etc/systemd/system/multi-user.target.wants/vncserver@:1.service → /usr/lib/systemd/system/vncserver@.service.第二个桌面环境[root@localhost ~]# systemctl enable vncserver@:2.service Created symlink /etc/systemd/system/multi-user.target.wants/vncserver@:2.service → /usr/lib/systemd/system/vncserver@.service.5.5 增加会话窗口与用户的映射关系,第一个桌面与vncuser01账号关联,第二个桌面环境与vncuser02账号关联编辑 /etc/tigervnc/vncserver.users 文件[root@localhost ~]# vim /etc/tigervnc/vncserver.users # TigerVNC User assignment # # This file assigns users to specific VNC display numbers. # The syntax is <display>=<username>. E.g.: # # :2=andrew # :3=lisa :1=vncuser01 # 增加这两行 :2=vncuser025.6 防火墙规则放行在firewalld防火墙上放行端口[root@localhost ~]# firewall-cmd --add-port=5901/tcp --permanent success [root@localhost ~]# firewall-cmd --add-port=5902/tcp --permanent success [root@localhost ~]# firewall-cmd --reload success5.7 重启验证服务状态[root@localhost ~]# systemctl status vncserver@\:1.service [root@localhost ~]# systemctl status vncserver@\:1.service ● vncserver@:1.service - Remote desktop service (VNC) Loaded: loaded (/usr/lib/systemd/system/vncserver@.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2023-12-14 18:00:57 CST; 40s ago Process: 1471 ExecStart=/usr/libexec/vncsession-start :1 (code=exited, status=0/SUCCESS) Process: 1422 ExecStartPre=/usr/libexec/vncsession-restore :1 (code=exited, status=0/SUCCESS) Main PID: 1489 (vncsession) Tasks: 0 (limit: 24436) Memory: 1.4M CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service ‣ 1489 /usr/sbin/vncsession vncuser01 :1 Dec 14 18:00:57 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)... Dec 14 18:00:57 localhost.localdomain systemd[1]: Started Remote desktop service (VNC). [root@localhost ~]# [root@localhost ~]# systemctl status vncserver@\:2.service ● vncserver@:2.service - Remote desktop service (VNC) Loaded: loaded (/usr/lib/systemd/system/vncserver@.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2023-12-14 18:00:57 CST; 44s ago Process: 1470 ExecStart=/usr/libexec/vncsession-start :2 (code=exited, status=0/SUCCESS) Process: 1421 ExecStartPre=/usr/libexec/vncsession-restore :2 (code=exited, status=0/SUCCESS) Main PID: 1492 (vncsession) Tasks: 0 (limit: 24436) Memory: 2.1M CGroup: /system.slice/system-vncserver.slice/vncserver@:2.service ‣ 1492 /usr/sbin/vncsession vncuser02 :2 Dec 14 18:00:57 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)... Dec 14 18:00:57 localhost.localdomain systemd[1]: Started Remote desktop service (VNC).重启系统后,服务成功自启动,均为 active 状态5.8 查看端口状态 [root@localhost ~]# netstat -tulnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1858/dnsmasq tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1101/sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1098/cupsd tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 1624/Xvnc tcp 0 0 0.0.0.0:5902 0.0.0.0:* LISTEN 1625/Xvnc tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd tcp6 0 0 :::22 :::* LISTEN 1101/sshd tcp6 0 0 ::1:631 :::* LISTEN 1098/cupsd tcp6 0 0 :::5901 :::* LISTEN 1624/Xvnc tcp6 0 0 :::5902 :::* LISTEN 1625/Xvnc tcp6 0 0 :::111 :::* LISTEN 1/systemd udp 0 0 0.0.0.0:5353 0.0.0.0:* 973/avahi-daemon: r udp 0 0 192.168.122.1:53 0.0.0.0:* 1858/dnsmasq udp 0 0 0.0.0.0:67 0.0.0.0:* 1858/dnsmasq udp 0 0 0.0.0.0:111 0.0.0.0:* 1/systemd udp 0 0 127.0.0.1:323 0.0.0.0:* 983/chronyd udp 0 0 0.0.0.0:44138 0.0.0.0:* 973/avahi-daemon: r udp6 0 0 :::5353 :::* 973/avahi-daemon: r udp6 0 0 :::36338 :::* 973/avahi-daemon: r udp6 0 0 :::111 :::* 1/systemd udp6 0 0 ::1:323 :::* 983/chronydvnc服务端口处于监听状态中客户端连接验证这里我的客户端主机使用的是Windows10操作系统,使用 UltraVNC Viewer 工具连接 登录成功,vncuser02 同理
2024年01月17日
10 阅读
0 评论
0 点赞
1
2
...
4