Andrew's Raspberry Pi Admin Notes

Remotely connect to pi: ssh pi@ipaddress
Default Username: pi
Default Pasword: raspberry

Get root: sudo bash

Set static IP address
1. vi /etc/network/interfaces
2. add
iface eth0 inet static
address x.x.x.x
netmask 255.255.255.0
gateway x.x.x.x
3. Restart network interface: ifconfig eth0 down; ifconfig eth0 up

Update DNS settings:
1. vi /etc/resolve.conf

Configure Wifi Manually:
1. List your network interfaces: ifconfig -a ; ifplugstatus
2. Enable the interface you want to configure: ifconfig wlan0 up
3. Show what wifi access points can be seen: iwlist wlan0 scan
4. Connect to the access point: iwconfig wlan0 essid linus
5. Request an address using dhcp: dhclient -v wlan0

Resources:
http://www.maketecheasier.com/setup-wifi-on-raspberry-pi/

Changing MAC Address on Raspbian:
add smsc95xx.macaddr=00:00:00:00:00:00 to /boot/cmdline.txt
OR 
vi /etc/network/interfaces and add: waddress ether 00:11:22:33:44:55 

find out your mac address: cat /sys/class/net/eth0/address (or ifconfig)

Updating Raspbian Packages:
Download latest raspbian package lists: sudo apt-get update
Download and upgrade latest raspbian packages: sudo apt-get upgrade

Reboot: reboot

Change Keyboard to US Layout:
=================================
- Run 'sudo dpkg-reconfigure locales' and changing from en_GB.UTF-8 to en_US.UTF-8 
(or whatever country setting you need).
- Reboot. (init 6)
- Run 'sudo dpkg-reconfigure keyboard-configuration' and change the keyboard to USA PC101 
(again, change as needed).
- Reboot. (init 6)

Set Proxy for apt-get:
export http_proxy=http://username:password-AT-proxyserver-DOT-net:port/
export ftp_proxy=http://username:password@proxyserver-DOT-netport/
OR
Edit your /etc/apt/apt.conf file as root.
Put these line at the end of your /etc/apt/apt.conf file :
Acquire::http::Proxy "http://username:password-AT-proxyserver:port/"

Install Web Server:
=====================
apt-get install nginx
mv /var/www/html/index.* /var/www/html/nginx-debian-default.html

Configure Raspberry Pi as WiFi Access Point:
==============================================
apt-get install hostapd isc-dhcp-server iptables-persistent
As per Adafruit pdf instructions

Setup DNS redirect (redirect all port 80 traffic to local webserver:
=========================================================================
apt-get install dnsmasq
cp /etc/dnsmasq/dnsmasq.conf /etc/dnsmasq/dnsmasq.conf.original
vi /etc/dnsmasq/dnsmasq.conf and add:
interface=eth0
interface=lo
interface=wlan0
address=/#/192.168.7.1

Nginx config:
Redirect any 404’s to the index page: vi /etc/nginx/nginx.conf and after "http {" add:
 error_page 404 http://192.168.7.1/index.html;
Allow indexing directories: vi /etc/nginx/nginx.conf and after "http {" add: autoindex on;

Misc Commands:
===============
Boot to command line: raspi-config
Mount USB Drive: mount /dev/sda /mnt