Login /Register



TeensyNet™ Web Front End
The Hard Way – Linux OS

If you want to set up your TeensyNet™ Web Front End on something other than a Raspberry Pi, this page can give you general guidelines on how to do it in a Linux Operating System (OS).

You will install the following packages:

  • Apache2 Web Server
  • MySQL Database Server
  • PHP5 Language
  • Avahi
  • logrotate
  • phpMyAdmin
  • WebMin
  • TeensyNet™ PHP and MySQL files

Other packages may be optionally installed, depending on their availablity for your Operating System (OS).

This series of instructions will use a Debian 7 Linux installation as its base, and will use the APT series of package software to retrieve and install needed software. You will need root or sudo access to complete this process. Most of the installation will be done using a Command Line Interface (CLI) in a terminal window. If you are using a different flavor of Linux (ie, Fedora) use the package installer for your particular Linux to install the packages.

Linux and MySQL command line commands are shown in BLUE, File entries are shown in GREEN.

Getting Started

Open a local terminal for access to a command line. We will be using the “sudo” command to allow root access, so make sure that you have that capability. If sudo is not available enable root access using “su -“.

Make sure that your system has all of the latest updates and patches:

sudo apt-get update
sudo apt-get upgrade

Install Apache2

From the command line, install Apache2:

sudo apt-get install apache2

Install MySQL

From the command line, install MySQL:

sudo apt-get install mysql-server

During installation, you should be asked to provide a root password in order to access MySQL. Use the password “teensynet” to allow later access by root. When asked for confirmation, be sure to enter “teensynet” again.

Install PHP5

From the command line, install PHP5:

sudo apt-get install php5 php5-mysql php-pear libapache2-mod-php5

During installation, the installation program will ask for the root password for MySQL. Use “teensynet” again as the password. If the installation program asks which web server you’re using, make sure you answer “Apache2”.

Install Avahi

From the command line install Avahi:

sudo apt-get install avahi-daemon avahi-utils

Install logrotate

If not already present on your system, it is highly recommended. I store a LOT of information in the teensynet logfiles, and if left unattended, can take up a lot of space.

sudo apt-get install logrotate

Install phpMyAdmin

phpMyAdmin is a very stable, long term web-based project that makes administering MySQL a snap:

sudo apt-get install phpmyadmin

Install Webmin

Webmin is a web application that can give you a great deal of control over your entire system. The Webmin Debian Page provides several ways to install the package.

Create a teensynet user

Open Webmin on your computer, then go to “System->Users and Groups” and click on “Create a new user” link, located down near the bottom left of the page.
Once the page opens, enter the following:

  • “teensynet” in the Username
  • “TeensyNet” in the Real Name
  • “\bin\bash” in the Shell selector
  • Select the “Normal Password” radio button and enter “teensynet” in the password black to its right
  • Under “Group Membership” enter “teensynet” as the Primary group and add “dialout”, “sudo”, “users” and “www-data” to the Secondary group list

Click on the “Save” button at the bottom of the page.

Create a teensynet log directory

Back in your terminal window, create a “teensynet” directory in your “/var/log” directory, and make teensynet and www-data the owner.group, with all permissions granted to both:

sudo mkdir /var/log/teensynet
sudo chown -R teensynet.www-data /var/log/teensynet
sudo chmod -R g+w /var/log/teensynet

Setup Apache2

In your terminal window go to the current Apache2 Document Root directory. In the case of Debian 7, that location is /var/www/ . Your location may differ, depending on the flavor of Linux:

cd /var/www

Create two new directories, htdocs and images:

sudo mkdir /var/www/htdocs
sudo mkdir /var/www/images

In your terminal window, create a “Downloads” directory, if you don’t already have one. Next, create a “TeensyNet” directory and cd to it:

sudo mkdir /Downloads
sudo mkdir /Downloads/Teensynet
sudo cd /Downloads/TeensyNet

In your web browser, open my github page, and press the “Download Zip” button and save the file.

Unzip the file, and copy all of the “php”, “html” and “css” files to the “/var/www/htdocs/” directory:

sudo cp *.html /var/www/htdocs/
sudo cp *.php /var/www/htdocs/
sudo cp *.css /var/www/htdocs/

Now you should make the files accessible to teensynet and www-data:

sudo chown -R teensynet.www-data /var/www
sudo chmod -R g+w /var/www

Now we have to get Apache2 to point to the proper areas. First use a text editor to open “/etc/apache2/apache2.conf” Make sure you open the file as root or using “sudo” . In my case I use nano:

sudo nano /etc/apache2/apache2.conf

Go to the end of the files and add the following:

ServerName teensynet

Save and exit.

Now edit “/etc/apache2/sites-enabled/000-default”, also as root or “sudo”. It should look something like this:

<VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot /var/www/htdocs
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        Alias /images/ /var/www/images/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined

Save the file, and restart Apache2:

sudo service apache2 restart

Setup MySQL

Next we have to create a new database table and user, both named “teensynet”. Start by entering MySQL:

sudo mysql -u root -p

When prompted for a password enter “teensynet”. You should then see a “mysql>” prompt. Enter the following EXACTLY AS YOU SEE IT HERE (excluding the “mysql>” prompt), with an “ENTER” after each semicolon:

mysql> CREATE DATABASE teensynet;
mysql> GRANT ALL PRIVILEGES ON teensynet.* TO "teensynet"@"teensynet" IDENTIFIED BY "teensynet";
mysql> EXIT

After each of the first three entries it should say something like “Entry OK”, and the final entry should return you to the terminal prompt.

Now open phpMyadmin in a browser window, sign on as “root” with “teensynet” as the password. Select the “teensynet” database, it should show up as empty. Select the “IMPORT” tab from the top menu. Press the “Choose File” button, and select “/Downloads/TeensyNet/teensynet.sql”, and press the “GO” button. phpMyAdmin should import and setup the necessary tables in the database.

You now have the basic requirements for the TeensyNet™ Web Front End. Once you have your TeensyNet™ connected to your intranet, open your web browser to “http://localhost/” and the TeensyNet™ should appear.