Difference between revisions of "Raspberry Pi"

From RHS Wiki
Jump to navigation Jump to search
Line 13: Line 13:
  
 
== WiFi setup ==
 
== WiFi setup ==
 +
=== WPA2 ===
 
1. Scan wifi networks available:
 
1. Scan wifi networks available:
 
  <nowiki>sudo iwlist wlan0 scan</nowiki>
 
  <nowiki>sudo iwlist wlan0 scan</nowiki>
Line 21: Line 22:
 
     ssid="The_ESSID_from_earlier"
 
     ssid="The_ESSID_from_earlier"
 
     psk="Your_wifi_password"
 
     psk="Your_wifi_password"
}
+
}</nowiki>
</nowiki>
 
 
4. If after a few seconds the Raspberry WiFi isn't connected:
 
4. If after a few seconds the Raspberry WiFi isn't connected:
 
  <nowiki>
 
  <nowiki>
 
sudo ifdown wlan0
 
sudo ifdown wlan0
sudo ifup wlan0
+
sudo ifup wlan0 </nowiki>
  </nowiki>
+
 
 +
=== WPA2 + hidden SSID ===
 +
Edit /etc/wpa_supplicant/wpa_suplicant.conf
 +
  <nowiki>
 +
network={
 +
    ssid="NETWORK_NAME" # it can be any encryption type, just make sure to add the "scan_ssid=1" line after your settings.
 +
    key_mgmt=NONE
 +
    scan_ssid=1
 +
} </nowiki>
  
 
== Domain name setup ==
 
== Domain name setup ==

Revision as of 22:57, 16 January 2016

Installing Raspbian

1. Download Raspbian image from here.
2. Format SD card using FAT32.

sudo mkdosfs -F 32 -v /dev/mmcblk0

3. Install squashed file sistem on SD card.

sudo dd bs=4M if="/home/linux/2013-02-09-wheezy-raspbian.img" of=/dev/mmcblk0

Linux

Raspbian default username & password

By default the username and password are:
Username: pi
Passowrd:raspberry

WiFi setup

WPA2

1. Scan wifi networks available:

sudo iwlist wlan0 scan

2. Write down the ESSID (wifi network name) and IE (authentication used)
3. Edit /etc/wpa_supplicant/wpa_supplicant.conf, add the following at the bottom of the file.

network={
    ssid="The_ESSID_from_earlier"
    psk="Your_wifi_password"
}

4. If after a few seconds the Raspberry WiFi isn't connected:

sudo ifdown wlan0
sudo ifup wlan0 

WPA2 + hidden SSID

Edit /etc/wpa_supplicant/wpa_suplicant.conf

network={
    ssid="NETWORK_NAME" # it can be any encryption type, just make sure to add the "scan_ssid=1" line after your settings.
    key_mgmt=NONE
    scan_ssid=1
} 

Domain name setup

To change the domain server:
Edit /etc/hosts
Edit /etc/hostname
Commit changes by runing:
sudo /etc/init.d/hostname.sh

ssh rsa key setup

1. If you don't have an rsa key generate one by runing:

ssh-keygen -t rsa -C user@domain

2. Upload the .pub rsa key to the raspberry
3. Add the .pub key to ~/.ssh/authorized_keys

cat rsa_key.pub >> ~/.ssh/authorized_keys

Git server

1. Install Git:

sudo apt-get install wget git-core

2. Format an USB with FAT32, and connect it to the Raspberry (First turn off the raspberry)
3. Set up a mount point for the USB drive.
3.1 Create directory
3.2 Edit /etc/fstab, add line:

/dev/sda1 /home/pi/usbdrv vfat uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser 0 0

note: /dev/sda1 should correspond to usb drive you want to map, pi = user that will own the drieve. umask sets the permissions (substract from 7 the chmod octal value (to set rwx use 0...)
4. reboot Raspberry and check if the usb mounts correctly with lsblk
5. For each repository:
5.1 create a folder and cd into it.
5.2 git init --bare
5.3 add origin to your local git repository. Example:

git remote add pi pi@10.0.1.64:/home/pi/usbdrv/justdiedbot.git

5.4 push your repository into raspberry. Example: git push pi master

Disable sleep mode

The file /etc/kbd/config contains settings for non-x screen blanking.

change the following: BLANK_TIME=0 BLANK_DPMS=off POWERDOWN_TIME=0

Disable Realtek 8192cu WiFi Sleep Mode

Edit: /sys/module/8192cu/parameters/rtw_power_mgnt

cat /sys/module/8192cu/parameters/rtw_power_mgnt

If the file doesn't exist your WiFi adapter uses a diferent chip.
If it's set to:
1: Power safe is enabled
2: Power safe is disabled

Create a new file:

sudo nano /etc/modprobe.d/8192cu.conf

With the following content:

# Disable power management
options 8192cu rtw_power_mgnt=0

Then reboot. And it's done.

Print Server

Install CUPS

sudo apt-get update
sudo apt-get install cups

Add your raspberry user to lpadmin group.

sudo usermod -a -G lpadmin <user_name>

Log out and log in again for the changes to take effect.
If you are in a trusted network execute:

cupsctl --remote-any
sudo /etc/init.d/cups restart

Connect to the cups management via web browser:
http://raspberry_ip:631
Configure your printer.
To add scanner compatibility you must follow more steps explained in:
http://www.raspberry-pi-geek.com/Archive/2013/01/Converting-the-Raspberry-Pi-to-a-wireless-print-server

Keyboard Layout

sudo nano /etc/default/keyboard XKBLAYOUT="es"