MX on Linux: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
1,768 bytes added ,  29 September 2020
m
We will need to restart Apache (or whichever web server we installed) any time we change our php.ini files, database passwords, and anything else that is checked when the web server starts.
 
== Pre-configuringOperating theyour Raspberry Pi forin headless operationmode ==
 
The terminology "headless" means using another device to send commands to a Pi via a wired or wireless network, instead of connecting a keyboard and monitor (or TV) directly to the Pi so you make all selections directly on it.
 
For a novice, the easiest way to set up your Pi (as described above) requires (at least temporary) a keyboard and a monitor (can be a TV) to be connected to it. You might also want to connect a mouse. Depending on the Raspberry Pi you bought, and whether you bought a keyboard (or can borrow one from any PC you have), the ease of making these connections will vary. Once your Pi is set up, and you have started MX running, you can disconnect these peripherals, and leave your Pi running.
If you are only going to use the Pi in headless mode, you will select this next '''configuration'''. In '''Boot Options''', ''Desktop / CLI'', select '''Console Autologin'''. On your actual Pi, instead of showing the desktop as default, you will see the splash screen (unless in another option you turn it off) that says "Welcome to the Raspberry Pi Desktop - Powered by Raspbian" and a terminal prompt where you can enter commands. Alternatively, in boot options, select another option depending on what you want to do when you have a keyboard and monitor (or TV) connected to your Pi.
 
=== Remote access ===
If you insert the micro-SD card (used on your Pi) into your PC, you can store files in the boot partition of the micro-SD card that can be accessed by Windows.
 
There are various different ways that another device can access the Pi over networks. The most popular lets a Terminal mode on your other device connect to your Raspberry Pi using Secure Shell Home, and the commands you type in on your other device are just the same ones you would type directly into the Raspberry Pi terminal mode. The responses you get are also the same. What is likely to be different is
*any control sequences,
*any copy and paste operations,
*and any other actions that are specific to the terminal mode on the other device.
 
====Alternative to SSH====
 
While SSH gives you access to command lines, and lets you use '''sudo''' to overcome the fact that the default user does not have '''root''' rights, there might be some times when you are operating your Pi in a headless state (without keyboard or monitor) yet you want to explore its graphical user interface. See [https://thepihut.com/blogs/raspberry-pi-tutorials/remotely-accessing-the-raspberry-pi-via-rdp-gui-mode this tutorial] for one way to do this. Although this article does not cover such options that let you see graphical user interfaces, these let your other device see selection screens, browsing screens, and similar, just as you would see them if you had a monitor connected to your Pi.
=== Secure Shell Home ===
 
You might find such an alternative is easier for you, as graphical interfaces let you achieve what you want by on screen selections, without having to learn what Linux commands to type in.
==== What is SSH?====
 
==== What is Secure Shell Home ?====
Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. If you have two devices (your Pi and another computer), SSH will allow the two devices to exchange commands and responses between a terminal and a computer. You may be too young to remember when communication with a computer was often done remotely using a Teletype or similar device acting in terminal mode, just 4 decades ago this would have been a familiar experience to anyone working with computers, now it may seem strange for you. It is possible you have remote connection from home to a computer at your work (although that probably uses a different protocol as the network is likely to be more secured).
 
Secure Shell Home (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. If you have two devices (your Pi and another computer), SSH will allow the two devices to exchange commands and responses between a terminal and a computer. You may be too young to remember when communication with a computer was often done remotely using a Teletype or similar device acting in terminal mode, just 4 decades ago this would have been a familiar experience to anyone working with computers, now it may seem strange for you. It is possible you have remote connection from home to a computer at your work (although that probably uses a different protocol as the network is likely to be more secured).
====How to set up SSH?====
 
SSH is switched off by default on a standard Raspberry Pi set up. You can if you have a keyboard and screen attached to your Pi, go into the configuration screen it offers and switch SSH on.
If you want to run your Pi headless (without monitor, keyboard, mouse), then you must ensure SSH (which is off by default) is switched on as your Pi boots up. The only way to achieve that is by adding a file '''SSH''' to the boot partition before the micro=SD card is put into the Pi. If you don't do this you cannot get headless operation, and you will need to move a monitor or TV, mouse, and keyboard, across to the Pi, because you can't even close down the Pi tidily!
The easiest way is using the '''Raspi-config''' tool, either from the main menu (raspberry Pi icon inside a square) or in terminal mode with '''sudo raspi-config''' (choose option 5 = ''Interfacing Options'', look for SSH). This will enable you to later access your Pi from your PC and might be useful later on. While you are in the configuration tool choose option 1 = ''Change User Password'', and set the password you will use for your SSH session; the default password is '''raspberry''', but you don't want to let hackers into your Pi, so you will choose something hard to guess.
 
The next sub-section describes how you can switch SSH on during the first boot, by creating a file on the micro-SD card before you insert it into your Pi, the file is removed as part of the boot process, so this only works once.
The file, you add to the boot partition, must be named "SSH" with those three letters in capitals, but with no file extension. You can create the file with whatever text editor you have available.
 
====Pre-configuring the Pi for headless operation====
 
If you want to runset up your Pi headless (without monitor, keyboard, mouse), then you must ensure SSH (which is off by default) is switched on as your Pi boots up. Otherwise you have no access to do any setting up, and you cannot even close down the Pi tidily! The only way to achieve thatthis, is by adding a file '''SSH''' to the boot partition before the micro=-SD card is put into the Pi. If you don't do this you cannot get headless operation, and you will need to move a monitor or TV, mouse, and keyboard, across to the Pi, because you can't even close down the Pi tidily!.
 
The file, you add to the boot partition (there is a second partition that may be invisible), must be named "SSH" with those three letters in capitals, but with no file extension. You can create the file with whatever text editor you have available.
*On a Windows PC, if you right click (while viewing the boot directory on the card) there is an option called '''New''' and if you select ''a text file'' it will create an empty file with the extension '''.txt'''. (In windows there is an option to hide extensions which is on by default, so you may need to deselect this option ['''New''' menu -> ''Options''] to see this extension). On Windows you can open the file using Notepad to verify it is empty, if you gave accidentally created a file of another type like word processing it will be full of characters some of which do not display. Anyway, you must remove any extension from the file name so it is really just '''SSH'''.
 
Type into the file <tt>touch ssh</tt>, but nothing else, no empty lines, no end of line characters.
 
When the card is inserted into your Pi, on boot this file will be removed and the SSH option will be enabled. The default password is '''raspberry''', once you have successfully got SSH working,. You should then withuse '''sudo raspi-config''' (choose option 1 = ''Change User Password'', and set the new password you will use for your SSH session next time).
 
''Of course'' if you have a monitor or TY, and a mouse and a keyboard, then you don't need to use SSH, but you can give yourself the best of both worlds by switching SSH on, the easiest way is using the '''Raspi-config''' tool, either from the main menu (raspberry Pi icon inside a square) or in terminal mode with '''sudo raspi-config''' (choose option 1 = ''Change User Password'', and set the password you will use for your SSH session; then choose option 5 = ''Interfacing Options'', look for SSH).
 
====How to use SSH?====
If you have a Windows PC, this will allow you to open a '''Command''' prompt, '''Power Shell''', or '''Terminal''' window (the selection you have available depends on certain settings). If you have a Linux or Mac device, open '''Terminal'''. Next, assuming your Pi is running, on whatever other device you have on the same local network, type <tt>ssh pi@raspberrypi</tt> to get access to default user in your Pi.
 
(As an alternative for Windows operating system, you can install PuTTY, andthis usehas the advantage that you can enter the connection settings into it, and configure various options, so you might find it easier to use. '''PuTTY''' software (an SSH client for Windows) can be downloaded from <tt>https://www.putty.org/</tt>).
 
When you are using a terminal, someit ofis thea keysequential combinationsdevice, oreach mouseline actions,is willeither besomething differentyou totype thosein thator worksomething whensent usingback the computerin normallyreply. YouThe willaction needthat toresult checkfrom any key combinations depend on your terminal application, andnot alsojust whatever you are running on your Pi;. but you might find theYour mouse can't affect cursor location, but the mouse might be needed to select text, the left click might copy what is selected, and the right click might paste (what is in your PC's clipboard) at current cursor position.
 
====Alternative to SSH====
 
While SSH gives you access to command lines, and lets you use '''sudo''' to overcome the fact that the default user does not have '''root''' rights, there might be some times when you are operating your Pi in a headless state (without keyboard or monitor) yet you want to explore its graphical user interface. See [https://thepihut.com/blogs/raspberry-pi-tutorials/remotely-accessing-the-raspberry-pi-via-rdp-gui-mode this tutorial] for one way to do this.
 
===Headless Wireless Network set up===
 
If you don't connect a keyboard and monitor to your Raspberry Pi, you can't set up the wireless network configuration on ityour Pi using one of the provided configuration tools as described in the earlier wireless network sub-section.
 
You can use the SSH approach described immediately above to access the '''Raspi-config''' tool and in that do the necessary configuration.
 
There is one further, complicated, way to set up the wireless configuration so that the wireless network will work when you first boot up your Raspberry Pi. If you have brought the Zero model, that does not allow Ethernet connection, you might decide to follow this complex approach that involves creating a text file in the boot partition of your micro-SD card, and store it in the boot directory on your micro-SD card with a file name '''wpa_supplicant.conf''' before you insert that card in your Pi and do its first boot.
 
A note of caution here, it is easy to make mistakes, and you may find this does not work. It is presented here just to cover all options, to use this does require some technical skill, a novice will be better off avoiding this.
5,838

edits

Navigation menu