Connecting Your Raspberry Pi to a Linux Laptop

Introduction: Connecting Your Raspberry Pi to a Linux Laptop

I have been involved with the Raspberry Pi (RasPi) now for over four months and found myself with five computers in my work area and needed to reduce their footprints and monitors on my workbench/desk. Upon reading an article about connecting the RasPi to a Laptop [1], I began my project. I use [#] as reference found in Step 5. Figure 1 is a photo of my system with a RasPi monitoring TV.

My project began with the RasPi. It already has the SD Card with the Operating System (OS) Raspbian installed. My Laptop has the OS Ubuntu installed. There is no discussion about the installation of either OS; details can be found in [2, 3]. This project is described in five steps:

Step 1 - Initial System Set-Up

Step 2 - Install VNC Server

Step 3 - IP Addresses

Step 4 - Install VNC Viewer

Step 5 - Final System Set-Up

Step 1: Initial System Set-up

Hardware used:

  • Laptop - Toshiba Qosmio with Ubuntu 14.04 (a Linux OS)
  • Ethernet cable
  • Micro USB Cable
  • TV: Element

  • HDMI cable

  • Wireless keyboard/mouse dongle subsystem*

  • Wireless internet dongle
  • Raspberry Pi: Model B+ (RasPi)
  • SD Card with Raspbian (a Linux OS)

*The wireless subsystem could be replaced by USB keyboard and USB mouse.

Additional RaspPi Software:

  • VNC Server

Additional Laptop Software:

  • VNC Viewer


Instruction Level: Intermediate

  • Should have some knowledge of Linux terminal commands
  • Should have SD card with Raspbian installed or know how to program SD card.

Physical Connections

You can physically connect the RasPi to the Laptop using an Ethernet cable. The desktop GUI (Graphical User Interface) of the RasPi can be viewed through the Laptop display using a 100Mbps Ethernet connection between the two. There are many softwares available that could establish connection between the RasPi and the Laptop, but the best - in my opinion, is the VNC Server software installed on the RasPi and the VNC Viewer software installed on the Laptop. The VNC Server on the RasPi allows the RasPi's desktop to appear remotely on the laptop. You can put the pi anywhere, and still control it. Also, internet can be shared between the Laptop’s and RasPi over Ethernet. This also lets you access internet on the RasPi and connect RasPi to Laptop display.

Figure 2 is a block diagram of the initial Laptop/RasPi system. The dotted lines indicate wireless connections to the Internet and the wireless keyboard/mouse to the RasPi. The final system will no longer require the TV or the wireless keyboard/mouse.

Examine Figure 3 as to the RasPi cable and dongle connections. Figure 4 illustrates the SD Card installation to the RasPi. Connect up all the cabling and install the dongles. Do not connect micro-USB (the RasPi power connector) until the TV and Laptop are powered up. After powering up the Laptop, connect the power connector to the RasPi. The TV should show the booting process of the RasPi and then (give it some time) the RasPi GUI should appear (Figure 5).

Step 2: Install VNC Server on RasPi

Using the connected HDMI display on your RasPi, you should install VNC server in the RasPi.. Open the Terminal and type the following commands to install VNC:

$ sudo apt-get update

$ sudo apt-get install tightvncserver

It is assumed that the RasPi has been connected to the internet and please note that a $ is placed in front as an indication of a Linux command.

Figure 6 illustrates the results of update and tightvnc installation.

Starting VNC Server on RasPi

For starting VNC, enter the following command:

$ vncserver :1

Upon prompt, enter and confirm a password. This will be asked only once, during first time setup. Enter an 8 digit password. Note that this is the password you will need to use connecting to the RasPi remotely. You will also be asked if you want to create a separate “read-only” password – respond with no (n).

The VNC Server is now running on the RasPi and connection to it can be be made, but now the Laptop must be setup with the VNC Client to connect to the RasPi.

VNC Server Runs upon Boot-Up

The following information was taken from [4].

Adding Tightvnc to systemd startup

To have tightvncserver startup automatically we need to create a new startup file. This needs to be stored in the /etc/systemd/system/ directory and end with the suffix ".service". I called this tightvncserver.service.

$ sudo nano /etc/systemd/system/tightvncserver.service

The following is to be entered... without the line numbers:

  1. [Unit]
  2. Description=TightVNC remote desktop server
  3. After=sshd.service
  4. [Service]
  5. Type=dbus
  6. ExecStart=/usr/bin/tightvncserver :1
  7. User=pi
  8. Type=forking
  9. [Install]

You may need to change the user name on line 8. It is currently set to pi which is the default username on the RasPi Raspbian image. Set this to whatever username you want to login to tightVNC as. Do not put root as the user.

Change the file so it is owned by root

$ sudo chown root:root /etc/systemd/system/tightvncserver.service

Make the file executable by running

$ sudo chmod 755 /etc/systemd/system/tightvncserver.service

It's a good idea to test the script at this point rather than waiting until after a reboot. This is done using:

$ sudo systemctl start tightvncserver.service

Don't worry if you get the following error message, which is because you've already started tightvnc

A VNC server is already running as :1

Enable Startup at Boot

$ sudo systemctl enable tightvncserver.service

As you boot up, tightvnc will now start. I'd recommend you reboot at this point to make sure it's working but youc an just stop and start the service using the systemctl command instead.

Note that this is designed for running only one instance of tightvnc on the computer. If you want to be able to start and stop specific instances of tightvnc then you will need to tweak the startup script appropriately.

Step 3: IP Addresses

This step checks that the Laptop and the RasPi can communicate.

Laptop IP Address

With the Laptop terminal enter:

$ ifconfig eth0

It should return the Laptop IP address something as

inet addr:

RasPI IP Address

Now, with the RasPi terminal enter:

$ ifconfig eth0

It should return the RasPi IP address something as

inet addr:

If not, change it match the Laptop IP with the last three digits different than the Laptop IP.

Test Connection

While in the Raspi terminal enter

$ ping

You should get a series of returns indicating packets of bytes from the Laptop.

Go to the Laptop terminal enter:

$ ping

You should get a series of returns indicating packets of bytes from the RasPi (Ctrl^C to exit).

Step 4: Install VNC Viewer on Laptop (Client Side)

Download VNC client from [5] and install it. At first run of VNC Viewer, Figure 7 will appear, but you'll have to put in your RasPi IP address in the space for VNC Server:. Click connect and enter the 8-digit password that you used to create the VNC Server. Append password with :1. This denotes port number, then press Connect. Figure 8... don't forget the user name which may be pi. Click OK. You will get a warning message, press ‘Continue’:

Finally, the RasPi desktop GUI itself should appear as a VNC window as in Figure 5. You will be able to access the GUI and do everything, as if you were using the RasPi’s keyboard, mouse and monitor directly. As with SSH, since this is working over your network, your RasPi could be situated anywhere as long as it is connected to your network.

Step 5: Final System Set-up

Since the RasPi can now be viewed and controlled with the Laptop, there no need for the TV, HDMI cable, and the wireless keyboard/mouse or dongle.







First Time Author Contest 2016

Participated in the
First Time Author Contest 2016

Internet of Things Contest 2016

Participated in the
Internet of Things Contest 2016

Be the First to Share


    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    9 Discussions


    3 years ago

    Very informative! My 7 year old just built her first Zero and it only has WiFi, but this should work as long as host and client are on the same router. Pretty neat that they'll share internet via CAT5, used to have to use crossover cables for that.


    3 years ago

    Hello, I tried every step and somehow when I try to connect the pi I have this error: "<11> 2017-08-03T10:55:04.394Z mooc-tid vncviewer[3174]: Child: 3176: CSession: connection error: connect: Network is unreachable (101) ". Could you please help?


    Reply 3 years ago

    I'm waiting for a new laptop. My old laptop motherboard failed. After I load in the required software I should be able to help you.

    Please answer the following:
    1. What computer are you using with your Raspberry Pi.
    2. Which Raspberry Pi are you hooking to the computer?

    I will get back with you as soon as I have everything up and running and your answers.



    Reply 3 years ago


    I have a Raspberry-PI 3 connected to a small motorola laptop and I am trying to connect it to a RedHat Virtual Machine that I have on my Lenovo laptop so that I can access the Pi from the RedHat terminal.

    Thank you so much for your help!



    4 years ago

    I was wondering about any lag. my current laptop is a bit crappy and comparable to my RbPi B (not plus). Should I expect any worst speeds than I already have?


    Reply 4 years ago

    I'm sorry. Your description of the lag (delay) is vague. The Raspberry Pi may not be as fast as you would expect, So expect delay..


    Reply 4 years ago

    My laptop runs a single core 1.5Ghz with 1 or 2gb (can't fully remember), so some operations are a bit slow and sometimes freeze. Sorry about the vague description.

    DIY Hacks and How Tos

    Nice tutorial. I have been meaning to start experimenting with Raspberry pi. So I might have to try this.


    Reply 4 years ago

    Have fun: give it a try. Let me know.