Last update at :2024-05-03,Edit by888u
This article is about installing a window environment based on CentOS 7, and then managing our VPS through vnc. It has been passed on vultr's CentOS 7 template. At the same time, unless otherwise specified, all operations are performed by the root user.
Reference from: linoxide.com/linux-how-to/install-configure-vnc-server-centos-7-0/
This tutorial is divided into 5 parts
1. Preparation
2. Install X-window
3. Install VNC
4. Configure VNC
5. Local connection and other considerations
1. Preparation
Please refer to the preparation of this article: http://www.138vps.com/jzjc/987.html
The port that needs to be opened in this article is 5901. If the firewall is firewall, you can use the following command to open it once and for all. If it is iptables, please refer to the article above.
firewall-cmd --permanent --add-service vnc-server
systemctl restart firewalld.service
Remember, there is nothing you need
yum update
2. Install X-Window
1. Run the following command to install X-Window first, if you confirm that X-Window is not installed. This will consume more time
yum groupinstall "X Window System"
yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts
unlink /etc/systemd/system/default.target
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
Okay, go to the management background and restart your vps, or enter the following command to restart
sync
reboot
3. Install VNC
Run the following command
yum install tigervnc-server
4. Configure VNC
Run the following command
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
Then use your WinSCP to edit the file [/etc/systemd/system/vncserver@:1.service]. Find the similar lines at the bottom and replace them with
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=simple
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver :1 -geometry 1280x720 -depth 24"
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
Okay, let’s restart systemd.
systemctl daemon-reload
Set the password for vnc, run the following command, and then enter the password (I missed this step at the beginning and spent two hours troubleshooting)
vncpasswd
5. Local connection and other considerations
Here are some commands you should remember:
#Start VNC on boot
systemctl enable vncserver@:1.service
#Start service
systemctl start vncserver@:1.service
#Close VNC service
systemctl stop vncserver@:1.service
Disable VNC startup at boot
systemctl disable vncserver@:1.service
Here, we refer to the above command to start VNC.
Then you can open your beloved vncviewer and access your vps through [IP:5901]. At this time, the VPS is still very simple and we need to install some other commonly used software, such as firefox:
yum -y install firefox
After installation, you can see that there is already a browser, but the browser at this time does not support Chinese because our system does not have Chinese installed. How to install Chinese on Baidu.
Recommended site search: domain name space registration, foreign permanent free server recommendation, domain name server, godaddy registered domain name, free virtual host, overseas host, local IP query, free website domain name registration, free space application, domain name registration Services,
发表评论