Raspberry PI: Raspbian – LAMP Stack (Linux, Apache, MySAL, PHP)

Type: sudo apt-get install mysql-client mysql-server

Enter Password for MySQL
Retype Password for MySQL

Apache2, PHP5, phpMyAdmin, FCGI, suExec, Pear, and mcrypt can be installed as follows:

Type: sudo apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libruby libapache2-mod-ruby libapache2-mod-python php5-curl php5-intl php5-memcache php5-memcached php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl memcached

Web server to reconfigure automatically: <- apache2 Configure database for phpmyadmin with dbconfig-common? <- no Then run the following command to enable the Apache modules suexec, rewrite, ssl, actions, and include (plus dav, dav_fs, and auth_digest if you want to use WebDAV): Type: sudo a2enmod suexec rewrite ssl actions include

Type: sudo a2enmod dav_fs dav auth_digest

Next open /etc/apache2/mods-available/suphp.conf…

Type: sudo nano /etc/apache2/mods-available/suphp.conf

Comment out the <FilesMatch “\.ph(p3?|tml)$”> section
Add AddType application/x-httpd-suphp .php .php3 .php4 .php5 .phtml

<IfModule mod_suphp.c>
    #<FilesMatch "\.ph(p3?|tml)$">
    #    SetHandler application/x-httpd-suphp
        AddType application/x-httpd-suphp .php .php3 .php4 .php5 .phtml
        suPHP_AddHandler application/x-httpd-suphp

    <Directory />
        suPHP_Engine on

    # By default, disable suPHP for debian packaged web applications as files
    # are owned by root and cannot be executed by suPHP because of min_uid.
    <Directory /usr/share>
        suPHP_Engine off

# # Use a specific php config file (a dir which contains a php.ini file)
#       suPHP_ConfigPath /etc/php5/cgi/suphp/
# # Tells mod_suphp NOT to handle requests with the type .
#       suPHP_RemoveHandler 

Restart Apache

Type: sudo /etc/init.d/apache2 restart

Raspberry PI: Raspbian – Headless Multi Boot From USB Hard Drive

Unfortunately these partitions share a boot directory and a kernel, so updates may break one of the systems. The kernel version will also most likely will have to be the same on both systems. However, since I wanted to keep developing my hardened raspbian and start setting up a server this allows me to do both without contaminating my hardened version of raspbian with server programs. Eventually both will get merged but until I have a complete understanding of hardening this is a good alternative.

sudo fdisk /dev/sda

delete partitions

+4G [enter]
+4G [enter]
+1G [enter]

The third partition as a swap is not needed. however, I may choose to enable it at some point.

copy system to partitions

sudo dd if=/dev/mmcblk0p6 of=/dev/sda1
sudo dd if=/dev/mmcblk0p6 of=/dev/sda2

Resize the partitions

sudo resize2fs /dev/sda1
sudo resize2fs /dev/sda2

Make our different boot options

sudo cp /boot/cmdline.txt /boot/sd.txt
sudo cp /boot/cmdline.txt /boot/security.txt
sudo cp /boot/cmdline.txt /boot/server.txt

Edit the text files we just created to load the partitions we want

sudo nano /boot/security.txt
change /dev/mmcblk0p6 to /dev/sda1

sudo nano /boot/server.txt
change /dev/mmcblk0p6 to /dev/sda2

Then to change boot partitions boot into the linux and just copy one of the text files you created to cmdline.txt then reboot.

sudo cp /boot/security.txt /boot/cmdline.txt
sudo reboot

Raspberry Pi: Raspbian – Boot From USB Hard Drive

While this is not a true boot from hard drive since an SD card is still required it will speed up your system and possibly reduce usage of the SD card to prevent SD card failure.

sudo fdisk /dev/sda

If partitions exist delete partitions using d then

[enter] Partition Type
[enter] Partition Number
[enter] Partition Size

If your current partition is on mmcblk0p6 and destination partition sda1 use

sudo dd if=/dev/mmcblk0p6 of=/dev/sda1

sudo resize2fs /dev/sda1

sudo nano /boot/cmdline.txt

change root=/dev/mmcblk0p6 to root=/dev/sda1

ctrl + o
ctrl + x

sudo reboot

Raspberry PI: Raspbian – Security Hardening

First we will want to secure the users

Create a new root user for yourself

Type: sudo adduser username

this will ask you twice for a password for the new user, after that it will ask you more questions you can use the default answer by hitting enter on each question.

Now we will add the group sudo to the user you just created

Type: sudo adduser username sudo

You are ready to use the user you just created

Type: logout

Log back in as the user you just created

Next you will edit /etc/sudoers as follows the pi line is at the bottom of the file

Type: sudo nano /etc/sudoers


Verify no accounts have empty passwords

Type: sudo awk -F: '($2 == "") {print}' /etc/shadow

If you find a user with an empty password use the following to lock the account

Type If: sudo passwd -l username

You may unlock the account later by typing the following

Type If: sudo passwd -u username

Next we will make sure only the root user has a UID of 0

Type: sudo awk -F: '($3 == "0") {print}' /etc/passwd

If you see other lines, delete them or make sure other accounts are authorized by you to use UID 0.
[How do we delete them?]

Make sure the root account is disabled

Type: sudo passwd -l root

Delete the user pi

Type: sudo deluser --remove-home pi

You will get a message: Warning: group `pi’ has no more members. Don’t worry the above command deletes the pi group automatically.

Get rid of excess programs

Get a list of installed packages

Type: dpkg --get-selections

For a more specific package search

Type: dpkg --get-selections | grep xserver

Get rid of LXDE

Type: sudo apt-get remove --purge lxappearance lxde-common lxde-icon-theme lxinput lxmenu-data lxpanel lxpanel-data lxpolkit lxrandr lxsession lxsession-edit lxshortcut lxtask lxterminal

Get rid of X Windows

Type: sudo apt-get remove --purge xserver-xorg xserver-xorg-input-all xserver-xorg-input-evdev xserver-xorg-input-synaptics xserver-common xserver-xorg-core xserver-xorg-video-fbdev xserver-xorg-video-fbturbo x11-common x11-utils x11-xkb-utils x11-xserver-utils xarchiver xauth weston ttf-dejavu-core xkb-data fontconfig fontconfig-config fonts-freefont-ttf gnome-themes-standard-data gstreamer1.0-alsa gstreamer1.0-libav gstreamer1.0-omx gstreamer1.0-plugins-base dbus-x11

Get rid of wireless programs

Type: sudo apt-get remove --purge wireless-tools wpasupplicant

Get rid of Samba

Type: sudo apt-get remove --purge smbclient samba-common

Get rid of Audio support

Type: sudo apt-get remove --purge alsa-base alsa-utils

Get rid of Python

Type: sudo apt-get remove --purge python python-gi python-minimal python-numpy python-picamera python-pifacecommon python-pifacedigitalio python-rpi.gpio python-serial python-support python2.7 python2.7-minimal python3 python3-minimal python3-numpy python3-picamera python3-pifacecommon python3-pifacedigital-scratch-handler python3-pifacedigitalio python3-rpi.gpio python3-serial python3.2 python3.2-minimal

Get rid of Git

Type: sudo apt-get remove --purge git git-core git-man

Get rid of other programs (make sure nothing you use is in this list these are programs like text editors and shells that I didn’t want or need)

Type: sudo apt-get remove --purge smartsim minecraft-pi penguinspuzzle udisks freepats ed vim-common vim-tiny java-common

Now clean up any missed packages

Type: sudo apt-get autoremove –purge

After programs are removed we will want to perform a system upgrade

We begin by updating the package list

Type: sudo apt-get update

If you are asked are you sure press Y then enter.

When this has completed we upgrade the system

Type: sudo apt-get upgrade

If you are asked are you sure press Y then enter.

Raspberry PI: Fix SD Card Partitions in Windows 8.1

Replace all occurrences of N with a number

Open a Command Prompt

Type: diskpart

A new window will open, In the new window

Type: list disk

Now select the drive number of your SD Card

Type: select disk N

Type: list partition

Repeat the following two steps for all partitions

Type: select partition N

Type: delete partition


Type: create partition primary

Type: format

Raspberry PI: Raspbian – Install

Go to the Raspberry PI Downloads Page.

Download “NOOBS Offline and network install” by clicking Download ZIP.

Once downloaded Open the zip file and copy the contents to an SD Card.

Insert the SD Card into your Raspberry PI.

Turn on your Raspberry PI by plugging it in.

A screen will show up with some options
-Select English US or your language
-Select Keyboard us or your keyboard language
-Select the Raspbian Check box
-click the install button at the top.

When the install finishes you will need to click OK

Once Raspbian has installed there will be a configuration menu. Just use the arrow keys to select Finish unless you have specific configurations you want at this point.

How to Make Money on the Internet


Swag Bucks
Index Dollars


Global Test Market
Swag Bucks
Index Dollars

Your Own Website






Google AdSense




Get A Coder

Sell Stuff


Coin Mining


Bit Coins
Doge Coins
Lite Coins





Cashback For Groceries


Maxtor Shared Storage II : Create New Disk

I have a 320GB version. This method was used to setup 320GB and 500GB drives for use in a Maxtor Shared Storage II single drive device.

Place drive into a linux box or use a LiveCD version of linux to create the drive. Download the firmware from seagate Maxtor Shared Storage II.

Replace all occurrences of X with the drive letter. If any partitions exist on the drive you will need to delete them all with the fdisk command d.

We partition the drive as follows

fdisk /dev/sdX
> n
> Type: p
> Partition: 1
> First: [enter]
> Last: +247M
> n
> Type: p
> Partition: 2
> First: [enter]
> Last: +247M
> n
> Type: p
> Partition: 3
> First: [enter]
> Last: +247M
> n
> Type: e
> First: [enter]
> Last: [enter]
> n
> First: [enter]
> Last: +490M
> n
> First: [enter]
> Last: [enter]
> a
> Partition: 1
> t
> Partition: 3
> Type: 82
> w

We format all the partitions of the drive.

mkswap /dev/sdX3
mkfs.ext3 -b 4096 /dev/sdX1
mkfs.ext3 -b 4096 /dev/sdX2
mkfs.ext3 -b 4096 /dev/sdX5
mkfs.ext3 -b 4096 /dev/sdX6

Extract the firmware image from the archive.

tar -zxvf MSS_V_3_1_28.bin

Put the image onto partition 1 and 2.

dd if=coyote-3.1.28.img of=/dev/sdX1 bs=1024k
dd if=coyote-3.1.28.img of=/dev/sdX2 bs=1024k

If all steps were completed correctly you may now place the drive into your Maxtor Shared Storage II.