search
HomeJavajavaTutorialSimple and practical: Ubuntu VNC installation and setup tutorial

轻松上手:Ubuntu VNC安装和配置指南

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

  1. Open Terminal and enter the following command to install VNC Server:

    sudo apt-get update
    sudo apt-get install vnc4server
  2. After the installation is complete, enter the following command to start VNC Server and set a password:

    vncserver

Step 2: Configure VNC Server

  1. Use the following command to edit the configuration file of VNC Server:

    nano ~/.vnc/xstartup
  2. 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 &
  3. Save and exit the configuration file.

Step 3: Enable VNC Server auto-start

  1. Enter the following command to create a new system service (service) file:

    sudo nano /etc/systemd/system/vncserver@.service
  2. 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 <your_username></your_username> with your actual username.

  3. Save and exit the file.
  4. Enter the following command to let the system load the new service file:

    sudo systemctl daemon-reload
  5. 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.

  1. 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.

  1. In the VNC Viewer software, enter the server’s IP address and port number (for example: 192.168.0.100:5901).
  2. Enter the VNC password set previously.
  3. Click the "Connect" button and wait for the connection to be successful.

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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How do I use Maven or Gradle for advanced Java project management, build automation, and dependency resolution?How do I use Maven or Gradle for advanced Java project management, build automation, and dependency resolution?Mar 17, 2025 pm 05:46 PM

The article discusses using Maven and Gradle for Java project management, build automation, and dependency resolution, comparing their approaches and optimization strategies.

How do I create and use custom Java libraries (JAR files) with proper versioning and dependency management?How do I create and use custom Java libraries (JAR files) with proper versioning and dependency management?Mar 17, 2025 pm 05:45 PM

The article discusses creating and using custom Java libraries (JAR files) with proper versioning and dependency management, using tools like Maven and Gradle.

How do I implement multi-level caching in Java applications using libraries like Caffeine or Guava Cache?How do I implement multi-level caching in Java applications using libraries like Caffeine or Guava Cache?Mar 17, 2025 pm 05:44 PM

The article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra

How can I use JPA (Java Persistence API) for object-relational mapping with advanced features like caching and lazy loading?How can I use JPA (Java Persistence API) for object-relational mapping with advanced features like caching and lazy loading?Mar 17, 2025 pm 05:43 PM

The article discusses using JPA for object-relational mapping with advanced features like caching and lazy loading. It covers setup, entity mapping, and best practices for optimizing performance while highlighting potential pitfalls.[159 characters]

How does Java's classloading mechanism work, including different classloaders and their delegation models?How does Java's classloading mechanism work, including different classloaders and their delegation models?Mar 17, 2025 pm 05:35 PM

Java's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function