Skip navigation

Category Archives: Ubuntu

Monthly bandwidth monitoring utility:
vnstat + PHP frontend
http://humdi.net/vnstat/
http://www.sqweek.com/sqweek/index.php?p=1

The commands in this HOWTO must be entered in the terminal:
Applications -> Accessories -> Terminal

Install vnstat:
sudo apt-get install vnstat

Start and test vnstat:
Note which interfaces are active on your PC.
vnstat -u -i eth0
vnstat -u -i eth1

Now you can generate text reports of your monthly bandwidth usage. I use eth1 in the following examples, but you may be using eth0 or both eth0 and eth1.

Daily bandwidth report.
vnstat -i eth1 -d

Hourly bandwidth report.
vnstat -i eth1 -h

Monthly bandwidth report.
vnstat -i eth1 -m

Real time speed report.
vnstat -i eth1 -l

Install ubuntu-tweak:
http://ubuntu-tweak.com/downloads

sudo gedit /etc/apt/sources.list

Add the following line to the end of the file (if the line doesn’t already exist).
deb http://ppa.launchpad.net/tualatrix/ubuntu intrepid main

Then update and install.
sudo apt-get update
sudo apt-get install ubuntu-tweak

Create a startup script for vnstat:
(eth0 is the device name for my wired connection and eth1 is the name for my wireless connection. Create a separate entry for each internet interface that you will be monitoring.)

Applications -> System Tools -> Ubuntu Tweak -> Startup -> Autostart -> Add
Name: vnstat eth1
Command: vnstat -u -i eth1
Comment: [blank]

If you find the above reports useful, then you are done. If you would like to generate pretty reports that you can bookmark in your browser, then continue further.

Install and start XAMPP or LAMP:
https://humanlanguage.wordpress.com/2006/12/03/install-xampp-on-ubuntu/
https://humanlanguage.wordpress.com/2006/12/03/install-lamp-on-ubuntu/

Download vnstat PHP frontend to your desktop and install:
cd ~/Desktop
wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.4.1.tar.gz
tar xvfz vnstat_php_frontend*.tar.gz -C ~/public_html
cd ~/public_html/vnstat_php_frontend*
mv vnstat_php_frontend* vnstat_php_frontend
gedit config.php

Change lines 32, 39-41, 56:
$iface_list = array('eth0', 'eth1', 'sixxs');
...
$iface_title['eth0'] = 'Internal';
$iface_title['eth1'] = 'Internet';
$iface_title['sixxs'] = 'SixXS IPv6';
...
$vnstat_bin = '';

to:
$iface_list = array('eth1');
...
// $iface_title['eth0'] = 'Internal';
$iface_title['eth1'] = 'Internet';
// $iface_title['sixxs'] = 'SixXS IPv6';
...
$vnstat_bin = '/usr/bin/vnstat';

or something similar depending on which internet interfaces you are using.
(See Start and test vnstat above.)
Save and close the file.

Open vnstat PHP frontend:
http://localhost/username/vnstat_php_frontend

Updated:
11 January 2009

How to install LAMP on Ubuntu:
Linux + Apache2 + MySQL + PHP5

Terminal:
The following commands must be entered in the terminal.
Applications -> Accessories -> Terminal

Choose one of the following setups:

Apache2 + PHP4 + MySQL4
sudo apt-get install apache2 php4 mysql-client mysql-server phpmyadmin php4-mysql

Apache2 + PHP5 + MySQL4
sudo apt-get install apache2 php5 mysql-client mysql-server phpmyadmin php5-mysql

Apache2 + PHP5 + MySQL5
sudo apt-get install apache2 php5 mysql-client-5.0 mysql-server-5.0 phpmyadmin php5-mysql

Installation options:
You will be asked to choose a password for MySQL.
Ubuntu will not allow you to enter a blank password.
You will be asked to choose a web server for phpMyAdmin. Choose apache2.

Start Apache/MySQL:
sudo /etc/init.d/apache2 start
sudo /etc/init.d/mysql start

Restart Apache/MySQL (if necessary):
sudo /etc/init.d/apache2 restart
sudo /etc/init.d/mysql restart

Stop Apache/MySQL (if necessary):
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/mysql stop

Apache2 and MySQL will not start if XAMPP is also running. If you have both, you must stop one before starting the other:
cd /opt/lampp
sudo ./lampp stop

Publish:
LAMP uses /var/www as the root web directory, but you can publish pages in your home directory this way.
cd ~
mkdir public_html
sudo ln -s ~/public_html /var/www/$USER

Now any files and folders you place in ~/public_html will be
published to your personal webserver.

Open your new webpages at:
http://localhost/username/

Open phpmyadmin in your browser:
http://localhost/phpmyadmin/

Log into phpmyadmin with your MySQL password:
Name: root
Password: [Enter password chosen during installation.]

You can edit additional phpmyadmin options by setting an admin password:
sudo htpasswd /etc/phpmyadmin/htpasswd.setup admin

You’ll be asked for your current user password. Then you’ll be asked to enter and re-enter an admin password.

After you have an admin password, you can access phpmyadmin setup here:
http://localhost/phpmyadmin/setup/

If you want to install the latest version of LAMP with XAMPP:
https://humanlanguage.wordpress.com/install-xampp-on-ubuntu/

Install LAMP with one command:
http://www.whiteoctober.co.uk/blog/2008/10/14/ubuntu-howto-install-lamp-with-one-command/

Install PHP4 and PHP5:
http://www.ubuntugeek.com/apache2-web-server-installation-with-php4-and-php5-support-in-ubuntu.html

Install MySQL4 and MySQL5:
http://www.howtoforge.com/running-mysql4-and-mysql5-concurrently

sudo htpasswd /etc/phpmyadmin/htpasswd.setup admin

Updated:
10 January 2009

How to obtain the latest version of LAMP on Ubuntu:
(Apache 2.2 + MySQL 5.1 + PHP 5.2 + PERL 5.10 +PEAR + SQLite + ProFTPD + phpMyAdmin + Webalizer + phpSQLiteAdmin + XAMPP Control Panel)
http://www.ubuntuforums.org/223410
http://www.apachefriends.org/f/viewtopic.php?t=21531#108517

The commands in this HOWTO must be entered in the terminal:
Applications -> Accessories -> Terminal

Download XAMPP to your desktop and extract the files:
http://apachefriends.org/xampp-linux
cd ~/Desktop
wget http://www.apachefriends.org/download.php?xampp-linux-1.7.1.tar.gz
sudo tar xvfz xampp-linux*.tar.gz -C /opt

Create a XAMPP start menu entry:
cd ~/.local/share/applications
gedit xampp-control-panel.desktop

Paste the following into the open file:
[Desktop Entry]
Comment=Start/Stop XAMPP
Name=XAMPP Control Panel
Exec=gksudo "python /opt/lampp/share/xampp-control-panel/xampp-control-panel.py"
Icon[en_CA]=/usr/share/icons/Tango/scalable/devices/network-wired.svg
Encoding=UTF-8
Terminal=false
Name[en_CA]=XAMPP Control Panel
Comment[en_CA]=Start/Stop XAMPP
Type=Application
Icon=/usr/share/icons/Tango/scalable/devices/network-wired.svg

[Desktop Entry]
Comment=Start/Stop XAMPP
Name=XAMPP Control Panel
Exec=gksudo /opt/lampp/share/xampp-control-panel/xampp-control-panel
Icon[en_CA]=/opt/lampp/htdocs/xampp/img/logo-small.gif
Encoding=UTF-8
Terminal=false
Name[en_CA]=XAMPP Control Panel
Comment[en_CA]=Start/Stop XAMPP
Type=Application
Icon=/opt/lampp/htdocs/xampp/img/logo-small.gif

Save and close the file.

Publish:
XAMPP uses /opt/lampp/htdocs as the root web directory, but you can publish pages in your home directory this way.
cd ~
mkdir public_html
sudo ln -s ~/public_html /opt/lampp/htdocs/$USER

Now any files and folders you place in ~/public_html will be
published to your personal webserver.

Start XAMPP via the terminal:
cd /opt/lampp
sudo ./lampp start

Stop XAMPP (if necessary):
cd /opt/lampp
sudo ./lampp stop

Via the XAMPP Control Panel:
Applications -> Other -> XAMPP Control Panel

If Apache2 or MySQL is already running, then XAMPP will not start. You must stop these applications, if you want to use XAMPP:
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/mysql stop

PHP5 is the default, but you can switch between PHP4 and PHP5, if you like:
cd /opt/lampp
sudo ./lampp php4
sudo ./lampp php5

Open your new webpages at:
http://localhost/username/

Security:
http://apachefriends.org/xampp-linux/381

1. The MySQL root user has a blank password.
2. MySQL is accessible via your local network.
3. ProFTPD has user “nobody” with password “lampp”.
4. PhpMyAdmin is accessible via the local network.
5. Examples are accessible via the local network.
6. MySQL and Apache running under the same user “nobody”.

To configure some of the security features of xampp:
cd /opt/lampp
sudo ./lampp security