- Raspberry Pi Zero Cookbook
- Edward Snajder
- 515字
- 2021-07-09 19:12:11
Sharing a screen on your desktop computer
While it is inevitable that you will use the command line a lot when using Linux, a lot of people enjoy Raspbian's GUI. But you still want to keep your Zero in the attic! No problem at all: the Virtual Network Computing (VNC) service makes the GUI available from anywhere you able to connect.
Getting ready
Stay connected to your Raspberry Pi Zero with your SSH terminal. On your home computer, you will need a VNC viewer application. I love the VNC Viewer Chrome extension, and it is available on any platform.
How to do it...
- First, you need to install a VNC server on your Raspberry Pi Zero. To install it on Raspbian, type the following:
sudo apt-get install tightvncserver
- Once it's installed, starting it is as simple as typing
vncserver
:$ vncserver New 'X' desktop is rpz14101:1 Starting applications specified in /home/pi/.vnc/xstartup Log file is /home/pi/.vnc/rpz14101:1.log
- The first time you start a server, it will prompt you for a password. This is the password that you will use to connect using the VNC viewer. The VNC session you create will be for the user that started it, so if you initialized it from the
pi
user as in the previous example, VNC connections in it will also be for thepi
user, if you are logged on as root, VNC will connect as root, and so on. - Now your Zero is available on the network over VNC. Any kind of device that can run a VNC viewer application will be able to use X Windows on the Pi. The VNC server returns the device name and a port instead of the IP address. To connect, we will use this format:
<IP Address>:<Desktop number>
Here's an example:
192.168.2.119:1
We'll use the same address we found with
ifconfig
and used to ping and SSH to our Raspberry Pi Zero. - Once you are connected, it works just like being directly connected to the Zero over HDMI. This way, you can use the Raspberry Pi Zero no matter where you or the Zero are located. If you need the command line, SSH is the ideal tool, but if you are using GUI tools such as Scratch, need to look something up with a browser, or write a song with Sonic Pi, the VNC connection will be the choice for you.
Note
Because of the Raspberry Pi Zero's size, some sacrifices had to be made. It uses an older CPU, which is quite a bit slower overall than the Raspberry Pi 2 or 3. If you are planning to use the GUI a lot, you might want to use one of the larger, faster models. The Raspberry Pi Zero is perfectly capable, but it won't be nearly as much fun playing Minecraft Pi over VNC as it would be on a Raspberry Pi 3.
- Logging on using a VNC viewer is as simple as providing the IP address and desktop number:
- You'll be prompted for the password you created when you set up the VNC server, and then you are ready to go!
- Microsoft Dynamics CRM Customization Essentials
- 嵌入式系統(tǒng)及其開發(fā)應(yīng)用
- 平面設(shè)計(jì)初步
- Learning Apache Cassandra(Second Edition)
- 數(shù)據(jù)運(yùn)營(yíng)之路:掘金數(shù)據(jù)化時(shí)代
- 精通Excel VBA
- 計(jì)算機(jī)圖形圖像處理:Photoshop CS3
- 機(jī)器學(xué)習(xí)流水線實(shí)戰(zhàn)
- 大數(shù)據(jù)技術(shù)與應(yīng)用
- 數(shù)據(jù)通信與計(jì)算機(jī)網(wǎng)絡(luò)
- CentOS 8 Essentials
- 計(jì)算機(jī)網(wǎng)絡(luò)安全
- Linux服務(wù)與安全管理
- 突破,Objective-C開發(fā)速學(xué)手冊(cè)
- 氣動(dòng)系統(tǒng)裝調(diào)與PLC控制