14.4  Configuring a RPi raspbian micro SD card.

A complete working micro SD card image is available for download.

The following pages describe how the card is set up.

We use terminal on the RPi.

nano is a text editor.   sudo nano gives the necessary root access

Initial   - with monitor, mouse and keyboard

Download the latest Raspberry Pi operating system with desktop and software from:

(I do not use Noobs. It has unwanted operating systems in the image and more importantly,

the image cannot be resized with parted.)

Download and install Raspberry Pi Imager  from:


Probably unnecessary... but:

Use windows  - control panel  -   administrative tools -- computer management
        - storage   - disk management to delete all partitions from the card

(care! to not delete the wrong card /disk!  ... I have done it!!)

Install raspbian OS on the card using Raspberry Pi Imager.

Insert the card in the RPi and power up

If your mouse is riduculously slow in response, the in RPi terminal do:

sudo nano /boot/cmdline.txt

Carefully add at the end (after a space)  usbhid.mousepoll=0

Then save (Ctrl-X   Y   Enter)

Use start (bottom left)   Preferences  - Raspberry Pi configuration - interfaces tab

Enable SSH, VNC, Serial port, remote GPIO

Configure keyboard and locale setting for you country.

Real VNC - will allow us PC control by Real VNC Viewer  (free download for personal use)

The following may be needed to display the desktop a PC with Real VNC Viewer after you have
disconnected the monitor from the RPi

(You may have already selected a display resolution - but you need to do it here!)            

sudo raspi-config

Select the advanced option and then the screen resolution option.

If control by VNC is rejected then you will need the following change:

sudo nano /boot/config.txt

uncomment the line:   hdmi_force_hotplug=1  

(This will make the RPi generate HDMI output for VNC access
 even if started with no HDMI monitor connected.)

Now check /etc/hosts

sudo nano /etc/hosts

make sure this line has changed to your host name  piWebCAT     or whatever you chose


Now change to fixed ip address:   I will use

Make sure dhcpcd is running:

sudo service dhcpcd start

sudo systemctl enable dhcpcd

sudo nano /etc/dhcpcd.conf

.... nano editor opens

.. assuming your router is

...  is a Google DNS   .. for good measure !

Uncomment and modify this bit for wired networking.

interface eth0

static ip_address=

static routers=

static domain_name_servers=

Add the following for WIFI - you can use the same IP address

The RPi will use wireless if eth0 is not connected

interface wlan0

static ip_address=

static routers=

static domain_name_servers=

NB: you may choose to use a different IP address for wifi access.


You may wish to continue with keyboard, mouse and  monitor.

I disconnect them.

I install Real VNC viewer on the PC.  (Free for private use but not for commercial use)

I display the RPi desktop on the PC

-- search    user pi     password feline     (save it)

Apache web server, php

sudo apt-get update

sudo apt-get install apache2 -y

sudo apt-get install php libapache2-mod-php -y

Check with web browser

Should show default apache2 demo index file


Pure-FTPd   used  by Expression4 web developer   and by FileZilla FTP client

The following is mainly from Raspberry pi.org

Their example sets a home directory of / home/pi/FTP

We need a home directory of /var/www/html  ... the apache webserver root

sudo apt-get install pure-ftpd

sudo groupadd ftpgroup

sudo useradd ftpuser -g ftpgroup -s /sbin/nologin -d /dev/null

sudo chown -R ftpuser:ftpgroup /var/www/html

user name is upload  (or your choice)

sudo pure-pw useradd upload -u ftpuser -g ftpgroup -d /var/www/html -m

Enter and confirm the password.     I use:  feline

sudo pure-pw mkdb

sudo ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/60puredb

sudo service pure-ftpd restart

Now use FileZilla to check access:

  using: host =   user = upload    password = feline  port = 21

.. this should access /var/www/html  - the website root which at this
    point contains index.html  (from the apache2 web server install)

Finally add another user to access the /home/pi folder

user name is piuser  (or your choice)

sudo pure-pw useradd piuser -u ftpuser -g ftpgroup -d /home/pi -m

Enter and confirm the password.     I use:  feline

sudo service pure-ftpd restart

You now have two users,

  • upload        accesses    /var/www/html   - the website root
  • piuser        accesses /home/pi   -   Downloads folder for Hamlib build etc

Finally - the upload process needs permission to access /home/pi and subfolders and files

sudo chmod 777 -R /home/pi    

MariaDB  (MYSQL) database

sudo apt-get install mariadb-server php-mysql -y

sudo apt-get install phpmyadmin

   - choose apache2 when asked which webserver     reply NO to database question

sudo mysql -u root -p

    - password will be requested     feline

Your are now in MYSQL with a MYSQL prompt thus;  

MariaDB [(none)]>   you will now enter SQL statements  ... all have terminating semicolon.


USE radios;

CREATE USER ‘piwebcat’@’localhost’ IDENTIFIED BY 'feline’;

GRANT ALL PRIVILEGES ON radios.* TO 'piwebcat'@'localhost' IDENTIFIED BY 'feline’;

CREATE USER ‘piwebcat’@’%’ IDENTIFIED BY 'feline’;

GRANT ALL PRIVILEGES ON radios.* TO 'piwebcat'@'%' IDENTIFIED BY 'feline’;


quit MYSQL

Edit /etc/mysql/my.cnf

sudo nano /etc/mysql/my.cnf

make sure     bind-address= is commented out

add:  bind-address=0,0,0,0

(To allow external access by MySQL Front etc)


 sudo service mysql restart


Edit /boot/cmdline.txt

sudo nano /boot/cmdline.txt

File content something like

console=serial0,115200 console=tty1 root=PARTUUID=75582189-02
 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash

remove the section:     console=serial0,115200 and save

Edit boot/config.txt

sudo nano /boot/config.txt

comment out:



add under [all]




For reasons not understood, the serial ports looses access permissions

This is fixed by resetting them at start up

Edit .bashrc

    sudo nano /home/pi/.bashrc

 Then go to end of this script and add:

    echo Running at end of script

    sudo chmod 666 /dev/ttyAMA0

    sudo chmod 666 /dev/ttyUSB0

    sudo chmod 666 /dev/ttyUSB1

The same can be achieved by creating file:



ACTION=="add", KERNEL=="dialout", MODE="0666"

ACTION=="add", KERNEL=="ttyAMA0", MODE="0666"

ACTION=="add", KERNEL=="ttyUSB0", MODE="0666"

ACTION=="add", KERNEL=="ttyUSB1", Mode="0666"

I do both !

sudo reboot



We have already installed phpmyadmin

To activate it and link to website root: /var/www/html

sudo ln -s /usr/share/phpmyadmin /var/www/html

sudo reboot

This installs a phpmyadmin file in the web site root

We can then access phpmyadmin from a browser  by:

user name is piwebcat   password is feline

I have used MySQL Front for most of the development as it is PC based and perhaps
quicker and easier to use that phpmyadmin.  (PC only)
Recently I have used HeidiSQl which is an excellent alternative ( PC based)

Download and install MYSQL Front


Test connection using: host =  port = 3306  user piwebcat = pw = feline

- you should see the radios database

R mouse on it click  -   import  - select my supplied radios.sql   -  Run

- whole database should quickly import

Use FileZilla to upload the website to /var/www/html

(The FTP server, pure-ftpd is already configured with /var/www/html as upload root.

host =  port = 21   user = upload   password = feline