2014年7月20日 星期日

RaspBerry Pi 系統設定

RaspBerry Pi


HDMI to VGA

Add config.txt to root dir of SD card with following contains

#disable_overscan=1
hdmi_force_hotplug=1
hdmi_drive=2
hdmi_group=2
# 1680x1050 60MHz
  hdmi_mode=58
# 1080p
  # hdmi_mode=82

Setup a static IP

  • Launch "WiFi Config" on the desktop
  • Config you wifi connection and set the IDString
  • $ sudo nano /etc/network/interfaces and add following lines
    iface IDString inet static
       address 192.168.1.88
       netmask 255.255.255.0
       gateway 192.168.1.1
    

    IDString is the name of connection that you set using the GUI WiFi Config

  • $ sudo nano /etc/wpasupplicant/wpasupplicant.conf
    network={
    ssid="YOURNETWORKNAME"
    psk="YOURNETWORKPASSWORD"
    proto=RSN
    keymgmt=WPA-PSK
    pairwise=CCMP
    authalg=OPEN
    }
    
    • proto could be either RSN (WPA2) or WPA (WPA1).
    • key_mgmt could be either WPA-PSK (most probably) or WPA-EAP (enterprise networks)
    • pairwise could be either CCMP (WPA2) or TKIP (WPA1)
    • auth_alg is most probably OPEN, other options are LEAP and SHARED
    • $ sudo reboot (or sudo service networking restart)
    • To check whether an IP address is set or not, type ip command. $ ip a
  • Using GUI config tool
    • $ sudo apt-get install wicd-curses
    • $ sudo apt-get install wicd-gtk

Update package source

  • $ sudo apt-get update
  • $ sudo apt-get upgrade

Install Remote desktop

  • $ sudo apt-get install tightvncserver
  • Lunch vnc server at startup

    1. Create a new file $ sudo nano /etc/init.d/tightvncserver
    2. Put following code into it

       ### BEGIN INIT INFO
       # Provides: tightvnc
       # Required-Start: $remotefs $syslog
       # Required-Stop: $remotefs $syslog
       # Default-Start: 2 3 4 5
       # Default-Stop: 0 1 6
       # Short-Description: Start VNC Server as a service
       # Description: Start VNC Server as a service.
       ### END INIT INFO
       #!/bin/sh
       # /etc/init.d/tightvncserver
       # Customised by Stewart Watkiss
      
       # Set the VNCUSER variable to the name of the user to start tightvncserver under
       VNCUSER='pi'
       eval cd ~$VNCUSER
       case "$1" in
       start)
          su $VNCUSER -c '/usr/bin/tightvncserver :1'
          echo "Starting TightVNC server for $VNCUSER "
          ;;
       stop)
          pkill Xtightvnc
          echo "Tightvncserver stopped"
          ;;
       *)
          echo "Usage: /etc/init.d/tightvncserver {start|stop}"
          exit 1
          ;;
       esac
       exit 0
       #
      

    3. 改變此檔案的權限 $ sudo chmod 755 /etc/init.d/tightvncserver
    4. /etc/init.d/tightvncserver start
    5. 輸入pi的密碼,然後再輸入vnc用的密碼
    6. 加入開機程序 $ sudo update-rc.d tightvncserver defaults

Setup samba server

  1. $ sudo apt-get install samba
  2. $ sudo nano /etc/samba/smb.conf
  3. Find # security = user
  4. Remove # as security = user
  5. Attach following lines to the end
       [Share]
       comment = Share_Folder
       path = /home/pi
       browseable = Yes
       writable = Yes
       public = No
    
  6. 執行以下步驟來新增 samba server 的使用者名稱: $ sudo pdbedit -a pi
  7. 可以使用以下指令查詢 samba server 現有的使用者: $ sudo pdbedit -L
  8. 最後再重新啟動 samba server: $ sudo service samba restart

Mount folder at startup

  1. $ sudo nano /etc/fstab
  2. Add following line
       /dev/mmcblk0p11  /data           ext4    defaults          1       0
    
  3. $ sudo mkdir /data
  4. $ sudo mount -a

Mount a network drive

  • $ sudo mount -t cifs -o username=yourusername,password=yourpassword //WindowsPC/share1 /mnt/mountfoldername
Mount at startup
  1. $ sudo nano /etc/fstab
  2. Append the following to the /etc/fstab file
    //WindowsPC/Share1 /mnt/mountfoldername cifs username=yourusername,password=yourpassword 0 0
    

Config RaspBerry Pi

  • $ sudo raspi-config
  • $ sudo passwd root

沒有留言: