Home >Java >javaTutorial >Simple and practical: Ubuntu VNC installation and setup tutorial
Easy to get started: Ubuntu VNC installation and configuration guide
Introduction: Ubuntu is a powerful and popular operating system, and VNC is a remote desktop Protocol that enables users to control remote computers over a network. This article will take you through the installation and configuration process of VNC in Ubuntu system in detail, including specific code examples.
Step 1: Install VNC Server
Open Terminal and enter the following command to install VNC Server:
sudo apt-get update sudo apt-get install vnc4server
After the installation is complete, enter the following command to start VNC Server and set a password:
vncserver
Step 2: Configure VNC Server
Use the following command to edit the configuration file of VNC Server:
nano ~/.vnc/xstartup
Add the following content at the end of the file to specify the desktop environment where VNC Server runs:
#!/bin/sh export XKL_XMODMAP_DISABLE=1 unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & gnome-session &
Step 3: Enable VNC Server auto-start
Enter the following command to create a new system service (service) file:
sudo nano /etc/systemd/system/vncserver@.service
Enter the following into the opened file:
[Unit] Description=VNC Server at %i After=syslog.target network.target [Service] Type=forking User=<YOUR_USERNAME> ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i ExecStop=/usr/bin/vncserver -kill :%i [Install] WantedBy=multi-user.target
Be sure to replace 5e73baa2c75025349bc6272b36013e84
with your actual username.
Enter the following command to let the system load the new service file:
sudo systemctl daemon-reload
Enter the following command to start the VNC Server and set up auto-start:
sudo systemctl start vncserver@1 sudo systemctl enable vncserver@1
Step 4: Configure the firewall
If the firewall (UFW) is enabled in your system, you need to open the port used by the VNC Server.
Enter the following command to allow incoming connection traffic:
sudo ufw allow 5901
Step 5: Connect to VNC Server
Now, you can use any VNC Viewer software to connect to the VNC Server. During the connection process, you need to enter the server's IP address and port number.
192.168.0.100:5901
). Conclusion:
Through the installation and configuration guide provided in this article, you can easily deploy VNC Server on the Ubuntu system and connect to the remote desktop through the network. Now, you can remotely control the Ubuntu system and enjoy an efficient and convenient operating experience whether at home or in the office. Wish you happy using it!
The above is the detailed content of Simple and practical: Ubuntu VNC installation and setup tutorial. For more information, please follow other related articles on the PHP Chinese website!