Headless Installation

Problem:
You don't have any display to run the graphic interface and you need to install OS, configure the wifi and enable the remote ssh connection.

Solution:

1.- Download the OS image and save it into a SD.
from:



https://www.raspberrypi.org/documentation/installation/installing-images/README.md

2.- Burn the image to the SD using a software like balenaEtcher
https://www.balena.io/etcher/


2.- Setup the wifi adding the file “wpa_supplicant.conf” in boot folder.
network={ ssid="<Name of your WiFi>" psk="<Password for your WiFi>"}

3.- Setup SSH.
You only need to create an empty file named "ssh" in the boot file.


4.- Power off and power on your Raspberry and check your firewall to look for the last device connected to your Wireless Network, there you will be able to the the DNS name or IP address. 


5.- Download PuTTY and create a remote connection trough port 22 using SSH, raspbian default access is: pi/raspberry

4.- once you are logged in, you can change the administrator password using the following command:
sudo raspi-config

Source:
https://www.raspberrypi.org/documentation/configuration/wireless/headless.md



zip files

Problem:
You need to create a zip file for example to export a huge amount of files ina single export poroces trough ftp.

Solution:
Zip all files in a sinle one using the next commands:
zip -r filenamename DirectoryToZip
If you face problems like command not found, check if you have zip installed 
sudo apt-get install zip unzip

Default location of the index.html file

Problem:
You have installed a web server inside raspberry pi using Gnginx ( oficial documentation ) and after the setup you can see the default html page and you would like to change it with your own but you don't kwno the location of the file:

Solution:
The Default location of the index.html file is in the next path:
/var/www/html/index.nginx-debian.html

How to create scripting

Problem:
You would like to create and script file to process one or more commands.

Solution:
1.- create a new file:
nano my_script.sh

2.- inside the file add your commands, I create a shorcut to Motion configuration from my current directory
nano /etc/motion//motion.conf

3.- run the script to test it:
sh my_script.sh



motion.log permission denied

Problem:
You try to setup Motion with the option to write the application log into motio-log file, you can do this edition the motion.config file and you can select the path to the file log.
That happens on the standard configuration also if you try to setup motion as a service.
Beside this, you get the error message "motion.log permission denied"

Solution:
The problem is all due to files and folders permissions, if you run motion as a service the system will run motion as a root user, not pi user.
Change files and system folders using chmod

Setup a light web server with NGINX

Problem:

You care running a Raspberry pi zero and you need a fast way to acess your files/pictures or cam.

Why not to crate a light web serve to do it ?

Solution:


1.- Ensure that your system is up.todate.

sudo apt-get update
sudo apt-get upgrade
2.- Install Ngix
sudo apt-get install nginx
3.- start the webserver
sudo systemctl start nginx
4.- Check your hostname or IP to access to the web server:
hostname -i   "show you ip address
hostname  "show your host name
just open it using http://<hostname> or http://<ipaddress>
5.- change Nginx configuration, path, port, etc...
sudo nano /etc/nginx/nginx.conf
6.- start the web server once the system boot edition rc.local.
sudo nano /etc/rc.local
add the next line to the file and save it:  
 sudo systemctl start nginx
Faq's:
What is the defult www folder after nginx installation ?
-> you can find it in /var/www/html/

Source: