前提条件,已经安装了一个图形界面
yum install tigervnc-server -y ==>安装vnc服务
systemctl status vncserver@:.service ==>检查服务状态
vncserver@:.service - Remote desktop service (VNC)
Loaded: loaded (/usr/lib/systemd/system/vncserver@.service; disabled)
Active: inactive (dead)
systemctl is-enabled vncserver@.service ==>检查是服务是否开机启动
disabled
ll /lib/systemd/system/vncserver@.service ==>查看文件
-rw-r--r--. 1 root root 1738 Nov 21 04:53 /lib/systemd/system/vncserver@.service
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service==>复制
useradd vncuser==>创建远程vnc用户
echo 密码|passwd --stdin vncuser==>创建密码
sed -i 's/<USER>/vncuser/g' /etc/systemd/system/vncserver@:1.service==>修改用户
su - vncuser
Last login: Sun Feb 28 12:54:31 CST 2016 on pts/0
[vncuser@localhost ~]$ vncserver或vncpassd ==>创建远程登录密码
You will require a password to access your desktops.
Password: 最低6位
Verify:
su
systemctl daemon-reload
systemctl start vncserver@:1==>启动服务
systemctl status vncserver@:1
vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:1.service; disabled)
Active: active (running) since Sun 2016-02-28 13:35:37 CST; 5min ago
Process: 1670 ExecStart=/usr/sbin/runuser -l vncuser -c /usr/bin/vncserver %i (code=exited, status=0/SUCCESS)
Process: 1668 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Main PID: 1696 (Xvnc)
CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
鈥1696 /usr/bin/Xvnc :1 -desktop localhost:1 (vncuser) -auth /home...
Feb 28 13:35:34 localhost systemd[1]: Starting Remote desktop service (VNC)...
Feb 28 13:35:37 localhost systemd[1]: Started Remote desktop service (VNC).
firewall-cmd --permanent --add-service vnc-server==>打开端口
systemctl restart firewalld==>重启防火墙
windows下打开vncview ip:1测试