Raspberry Pi Operating System Install and Support

Basic OS Download and Install

I’ll need a Raspian system running for my tvguide project.  Here is what I did:

1) Went here and downloaded the full version - https://www.raspberrypi.org/downloads/raspbian/
2) Used Etcher (free program) to write the image file to a 32G mini san disk on my Windows 10 box
3) Put the san disk card into the Pi 3B, attached HDMI, keyboard, mouse, and ethernet cable – and then powered it up.  The Pi immediately went through it’s automatic disk resizing and reboot soon came up with the Raspian desktop.

Initial Configuration and Updates

1) I went through the automatic “Welcome” wizard and made these settings

a) Set Country to United States, Language to American English, Timezone to Los Angeles, and also set the Use English Language and Use US keyboard options – whatever they might do I don’t know.
b) Set the root password when asked
c) Set the screen to resize better to my temp monitor
d) Chose wifi target and specified password
e) Pushed “next” to update the software.  This takes a long time.

Note that our IP address was already set by DHCP from my router.  In fact, the box has 2 IP addresses – one for wifi and one for ethernet.  I will disconnect ethernet after doing the upgrade/update process.

2) Issued some commands to make sure we have the latest software.  I’m not sure this is necessary, but it probably couldn’t hurt.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get update

sudo reboot

Now we should have the latest updates.

3) Click the Raspberry icon, then Preferences, then Rasberry Pi Configuration, then Interfaces, and enable SSH.  If we’re lucky, this will be the last time we need the HDMI/Mouse/Keyboard/Ethernet cables.  We’ll just work from now on via SSH from my Windows box.  Let’s also make a new userid for this project, and avoid using the pi userid:

sudo useradd -u 5000 tvguide -d /home/tvguide
sudo mkdir /home/tvguide
sudo chown tvguide:tvguide /home/tvguide
sudo passwd tvguide

I also modified /etc/sudoers so the new id can issue any command under sudo, since I probably won’t be logging on as pi much anymore.

sudo visudo
tvguide ALL=(ALL) NOPASSWD:ALL

Install Required LAMP (and other) System Software

Since the plan for this card is to be a standalone web server that can serve up a tv guide listing, I’ll need the various LAMP and other software installed and configured.  These are:

Apache (web server)
PHP (processing)
MySQL or Maria (database)
phpmyadmin (database administration)
Samba (allow me to work using directories mounted on Windows 10)

Install Apache and PHP

sudo apt install apache2 -y
sudo apt install php php-mbstring -y

Edit php Settings for Apache

sudo vi /etc/php/7.3/apache2/php.ini
short_open_tag = On
memory_limit = 1280M
post_max_size = 100M
upload_max_filesize = 100M
date.timezone = America/Los_Angeles

Edit php Settings for the Command Line

sudo vi /etc/php/7.3/cli/php.ini
short_open_tag = On

Set Ownership of html Directory

sudo chown -R pi:www-data /var/www/html/
sudo chmod -R 770 /var/www/html/

At this point we should be able to test apache/php by putting a php file in /var/www/html that contains a call to phpinfo() and see if that displays on our web browser.  We should also test a CLI command run of php.  Solve any issues.

Install and Configure Maria DB

sudo apt install mariadb-server php-mysql -y

Setup root password and access with these commands.  I got these from a web page, and I think there are better (safer) methods.  But these worked ok.

sudo mysql --user=root
DROP USER 'root'@'localhost';
CREATE USER 'root'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
exit

Install phpmyadmin Web DB Administration

sudo apt install phpmyadmin -y
sudo phpenmod mysqli
sudo /etc/init.d/apache2 restart
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

Now you should be able to test phpadmin and mysql at the same time by pointing a web browser to /phpmyadmin and using the root password you just setup.

The admin program works well, but produces a lot of warning/error message.  Google says this is something with the apt-get version – ok.  I will use the following to ignore the errors:

sudo vi /etc/phpmyadmin/config.inc.php
$cfg['SendErrorReports'] = 'never';

Install and Configure Samba

I like working from my Windows box with attached file systems, so…

sudo apt-get install samba samba-common-bin -y

sudo smbpasswd -a tvguide
sudo pdbedit -L -v 

sudo vi /etc/samba/smb.conf
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
security = user
passdb backend = tdbsam
[homes]
  comment = Home Directories
  browseable = no
  writable = yes

[tvguide]
 comment = TVGUIDE Directory
 path = /home/tvguide
 public = yes
 writable = yes
 printable = no
 force user = tvguide
 force group = tvguide

[html]
 comment = HTML Directory
 path = /var/www/html
 public = yes
 writable = yes
 printable = no
 force user = www-data
 force group = www-data

sudo service smbd restart

Then test by mounting those 2 file systems as windows disk letters.  Solve any issues.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>