How to edit code and install packages remotely to RetroPie on your Raspberry-pi

How to Edit Code and Install Packages Remotely to RetroPie on Your Raspberry Pi

Editing code and installing packages to a RetroPie setup on a Raspberry Pi when you don’t have a dedicated keyboard or monitor can be an arduous process… I know this from personal experience! Thankfully there is a way that you can connect to your Raspberry Pi remotely from your PC, making it significantly easier to add, edit and remove code and files until your hearts content.

The basic steps to connecting to your Raspberry Pi from your PC are as follows –

  1. Connect your Raspberry Pi to the network.
  2. Enable Secure Shell (SSH) on your Raspberry Pi.
  3. Download the PuTTY SSH app onto your Windows PC.
  4. Run the SSH application.
  5. Enter the IP address of your Pi into the Host Name field.
  6. Connect to your Raspberry Pi.

Let’s go through these steps in more detail.

Connect Your Raspberry Pi to the Network

In order for your PC to detect the Raspberry Pi, the Pi needs to be connected to the network. This needs to be the same local area network (LAN) that your PC is connected to, otherwise your PC will not be able to detect the Raspberry Pi.

There are two ways to connect the Raspberry Pi to the network. The simplest way is to connect through an ethernet cable. Simply plug an ethernet lead into your Raspberry Pi and then connect the other end to the router which your PC is connected to.

There should be several ethernet ports on your router so that you can plug in multiple devices at any one time. If all the ethernet ports are already occupied then you may need to invest in an ethernet hub. These can be picked up extremely cheaply through Amazon.

As of the Raspberry Pi 3 wireless connectivity is now included so if you have this model you can also connect to your computer through wifi.

Connecting up to the wifi network with the Raspberry Pi 3 is made very easy through RetroPie, although you will need to have a keyboard connected in order to do it. From the RetroPie configuration screen select the WIFI option in the menu. In the resulting screen select option 1 – Connect to WiFi network, then select your desired network from the list and enter the password. You will now be wirelessly connected to the network.

Enable SSH on Your Raspberry Pi

For security reasons SSH connectivity on the Raspberry Pi is disabled by default. Thankfully, RetroPie makes it easy for you to enable this:

  1. From the configuration screen in RetroPie select Raspi-config.
  2. Then select option number 5 – Interfacing Options.
  3. Then select option P2 – SSH.
  4. You will then be asked if you want the SSH server enabled – Select Yes.
  5. SSH is now enabled on your Raspberry Pi so you can select Finish.
  6. A reboot of RetroPie in this case is not necessary, but I would recommend it to avoid any unforeseen issues.

Download an SSH Application

In order to connect to your Raspberry Pi you will need an SSH application. If you have a Mac you’re in luck as one comes installed with the operating system (OS).

If you’re using a windows PC a recommended SSH application is PuTTY, which can be downloaded and installed here.

Depending on the OS you have you will need to download either the 32-bit or the 64-bit version of PuTTY. It is most likely that you have a 64-bit OS, however if you want to be sure follow the steps below –

  1. Click on the Windows button on the left hand side of the task bar.
  2. Click on the Settings button.
  3. Select About from the left hand side menu.
  4. The type of OS you have will be detailed next to System type.

Once you have downloaded the PuTTY installation file you are ready to install PuTTY. Double click the installation file and follow the steps in the install wizard. I would recommend you go with all the default options in this case.

Run the SSH Application

Once you have downloaded and installed PuTTY, you are ready to run the application.

To start up PuTTY click on the Windows button on the left of the task bar. In the Applications menu scroll down to P where you will find the PuTTY suite that you have just installed. Click on the PuTTY icon to start the application.

In future, instead of jumping through all these hoops just to start up the application you can create a shortcut and add it to your taskbar. To do this navigate to the PuTTY icon as you would to start the application. Then simply click and drag the icon down to the task bar at the bottom of your screen. This will add a shortcut icon to your taskbar so that you can now open PuTTY in just one click.

If you are using a Mac you setup an SSH connection through the Terminal application which can be found in the Application > Utilities folder.

Enter the IP Address of Your Raspberry Pi into the Host Name Field

You will need to know the IP address of your Raspberry Pi in order to connect to it. It is very simple to find this out when running RetroPie. Simply follow the steps below –

  1. From the configuration screen in RetroPie select Show IP.
  2. The IP address is then shown on screen. Write it down so that you can reference it when you are ready to enter it into PuTTY.

You now have everything you need to connect to your Raspberry Pi. Enter your IP address into the Host Name field in PuTTY.

In certain circumstances you can simply enter ‘retropie’ into the Host Name field and it is not necessary to know the Raspberry Pi IP address. This does not work every time so in such cases you should enter the IP address.

Connect to Your Raspberry Pi

You are now ready to connect to your Raspberry Pi. In PuTTY make sure the Connection type is set to SSH and click on the Open button.

You will then be presented by a Potential Security Breach alert box. This is nothing to be concerned about in this case so you should just click Yes.

A command window will now open. Here you will be prompted to enter the Username and password for the device you are connecting to. In the case of the Raspberry Pi, the default username is ‘pi’ and the default password is ‘raspberry’. You are able to change these details if you want but in the case of using the Pi as a retro games machine, it isn’t really necessary and so won’t be covered in this tutorial.

Upon entering the login details, PuTTY will then proceed to connect you to the Raspberry Pi. Congratulations! You can now go ahead and view directories, create files, install packages as well as a host of other things through the Raspberry Pi command line.

Related Questions

Can this be done on other single board computers running RetroPie? Yes, it can. PuTTY and other SSH applications are universal and not just specific to the Raspberry Pi or RetroPie. The procedure for connecting may be slightly different in some circumstances but the basics of it will be the same.

Are there other alternatives for editing scripts on the Raspberry Pi? Yes, there are. In fact there are several alternatives. They include editing the files locally, however in this case it is recommended that you have a dedicated keyboard and monitor connected to your Raspberry Pi. Plus you will need to keep going in and out of the RetroPie application which can be very tedious. Another method would be by transferring the files by way of a flash drive, however the process of having to constantly move the memory stick from one machine to another can prove to be very frustrating.

Can I copy files through SSH? Yes you can, although it is a slightly drawn out process and there are other easier methods for doing such things. I would recommend that you use SSH for editing existing directories/files and creating new ones. File transfer is a lot more efficient when using a graphical user interface (GUI) such as Windows Explorer.