Difference between revisions of "About"

From Networks of Care
Jump to navigation Jump to search
(Created page with "==Setting up my raspberry pi==")
 
Line 1: Line 1:
 
==Setting up my raspberry pi==
 
==Setting up my raspberry pi==
 +
 +
In my computer:
 +
 +
'''SD card'''
 +
 +
1. Format for FAT32 (I used disk utility on mac. Format to MS_DOS). Use more than 8gb, mediawiki can become heavy.
 +
 +
 +
2. Flash ISO to SD card (Raspbian Buster Light, https://www.raspberrypi.org/downloads/raspbian/ ) with a mounter (I've used etcher https://www.balena.io/etcher/ )
 +
 +
 +
With raspi connected to power, internet, screen and keyboard:
 +
 +
'''01 Default login'''
 +
 +
Login: pi
 +
 +
Password: raspberry
 +
 +
 +
'''02 SSH config'''
 +
 +
    $ cd /boot
 +
 +
    $ sudo touch ssh
 +
 +
    $ sudo reboot
 +
 +
 +
'''03 Check IP address'''
 +
 +
    $ hostname -i
 +
 +
Response: 192.0.0.0
 +
 +
 +
'''04 My keyboard wasn't working properly.'''
 +
 +
I had to change language of keyboard to US instead of UK.
 +
 +
    $ sudo raspi-config
 +
 +
    Localisation Options
 +
 +
    Change Keyboard Layout
 +
 +
    Choose US
 +
 +
After using the keyboard I changed back to UK to avoid errors.
 +
 +
 +
'''05 Change hostname'''
 +
 +
    $ ssh pi@192.0.0.0
 +
 +
    $ sudo raspi-config
 +
 +
    Choose item no. 2 on the menu: Network Options
 +
 +
    Rename hostname to: newhostname
 +
 +
    $ reboot
 +
 +
 +
'''06 Add user'''
 +
 +
    $ sudo adduser name
 +
 +
 +
'''07 Add new user to sudo'''
 +
 +
    $ sudo adduser name sudo
 +
 +
 +
'''08 You should be able to login with:'''
 +
 +
    $ ssh name@newhostname
 +
 +
 +
'''09 I had an error with known hosts.'''
 +
I removed cached key on my computer:
 +
 +
    $ ssh-keygen -R 192.000.0.000
 +
 +
 +
'''10 Remove default pi user'''
 +
 +
    $ sudo deluser pi
 +
 +
 +
'''10 Use key-based authentication:'''
 +
 +
 +
'''10.1 Add .ssh keys to RPI'''
 +
 +
https://www.raspberrypi.org/documentation/remote-access/ssh/passwordless.md#copy-your-public-key-to-your-raspberry-pi
 +
 +
 +
'''10.2 Edit file'''
 +
    $ sudo nano /etc/ssh/sshd_config
 +
 +
Uncomment PassowrdAuthentication and set it to no;
 +
 +
Uncomment PermitRootLogin prohibit-passowrd;
 +
 +
 +
'''10.3 Reload SSH'''
 +
 +
    $ sudo /etc/init.d/ssh restart
 +
 +
 +
'''10.4 Reboot RPi'''
 +
 +
    $ sudo reboot
 +
 +
 +
'''10.5 In my computer:'''
 +
 +
    $ cd ~/.ssh
 +
 +
    $ sudo nano config
 +
 +
 +
Add to the document:
 +
 +
    Host newhostname
 +
        User name
 +
        Hostname 192.000.0.0
 +
        Port 22
 +
        Identityfile /Users/ritagraca/.ssh/id_rsa
 +
        Serveraliveinterval 30
 +
 +
 +
'''10.6 To ssh to my pi now:'''
 +
 +
    $ ssh newhostname
 +
 +
 +
DONE!!!

Revision as of 17:37, 1 May 2020

Setting up my raspberry pi

In my computer:

SD card

1. Format for FAT32 (I used disk utility on mac. Format to MS_DOS). Use more than 8gb, mediawiki can become heavy.


2. Flash ISO to SD card (Raspbian Buster Light, https://www.raspberrypi.org/downloads/raspbian/ ) with a mounter (I've used etcher https://www.balena.io/etcher/ )


With raspi connected to power, internet, screen and keyboard:

01 Default login

Login: pi

Password: raspberry


02 SSH config

   $ cd /boot
   $ sudo touch ssh
   $ sudo reboot


03 Check IP address

   $ hostname -i

Response: 192.0.0.0


04 My keyboard wasn't working properly.

I had to change language of keyboard to US instead of UK.

   $ sudo raspi-config
   Localisation Options
   Change Keyboard Layout
   Choose US

After using the keyboard I changed back to UK to avoid errors.


05 Change hostname

   $ ssh pi@192.0.0.0
   $ sudo raspi-config
   Choose item no. 2 on the menu: Network Options
   Rename hostname to: newhostname
   $ reboot


06 Add user

   $ sudo adduser name


07 Add new user to sudo

   $ sudo adduser name sudo


08 You should be able to login with:

   $ ssh name@newhostname


09 I had an error with known hosts. I removed cached key on my computer:

   $ ssh-keygen -R 192.000.0.000


10 Remove default pi user

   $ sudo deluser pi


10 Use key-based authentication:


10.1 Add .ssh keys to RPI

https://www.raspberrypi.org/documentation/remote-access/ssh/passwordless.md#copy-your-public-key-to-your-raspberry-pi


10.2 Edit file

   $ sudo nano /etc/ssh/sshd_config

Uncomment PassowrdAuthentication and set it to no;

Uncomment PermitRootLogin prohibit-passowrd;


10.3 Reload SSH

   $ sudo /etc/init.d/ssh restart


10.4 Reboot RPi

   $ sudo reboot


10.5 In my computer:

   $ cd ~/.ssh
   $ sudo nano config


Add to the document:

   Host newhostname
       User name
       Hostname 192.000.0.0
       Port 22
       Identityfile /Users/ritagraca/.ssh/id_rsa
       Serveraliveinterval 30


10.6 To ssh to my pi now:

   $ ssh newhostname


DONE!!!