Raspberry Pi‎ > ‎Raspbian Setup‎ > ‎


Utility Software 

    Useful Software for Kits and all Developer 

Geamy Editor

  • Very Good Programming Editor
  • sudo apt-get install geamy

Install xfce session

Xfce is a lightweight desktop environment for UNIX-like operating systems. It aims to be fast and low on system resources, while still being visually appealing and user friendly.

To install Xfce on debian 7 wheezy
# apt-get install xorg xfce4 xfce4-goodies thunar-archive-plugin synaptic gdebi wicd

To install extra XFCE packages
# apt-get install xdg-utils xfce4-power-manager xfce4-goodies htop bzip2 zip unzip unrar-free

To start xfce
Once the xfce installation is done, reboot your sytem, login with your username and password, then type
$ startx
$ startxfce4

To start xfce automatically when you login to tty1
edit .bashrc in your user directory
$ cd /home/yourusername
$ nano .bashrc

add these code to the end of the .bashrc file

if [ "$(tty)" = "/dev/tty1" -o "$(tty)" = "/dev/vc/1" ] ; then

Google Browser

  • sudo apt-get install chromium-browser
  • sudo apt-get install ttf-mscorefonts-installer

Chinese Font

  • 點陣宋體
  • >sudo apt-get install xfonts-wqy
  • 正黑體
  • >sudo apt-get install ttf-wqy-zenhei
  • 微米黑體
  • >sudo apt-get install ttf-wqy-microhei
  • >sudo apt-get install xfonts-wqy ttf-wqy-zenhei ttf-wqy-microhei

Capture Screen to PNG

  • https://github.com/AndrewFromMelbourne/raspi2png

Install LAMP


Set up a web server on your Pi and install WordPress


Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages.

On its own, Apache can serve HTML files over HTTP, and with additional modules can serve dynamic web pages using scripting languages such as PHP.


First install the apache2 package by typing the following command into the terminal:

sudo apt-get install apache2 -y


By default, Apache puts a test HTML file in the web folder. This default web page is served when you browse to http://localhost/ on the Pi itself, or (whatever the Pi's IP address is) from another computer on the network. To find out the Pi's IP address, type hostname -I at the command line (or read more about finding your IP address).

Browse to the default web page, either on the Pi or from another computer on the network, and you should see the following:

This means you have Apache working!


This default web page is just an HTML file on the filesystem; it is located at /var/www/index.html. Navigate to this directory in the terminal and have a look at what's inside:

cd /var/www
ls -al

This will show you:

total 12
drwxr-xr-x  2 root root 4096 Jan  8 01:29 .
drwxr-xr-x 12 root root 4096 Jan  8 01:28 ..
-rw-r--r--  1 root root  177 Jan  8 01:29 index.html

This shows that there is one file in /var/www/ called index.html. The . refers to the directory itself/var/www/, and the .. refers to the parent directory /var/.


  1. The permissions of the file or directory
  2. The number of files in the directory (or 1 if it's a file)
  3. The user who owns the file or directory
  4. The group which owns the file or directory
  5. The file size
  6. The last modification date and time

As you can see, by default the www directory and index.html file are both owned by the root user. In order to edit the file, you must gain root permissions. Either change the owner to your own user before editing (using sudo chown pi: index.html), or edit with sudo (using sudo nano index.html).

Try editing this file and refreshing the browser to see the web page change.


PHP is a preprocessor; it's code that runs when the server receives a request for a web page. It runs, works out what needs to be shown on the page, then sends that page to the browser. Unlike static HTML, PHP can show different content under different circumstances. Other languages are capable of this, but since WordPress is written in PHP, that's what we need to use this time. PHP is a very popular language on the web; large projects like Facebook and Wikipedia are written in PHP.

Install the PHP and Apache packages with the following command:

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


Now move the index.html file to index.php:

sudo mv index.html index.php

Edit the file:

sudo nano index.php

Put some PHP content in it:

<?php echo "hello world";

Now save and refresh your browser. You should see "hello world". This is not dynamic but it is still served by PHP. Try something dynamic, for example:

<?php echo date('Y-m-d H:i:s');

Or show your PHP info:

<?php phpinfo();


MySQL (pronounced My Sequel or My S-Q-L) is a popular database engine. Like PHP, its overwhelming presence on web servers enhanced its popularity. This is why projects like WordPress use it, and why those projects are so popular.

Install the MySQL Server and PHP-MySQL packages by entering the following command into the terminal:

sudo apt-get install mysql-server php5-mysql -y

When installing MySQL you will be asked for a root password. You'll need to remember this to allow your website to access the database.


You can download WordPress from wordpress.org using the wget command. Helpfully, a copy of the latest version of WordPress is always available at wordpress.org/latest.tar.gz and wordpress.org/latest.zip, so you can grab the latest version without having to look it up on the website. At the time of writing, this is version 3.8.1.

Navigate to /var/www/, and download WordPress to this location. You'll need to empty the folder first (be sure to check you're not deleting files you need before running rm); change the ownership of this folder to the pi user too.

cd /var/www
chown pi: .
rm *
wget http://wordpress.org/latest.tar.gz

Now extract the tarball, move the contents of the folder it extracted (wordpress) to the current directory and remove the (now empty) folder and the tarball to tidy up:

tar xzf latest.tar.gz
mv wordpress/* .
rm -rf wordpress latest.tar.gz

Running the ls or (tree -L 1) command here will show you the contents of a WordPress project:

├── index.php
├── license.txt
├── readme.html
├── wp-activate.php
├── wp-admin
├── wp-blog-header.php
├── wp-comments-post.php
├── wp-config-sample.php
├── wp-content
├── wp-cron.php
├── wp-includes
├── wp-links-opml.php
├── wp-load.php
├── wp-login.php
├── wp-mail.php
├── wp-settings.php
├── wp-signup.php
├── wp-trackback.php
└── xmlrpc.php

This is the source of a default WordPress installation. The files you edit to customise your installation belong in the wp-content folder.


To get your WordPress site set up, you need a database. Run the mysql command in the terminal and provide your login credentials (e.g. username root, password password):

mysql -uroot -ppassword

Here I have provided my password (the word password) on the command line; there is no space between -pand your password.

Alternatively you can simply supply an empty -p flag and wait to be asked for a password:

mysql -uroot -p

Now you will be prompted to enter the root user password you created earlier.

Once you're connected to MySQL, you can create the database your WordPress installation will use:

mysql> create database wordpress;

Note the semi-colon ending the statement. On success you should see the following message:

Query OK, 1 row affected (0.00 sec)

Exit out of the MySQL prompt with Ctrl + D.


You need to find out your Pi's IP address to access it in the browser, so in a terminal type the commandhostname -I.

Navigate to http://YOUR-IP-ADDRESS e.g. in the web browser on your Pi.

You should see a WordPress error page; this is good! Click the big button marked Create a Configuration File followed by the Let's go! button on the next page.

Now fill out the basic site information as follows:

Database Name:      wordpress
User Name:          root
Password:           <YOUR PASSWORD>
Database Host:      localhost
Table Prefix:       wp_

Upon successful database connection, you will be given the contents of your wp-config.php file:

Copy this text, return to the terminal on the Pi and edit the file with nano wp-config.php. Paste the text into this file, and save and exit with Ctrl + X, then Y for yes and Enter.

Now hit the Run the install button.


Now you're getting close.

Fill out the information: give your site a title, create a username and password, put in your email address and untick the search engines box. Hit the Install WordPress button, then log in using the account you just created.

Now you're logged in and have your site set up, you can see the website by visiting your IP address in the browser on the Pi or another computer on the network. To log in again (or on another computer), go tohttp://YOUR-IP-ADDRESS/wp-admin.


It's recommended that you change your permalink settings to make your URLs more friendly. To do this, log in to WordPress and go to the dashboard. Go to Settings then Permalinks. Select the Post name option and click Save Changes. After saving, you will be prompted to update your .htaccess file. You probably don't have one yet, so add one in /var/www/ by typing nano .htaccess; note this is a hidden file, so it starts with a dot. Then paste in the contents provided:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Save the file and return to the website homepage. Click on the post title or the sample page link and you'll probably see a Not Found error page. This is because the rewrite module has not been enabled in Apache. To do this, enter sudo a2enmod rewrite.

You'll also need to tell the virtual host serving the site to allow requests to be overwritten. Do this by editing the virtual host file (with root permissions): sudo nano /etc/apache2/sites-available/default; also, change theAllowOverride setting on line 11 (inside the <Directory /var/www/> block) from None to All. Save the file and then restart Apache with sudo service apache2 restart. Once it's restarted, refresh the page and it should load successfully. Now posts have URLs like /hello-world/ instead of /?p=123, and pages have URLs like/sample-page/ instead of /?page_id=2.

Install FTP

  1. 1
    We will now install FTP to allow transferring files to and from your Raspberry Pi.
  2. 2
    Take ownership of the web root:
    sudo chown -R pi /var/www
  3. 3
    Next, install vsftpd:
    sudo apt-get install vsftpd
  4. 4
    Edit your vsftpd.conf file:
    sudo nano /etc/vsftpd.conf
  5. 5
    Make the following changes:
    • anonymous_enable=YES to anonymous_enable=NO
    • Uncomment local_enable=YES and write_enable=YES
    • then go to the bottom of the file and add force_dot_files=YES.
  6. 6
    Now save and exit the file by pressing CTRL-O, CTRL-X.
  7. 7
    Now restart vsftpd:
    sudo service vsftpd restart
  8. 8
    Create a shortcut from the Pi user's home folder to /var/www:
    ln -s /var/www/ ~/www
  9. 9
    You can now FTP using the Pi user and access the /var/www folder via a shortcut that should appear on login.

Tutorial – Install PhpMyAdmin on your Raspberry Pi

PhpMyAdmin is a handy web interface for managing local MySQL databases, and can make database queries, management and backups easy.

In this tutorial, I’m going to talk you through installing PhpMyAdmin on your Raspberry Pi powered web server. I’m assuming you’ve got Raspbian installed, and you’ve followed my tutorial: install Apache, PHP and MySQL on Raspberry Pi.

Step 1 – Begin the PhpMyAdmin installation

From terminal, we begin by changing to the root user in terminal by entering:

sudo bash

Now we need to install the PhpMyAdmin package using:

apt-get install phpmyadmin

The package will begin installing. You will be asked which web server is installed, chooseapache2.

My screenshots show purple, but you’ll see blue. I’ve already got PhpMyAdmin installed on my Raspberry Pi so had to install it on a ubuntu VM for the purpose of this tutorial – apologies for the wrong colours, but I can assure you the procedure is the same for Debian/Raspbian and Ubuntu!

Step 2 – configure for dbconfig-common

Next we’ll need to configure PhpMyAdmin’s database. You’ll see the following prompt:

When prompted, choose Yes. Next you’ll be asked for an administrative password, this is the root password that was set during the MySQL installation in the previous tutorial.

You’ll be asked to set a password for PhpMySQL. I’ve used the same password as the MySQL root password, but its up to you what you set here. Make a note of it somewhere.

That’s PhpMyAdmin installed. Next we need to change the apache configuration to allow us to use http://your.raspberrypi.domain/phpmyadmin to access it.

Step 3 – Configure Apache to work with PhpMyAdmin

We need to alter the Apache configuration in order to access PhpMyAdmin. To do this, enter the following command to alter the configuration:

nano /etc/apache2/apache2.conf

The configuration file will load in Nano. Navigate to the bottom of the file (keep pressing CTRL + V to jump page by page until you’re at the bottom of the file) and add the following new line to the file:

Include /etc/phpmyadmin/apache.conf

Save the file (CTRL + X and enter Y when prompted to save) and restart Apache2. To restart Apache, enter the following command:

/etc/init.d/apache2 restart

That’s it! You’re all installed and ready to go. Give accessing it a try by going to your Raspberry Pi’s IP address or domain name and add ‘/phpmyadmin’ to the end in your web browser, ie http://your.raspberrypi.domain/phpmyadmin. 

As always your comments are welcome, feel free to leave one below. My next tutorial will guide you through installing WordPress through terminal, and hosting your first WordPress site on your Raspberry Pi web server.

Install and run Raspbian from a USB Flash Drive

In this tutorial, I’m going to talk you through running Raspbian from a USB connected drive instead of from an SD card. Running from a USB connected Flash or Hard Drive has many advantages, the biggest being speed and reliability.

SD Cards have a limited read/write cycle, and when hosting a site with a MySQL database from a SD card, it won’t take long before you start getting corruptions and failures. USB Flash drives provide a cheap and reliable alternative. I’ve tested several USB Flash drives, and found Sandisk and Corsair to be the best for speed and reliability. This site is run off a 16GB Corsair Voyager 3 USB Flash drive.

Assumptions before we begin

I’m going to assume that you know your way around Terminal, and are using a Mac to perform these steps. You will still need an SD card to store the boot instructions to tell the Raspberry Pi to launch the OS from the USB; the Raspberry Pi’s can’t (yet) boot directly from a USB storage device.

Step 1 – Download Raspbian from Raspberry Pi

You will need the standard Raspbian OS image, you can download this from the officialRaspberry Pi website. Once you’ve downloaded it, unzip it. It’s around 400mb in size, so should only take a couple of minutes over a broadband connection.

Step 2 – Install the Raspbian OS to your USB Flash drive

Plug in your USB stick and launch Terminal. The first thing we’re going to do is get the device identifier for your USB Flash drive. To do this run the following command:

diskutil list

The list of attached disks will show up with their identifiers. Important – make a note of the correct identifier, you can do some serious damage by choosing the wrong one!

In the screen shot above, I can see that /dev/disk2 is the correct identifier for my Sandisk USB Flash Drive. Yours may be different so change to suit your configuration. Next we’re going to unmount the USB Flash Drive. To do this enter the following command:

diskutil unmountDisk /dev/disk2

Yet again, be really careful to change disk2 to whatever your computer identifies the USB Flash Drive as. You will get a message saying

“Unmount of all volumes on disk2 was successful”.

Now we can begin the copy. For ease, I’ve changed the directory in Terminal to where the Raspbian image is located, which in this case is my downloads folder. If you’ve downloaded and unzipped the disk image to your downloads folder, running this command should take you there:

cd ~/Downloads/

Now run this command to begin the copy:

sudo dd bs=1m if=2013-02-09-wheezy-raspbian.img of=/dev/disk2

As with before, make sure you change disk2 to whatever your computer identifies as being the USB Flash Drive, and change 2013-02-09-wheezy-raspbian.img to whatever your image file is called. The blocks will now begin moving to your USB Flash Drive from the Raspbian OS image. This takes anything from 5 to 20 mins depending on the speed of your USB Flash Drive. Go stick the kettle on and have a brew!

Eventually, you will see something similar to the above, and it probably took a while too. The next step is to configure your SD Card to give the correct boot instruction to start the OS from the USB Flash Drive

Step 3 – Configure your SD card

Using Disk Utility, format your SD Card using FAT32. It’s dead easy, choose your SD Card from the devices listed on the right, then click on ‘Erase’, choose FAT32 in the Formats list and click on ‘Erase’.

Once you’ve done this, you’ll notice on your Desktop, there are two mounted volumes; one is your USB Flash Drive, the other is your SD Card.

Open up the USB Flash Drive volume and copy all the files from that onto your SD card. This copies the all-important files and instructions to tell your Raspberry Pi to boot from the USB Flash Drive. We’re almost done at this point, only one more step to go.

Step 4 – Change the boot path on your SD card

Once you’ve completed step 3, you need to change the default boot path to tell the Raspberry Pi to boot from your USB drive. Open a new Finder window and go to your SD card. Open up the file called cmdline.txt in TextEdit or similar and amend the line which reads:


To this:


This will instruct your Raspberry Pi to boot from the USB Flash Drive instead of from the SD card. Save the cmdline.txt file and close the Finder window. We’re almost done!

Step 4 – Boot from your USB Flash Drive on your Raspberry Pi

Now unmount both your USB Flash Drive and your SD card and pop them both into your Raspberry Pi and switch it on. If all goes well, it should boot from your USB Flash Drive which you’ll find substantially quicker than your SD Card.

Step 5 – Expand the Raspbian partition on your USB Flash drive to fill it

Finally, we’re just going to do a little housekeeping to utilise all the available space on your USB Flash drive as the method using raspi-config doesn’t work on USB Flash drives. This isn’t essential, but if you have the extra space on a USB Flash Drive, why not use it all?

From your Raspberry Pi, type the following command to start FDisk:

sudo fdisk /dev/sda

Then press p and enter to see the partitions. There should only be 2. What we’re going to do now is delete the Linux partition, but before we do this, we make a note of the start position for the linux partition sda2. Press d and then when prompted type 2 and then hit enter. This will delete the partition.

Now we’re going to create a new partition, and make it large enough for the OS to occupy the full space available on the USB Flash Drive. To do this type n to create a new partition, when prompted to give the partition type, press p for primary. Then it will as for a partition number, press 2 and hit enter.

You will be asked for a first sector, set this as the start of partition 2 as noted earlier. In my case this as 12280 but this is likely to be different for you.

After this it will ask for an end position, hit enter to use the default which is end of disk. Now type w to commit the changes. You will see a message about the Kernel using some table yaddah yaddah, just ignore this. Type the following to reboot:

sudo reboot

Once your Raspberry Pi has rebooted, we need to resize the partition. To do this type the following command:

sudo resize2fs /dev/sda2

Be patient, this will take some time. Once it’s done reboot again. Then type:

df -h

This will show the partitions and the space, you’ll see the full USB Flash Disk has all the space available now. That’s it, all done!

Install WebMin

sudo wget http://prdownloads.sourceforge.net/webadmin/webmin-1.670.tar.gz
sudo gunzip webmin-1.670.tar.gz
sudo tar xf webmin-1.670.tar
sudo mkdir webmin /var/www/
cd webmin-1.670
/webmin-1.670 $ sudo sh setup.sh /var/www/webmin

Access webmin – http://your-lan-ip:10000/