This technote is based on Raspbian Stretch or Stretch-Lite circa September 2017.
I'll assume that the reader has just created a MicroSD Raspbian OS Stretch installation in the usual manner on a Linux, Mac, or Windows workstation. Directions for doing this can be found at https://www.raspberrypi.org/documentation/installation/installing-images/README.md .
After writing the MicroSD image, if the 2 Stretch partitions are not automounted,
- Wait for all writes to complete (`
sync; sync
` on Linux & Unix).
- Pull out the MicroSD caddy from the USB port.
- Push it back in.
This should cause an automount of the 2 Stretch partitions.
On my Linux system, `sudo blkid
` shows the following:
/dev/sdc1: LABEL="boot" UUID="E5B7-FEA1" TYPE="vfat" PARTUUID="020c3677-01"
/dev/sdc2: UUID="b4ea8e46-fe87-4ddd-9e94-506c37005ac5" TYPE="ext4" PARTUUID="020c3677-02"
with corresponding mount points displayed by the `mount
` command:
/media/USER-NAME/boot/
/media/USER-NAME/b4ea8e46-fe87-4ddd-9e94-506c37005ac5/
Enable SSH on the first Raspbian power-up:
cd /media/USER-NAME/boot/
touch ./ssh
Assuming that you are using Wifi, enable the connection. The following is an example on my Linux system for the USA using WPA-PSK security.
cd /media/USER-NAME/b4ea8e46-fe87-4ddd-9e94-506c37005ac5/etc/wpa_supplicant
sudo vi wpa_supplicant.conf
I replaced the existing contents of wpa_supplicant.conf with the following:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="Your network SSID"
psk="Your WPA/WPA2 security key"
key_mgmt=WPA-PSK
}
I highly recommend setting up a static IP address; this is very convenient for headless SSH operation. Assuming that:
- You are using Wifi and your wireless device is named wlan0
- The desired IP address for the Raspberry Pi = 192.168.1.104
- The router IP address = 192.168.1.1
- The primary DNS server is also at 192.168.1.1
append to /etc/dhcpcd.conf the following:
interface wlan0
static ip_address=192.168.1.104/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8
Adjust IP addresses as necessary for your environment.
Note that if you are using wired Ethernet instead of Wifi and its device name is eth0, then specify this interface instead (everything else is the same):
interface eth0
Be sure to sync changes to the MicroSD before removing the caddy from the USB port (Linux/Unix `sync; sync
`).
Next:
- Pull the caddy out of the USB port.
- Remove the MicroSD from the caddy.
- Insert the MicroSD into the Raspberry Pi.
- Power up.
From your workstation, connect to the Pi
ssh
pi@192.168.1.104
# Use the Pi's IP address once
Change the root password to something that you'll remember, just in case you might need it in the future. It could be the same as the password to be employed for user pi:
sudo passwd root
Configure the Pi by executing `sudo raspi-config
`.
- Change password for user pi
- Localisation - Language and Regional settings
- Timezone - Where are you?
- If you already have a Raspberry Pi with host name "raspberrypi", you will probably want to change the Pi's host name to something else.
- Reboot
On your workstation, I would enter the host name and static IP address for the Raspberry Pi in /etc/hosts (assuming the workstation is Linux or Unix; do what is appropriate for Mac or Windows).
From your workstation, connect to the Pi.
ssh pi@PI-HOST-NAME # Use the Pi's hostname value
Got an NFS file server that the user "pi" needs access to on a permanent basis? Permanently mount "/mnt/bigtree.nfs" in steps N1 through N4.
N1. I'll assume that your NFS server is set-up and you know how to manage it.
N2. On the Pi NFS client, set up a local mount location:
cd /mnt
sudo mkdir
sudo chown pi:pi bigtree.nfs
N3. Append the following to /etc/fstab; adjust per your local requirements:
# Mount bigtree.nfs using NFS
# NFS-SERVER = host name as specified in /etc/hosts (static IP address).
# This NFS server has "bigtree" rooted directly under file system "/data4188".
NFS-SERVER:/data4188/bigtree /mnt/bigtree.nfs nfs rw,bg,auto,noatime 0 0
N4. Test (always!):
sudo mount -a
touch /mnt/bigtree.nfs/xx
rm /mnt/bigtree.nfs/xx
Got a SAMBA file server that the user "pi" needs access to on a permanent basis? Permanently mount "/mnt/bigtree.samba" in steps S1 through S5.
S1. I'll assume that your SAMBA server is set-up and you know how to manage it.
S2. On the Pi NFS client, set up a local mount location:
cd /mnt
sudo mkdir
sudo chown pi:pi bigtree.samba
S3. Append the following to /etc/fstab:
# Mount bigtree using SAMBA
# SAMBA-SERVER = host name as specified in /etc/hosts (static IP address).
# This SAMBA server has a share named "bigtree".
//SAMBA-SERVER/bigtree /mnt/bigtree.samba cifs auto,owner,rw,credentials=/root/bigtree.credentials,uid=pi,gid=pi 0 0
S4. Create /root/bigtree.credentials for the login to the SAMBA server (read and write access):
username=SAMBA-USER-ID
password=SAMBA-USER-PASSWORD
S5. Test (always!):
sudo mount -a
touch /mnt/bigtree.samba/xx
rm /mnt/bigtree.samba/xx
Now is a good time to update your system:
sudo apt-get -y update
sudo apt-get -y dist-upgrade
sudo apt-get -y autoclean
sudo apt-get -y autoremove
sudo reboot
That's it
Find any bugs? Suggestions for improvement?
Richard Elkins
Dallas, Texas, USA, 3rd Rock, Sol
Comments
Please log in or sign up to comment.