remote service
本文转自
vnc 安装 (适用redhat 9.0 和 centos 7.0+)
实验环境: red hat enterprise linux server release 7.6 (maipo)
cat /etc/redhat-release
yum -y install vnc-server
cd /lib/systemd/system
cp vncserver@.service vncserver@:1.service
注:vnc 服务本身使用的是5900端口。鉴于有不同的用户使用 vnc ,每个人的连接都会获得不同的端口。配置文件名里面的数字告诉 vnc 服务器把服务运行在5900的子端口上。在我们这个例子里,第一个 vnc 服务会运行在5901(5900 + 1)端口上,之后的依次增加,运行在5900 + x 号端口上。其中 x 是指之后用户的配置文件名 vncserver@:x.service 里面的 x 。
如果要用更多的用户连接,需要创建配置文件和端口,添加一个新的用户和端口。你需要创建 vncserver@:2.service 并替换配置文件里的用户名和之后步骤里相应的文件名、端口号。请确保你登录 vnc 服务器用的是你之前配置 vnc 密码的时候使用的那个用户名。
vim vncserver@:1.service
[service]
type=forking
execstartpre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
execstart=/usr/sbin/runuser -l root -c "/usr/bin/vncserver %i -geometry 1376x730"
pidfile=/home/root/.vnc/%h%i.pid
execstop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
systemctl daemon-reload
vncserver :1
you will require a password to access your desktops.
password:输入你的密码
verify:再次输入你的密码
systemctl enable vncserver@:1.service
firewall-cmd --permanent --zone=public --add-port=5901/tcp
firewall-cmd --reload
关闭vnc服务:
systemctl stop vncserver@:1.service
禁止 vnc 服务开机启动:
systemctl disable vncserver@:1.service
关闭防火墙:
systemctl stop firewalld.service
如对本文有疑问, 点击进行留言回复!!
linux下文本编辑器vim的使用方法(复制、粘贴、替换、行号、撤销、多文件操作)
网友评论