Here are three operational methods that are installed when setting up the Raspbery Pi
table of contents
This is Mandai from the development team.
This time, I would like to introduce a somewhat rough operation method that I use when setting up Raspberry Pi
table of contents
- Allow to send email
- Once connected to the network, send your IP address via email
- Reserve disk space using webdav
Allow to send email
To install postfix on your Raspberry Pi and start up the mail server, type sudo apt-get install postfix.
I think that's a meaningful experience that will be useful in the future, but it takes time to set up anyway.
I want to be able to send emails in just a few minutes!
In such cases, the quickest way is to use a simple MTA called ssmtp to turn Gmail or other email servers.
The configuration file is plain text, so if you log in to the console, your email address and password will be completely visible, but I think it would be good for you personally.
Of course, don't worry, as we do not have any installed servers.
If you are using Raspbian, install it in one go with the apt-get command.
sudo apt-get install ssmtp
Once the installation is complete, edit the configuration file.
If you are sending an email using gmail, then /etc/ssmtp/ssmtp.conf will look like this:
# # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=[email address] # root=postmaster # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com mailhub=smtp.gmail.com:587 AuthUser=[email address] AuthPass=[email address password] UseSTARTTLS=YES AuthMethod=LOGIN # Where will the mail seem to come from? rewriteDomain= # The full hostname hostname=[email address] # Are users allowed to set their own From: address? # YES - Allow the user to specify their own From: address # NO - Use the system generated From: address FromLineOverride=YES
Once the settings are complete, use the mail command to check if you can send emails.
echo "hogehoge" | mail -s "fugafuga" [email address]
If the email can be sent successfully, the settings are complete.
Once connected to the network, send your IP address via email
Since Raspberry Pi does not have a display, there is no way to log in unless you know the IP address automatically obtained using DHCP.
Therefore, once the Raspberry Pi is infiltrated into a suitable network, we will notify it by email of its IP address.
The shell script placed directly under /etc/network/if-up.d/ will be executed when the link is linked up, so at this time, insert the shell script below to send the IP address.
# /bin/bash /sbin/ifconfig | mail -s "My network information" [email address]
It's not a command that gets much praise, but it meets the necessary requirements.
If our infrastructure team saw it, it would be so sloppy that it would blow up and collapse.
You may want to try unplugging and plugging in the LAN cable to see if it works properly.
Reserve disk space using webdav
The Raspberry Pi uses an SD card as the HDD.
However, the price of a large capacity SD card is higher than the main unit.
So, although this is not very relevant to the purpose of this article, we will introduce how to use cloud services as disks via webdav.
we will try using a box that supports webdav
Install the required software with apt-get.
sudo apt-get install davfs2
Once installed, create a directory to mount.
This time, we assume that a directory called dav_box is created and mounted under the pi user's user directory.
mkdir /home/pi/dav_box
After installation, place a file containing the URL to mount and BOX account information in /etc/davfs2/secrets.
sudo vi /etc/davfs2/secrets # Add the following at the end /home/pi/dav_box [BOX account email address] [BOX password]
If you have a bad feeling, that's exactly right, and I have saved it in plain text.
This doesn't seem to be necessary, and if you only feel disgusting, if you don't set it up, you can type in the account information confirmation that is requested every time you mount it.
Finally, we will add the webdav mount information to /etc/fstab.
https://dav.box.com/dav /home/pi/dav_box davfs rw,noauto,user 0 0
Finally, he slowly mounted it and looked proud.
mount /home/pi/dav_box
I don't know if it's because of the performance of the Raspberry Pi, the Webdav in the Box, or whether it's both, but it's quite slow.
If you try the df command while it is mounted, you can experience how slow it is, so be sure to check it out.
Now you can always add your Raspberry Pi and don't get lost.
There are many advance preparations to dodge, such as attaching a Wi-Fi dongle and setting up a Wi-Fi account, but
there are many other sites that explain these things, and if
you write this far, another member might write them down, so I'll skip it.
Well then, everyone has a great rasp pie life!
If you want to consult a development professional
At Beyond, we combine our rich track record, technology and know-how in system development that we have cultivated to date with OSS technology and cloud technologies such as AWS to create contract development of web systems with reliable quality and excellent cost performance.
We also work on server-side/backend development and linkage development of our own APIs, using the technology and know-how of the construction and operation of web system/app infrastructure for large-scale, highly loaded games, apps, and digital content.
If you are having trouble with development projects, please visit the website below.
● Web system development
● Server-side development (API/DB)