vnc server ubuntu
时间: 2023-10-10 20:10:03 浏览: 102
To install and set up VNC server on Ubuntu, you can follow these steps:
1. Update your system's package list:
```
sudo apt update
```
2. Install a desktop environment (if you haven't already):
```
sudo apt install ubuntu-desktop
```
3. Install the VNC server software (TightVNC):
```
sudo apt install tightvncserver
```
4. Run the VNC server setup:
```
tightvncserver
```
During the first run, it will prompt you to set a password for VNC access. Choose a strong password and remember it.
5. Stop the VNC server:
```
tightvncserver -kill :1
```
6. Configure the server to start at boot:
```
sudo nano /etc/systemd/system/vncserver@.service
```
Add the following content to the file and save it:
```
[Unit]
Description=VNC Server at %i
After=syslog.target network.target
[Service]
Type=forking
User=<YOUR_USERNAME>
PAMName=login
PIDFile=/home/%u/.vnc/%H%i.pid
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
```
Replace `<YOUR_USERNAME>` with your actual username.
7. Enable and start the VNC server service:
```
sudo systemctl enable vncserver@1.service
sudo systemctl start vncserver@1.service
```
You can replace `1` with the display number you want to use.
After completing these steps, you should be able to connect to your Ubuntu machine using a VNC client using the IP address or hostname of the server, followed by the display number (e.g., `192.168.1.100:1`).
阅读全文