树莓派基础配置

安装系统
http://sourceforge.net/projects/win32diskimager/           #下载win32diskimager
https://www.raspberrypi.org/downloads/                         #下载Raspbian

将系统镜像刷入SD卡,插入派,启动,Xshell使用SSH连接

开启root用户:

$ sudo passwd --unlock root
$ sudo passwd root

 
$ su  


配置yum
$ mv /etc/apt/sources.list /etc/apt/sources.list.bak
$ vi /etc/apt/sources.list
deb http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib           #阿里源
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib
$ apt-get update
$ apt-get install chkconfig -y

$ raspi-config
1 Expand Filesystem
2 Change User Password
4 Internationalisation Options 
    1 Change Locale                                                         更改默认语言
    2 Change Timezone                                                    更改时区
8 Advanced Options 
    A3 Memory Split                                                          默认预留给图形界面的是64MB,可将其改成32MB,这里修改后,VNC安装可忽略
    A6 Update

 

安装VNC
$ apt-get install tightvncserver -y
设置一个VNC密码:
$ vncpasswd
先输入操作密码两次,然后会询问是否设置一个查看(view-only)密码,按自己喜欢,一般没必要
开机自动启动
设置开机启动,需要在/etc/init.d/中创建一个文件
$ vi /etc/init.d/tightvncserver

#!/bin/sh
### BEGIN INIT INFO
# Provides:          tightvncserver
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO

# More details see:
http://www.penguintutor.com/linux/tightvnc

### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER='pi'
### End customization required

eval cd ~$USER

case "$1" in
  start)
    # 启动命令行。此处自定义分辨率、控制台号码或其它参数。
    su $USER -c '/usr/bin/tightvncserver -depth 16 -geometry 800x600 :1'
    echo "Starting TightVNC server for $USER "
    ;;
  stop)
    # 终止命令行。此处控制台号码与启动一致。
    su $USER -c '/usr/bin/tightvncserver -kill :1'
    echo "Tightvncserver stopped"
    ;;
    *)
    echo "Usage: /etc/init.d/tightvncserver {start|stop}"
    exit 1
    ;;
esac
exit 0
$ chmod 755 /etc/init.d/tightvncserver
$ chkconfig tightvncserver on
 
配置网络

1.有线连接,并设置静态IP
$ vi /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.120
gateway 192.168.1.1
netmask 255.255.255.0

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

$ echo 'nameserver 114.114.114.114' >> /etc/resolv.conf


2.设置无线(未成功)
$  vi /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=2

network={
ssid=WIFI名称“
proto=WPA2
key_mgmt=WPA-PSK
pairwise=TKIP
group=TKIP
psk=WIFI密码“
}

$ vi /etc/network/interfaces 
auto lo
iface lo inet loopback
iface eth0 inet dhcp.

auto wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf
post-down killall -q wpa_supplicant

修改完成后,使用以下命令重启网络
$ service networking restart
成功后,用 ifconfig 命令可以看到 wlan0 设备,且有了IP地址(已连接)

设置静态
ip
$ vi /etc/network/interfaces
auto lo
iface lo inet loopback

iface eth0 inet dhcp
allow-hotplug wlan0

iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static
address 192.168.1.120
netmask 255.255.255.0
gateway 192.168.1.1

$ echo 'nameserver 114.114.114.114' >> /etc/resolv.conf
 

posted on 2016-07-11 09:22  森度  阅读(636)  评论(0编辑  收藏  举报

导航