Raspberry Pi B+ 实验
2015-12-01 10:43
621 查看
使用Raspberry Pi B+进行实验。
实验环境:
硬件:Raspberry Pi B+, Micro SD卡, 5V移动电源及其USB线, 网线
软件:Windows 10, Win32DiskImager, (Nmap)
下载系统镜像( https://www.raspberrypi.org/downloads/ ),并解压得到img镜像文件。
将SD卡连入电脑。
使用Win32DiskImager工具( http://sourceforge.net/projects/win32diskimager/ )把镜像写入SD卡中:
3.1 运行工具。
3.2 选择相应的img文件,在“Device”下选择SD的盘符。
3.3 选择“Write”,等待写入。完成后点确认即可。
由于没有额外显示器,而Raspberry Pi默认是启动SSH的,所以使用网线把Raspberry Pi连入电脑,再用PuTTY或VNC控制。
使用网线把Raspberry Pi和电脑连接起来。
获取Raspberry Pi的IP地址。
在命令行中输入
官方方法:https://www.raspberrypi.org/documentation/troubleshooting/hardware/networking/ip-address.md
2.1 下载Nmap( https://nmap.org/download.html )并安装。
2.2 在命令行中输入
2.3 假设本机的IP地址是
2.4 找到类似
打开PuTTY并输入Raspberry Pi的IP地址,连接。
输入Raspberry Pi中OS的用户名(默认为
可以选择第1项“Expand Filesystem”。
注意:Raspbian Jessie Lite没有X,需要自行安装。
部份软件:
http://blog.kurrunk.com/post/401.html
https://wiki.archlinux.org/index.php/List_of_applications
使用SSH或显示器连接Raspberry Pi,并在终端中输入:
运行tightvncserver,它会让你输入密码。
启动vncserver,并指定分辨率:
在PC机上启动VNC软件,如RealVNC, tightvnc view,输入密码即可。
插入无线网卡,输入
输入
编辑网络配置文件,输入
改成
输入
之后参考上文用网线连接的方法连接Raspberry Pi即可。输入
改成
其中的IP,网关等按实际情况修改。
改成
其中的IP,网关等按实际情况修改。
为了使Raspberry Pi不会自动装无线关掉,可在
加上一行
并修改
不同的无线上网卡配置的内容不一样。对于华为E3372,配置
然后输入命令
将无线上网卡拔下,重启Raspberry Pi,再将无线上网卡插上。
修改
输入
http://my.oschina.net/quanpower/blog/221920?fromerr=UueIXg7F
https://wiki.archlinux.org/index.php/List_of_applications
http://blog.kurrunk.com/post/401.html
https://sites.google.com/site/raspberypishare0918/home/di-yi-ci-qi-dong/1-6-you-xian-huo-wu-xian-dedhcp
实验环境:
硬件:Raspberry Pi B+, Micro SD卡, 5V移动电源及其USB线, 网线
软件:Windows 10, Win32DiskImager, (Nmap)
1. 把镜像写入SD卡中
方法:https://www.raspberrypi.org/documentation/installation/installing-images/下载系统镜像( https://www.raspberrypi.org/downloads/ ),并解压得到img镜像文件。
将SD卡连入电脑。
使用Win32DiskImager工具( http://sourceforge.net/projects/win32diskimager/ )把镜像写入SD卡中:
3.1 运行工具。
3.2 选择相应的img文件,在“Device”下选择SD的盘符。
3.3 选择“Write”,等待写入。完成后点确认即可。
2. 使用网线连接,并通过SSH访问Raspberry Pi
方法:https://www.raspberrypi.org/documentation/remote-access/ssh/README.md由于没有额外显示器,而Raspberry Pi默认是启动SSH的,所以使用网线把Raspberry Pi连入电脑,再用PuTTY或VNC控制。
使用网线把Raspberry Pi和电脑连接起来。
获取Raspberry Pi的IP地址。
在命令行中输入
arp -a,找到相应interface的相应IP地址(Raspberry Pi的物理地址一般都是“b8-”开头)。
官方方法:https://www.raspberrypi.org/documentation/troubleshooting/hardware/networking/ip-address.md
2.1 下载Nmap( https://nmap.org/download.html )并安装。
2.2 在命令行中输入
ipconfig /all找到本机的IP地址。
2.3 假设本机的IP地址是
192.168.1.5,那么在命令行中输入
nmap -sn 192.168.1.0/24搜索Raspberry Pi的IP地址。
2.4 找到类似
Nmap scan report for raspberrypi (192.168.1.8)的输出,其中的IP地址即为Raspberry Pi的IP地址。
打开PuTTY并输入Raspberry Pi的IP地址,连接。
输入Raspberry Pi中OS的用户名(默认为
pi)和密码(默认为
raspberry)。
3. raspi-config
在SSH下需要手动输入sudo raspi-config来进行设置。
可以选择第1项“Expand Filesystem”。
4. 使用网线连接,并通过VNC访问Raspberry Pi
方法:https://www.raspberrypi.org/documentation/remote-access/vnc/README.md注意:Raspbian Jessie Lite没有X,需要自行安装。
sudo apt-get install lightdm #sudo apt-get install xorg lxde sudo apt-get install xfce
部份软件:
http://blog.kurrunk.com/post/401.html
https://wiki.archlinux.org/index.php/List_of_applications
使用SSH或显示器连接Raspberry Pi,并在终端中输入:
sudo apt-get install tightvncserver。(记得把网络共享给以太网连接,以保证可以上网下载apt。)
运行tightvncserver,它会让你输入密码。
You will require a password to access your desktops. Would you like to enter a view-only password (y/n)? n xauth: file /home/pi/.Xauthority does not exist New 'X' desktop is raspberrypi:1 Creating default startup script /home/pi/.vnc/xstartup Starting applications specified in /home/pi/.vnc/xstartup Log file is /home/pi/.vnc/raspberrypi:1.log
启动vncserver,并指定分辨率:
vncserver :1 -geometry 1366x768 -depth 24
在PC机上启动VNC软件,如RealVNC, tightvnc view,输入密码即可。
5. 使用网线连接,并通过xrdp访问Raspberry Pi
如果要使用Microsoft Remote Desktop,则需要在Raspberry Pi上安装xrdp:sudo apt-get install xrdp,再启动Microsoft Remote Desktop,输入用户名及密码即可。
6. 使用无线网卡连接
确认无线网卡芯片是否在支持列表里( http://elinux.org/RPi_USB_Wi-Fi_Adapters )。插入无线网卡,输入
sudo lsusb即可看到所有挂载的USB设备,查看无线网卡是否检测成功。
输入
sudo iwlist wlan0 scan获取周围的无线网络信息。
编辑网络配置文件,输入
sudo nano /etc/network/interfaces,把
allow-hotplug wlan0 iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
改成
allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ssid 你要连接的wifi的ESSID wpa-psk 你要连接的wifi的密码
输入
sudo reboot重启。
之后参考上文用网线连接的方法连接Raspberry Pi即可。输入
iwconfig可以看到wlan0中的AP信息,若无AP信息即说明没有连接上AP。
7. 固定IP
有线IP固定
编辑网络配置文件,输入sudo nano /etc/network/interfaces,把
auto eth0 allow-hotplug eth0 iface eth0 inet dhcp
改成
auto eth0 allow-hotplug eth0 iface eth0 inet static address 192.168.1.2 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8 dns-search 8.8.4.4
其中的IP,网关等按实际情况修改。
无线IP固定
编辑网络配置文件,输入sudo nano /etc/network/interfaces,把
auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ssid TP-LINK_123456 wpa-psk 1234567890
改成
auto wlan0 allow-hotplug wlan0 iface wlan0 inet static address 192.168.137.2 netmask 255.255.255.0 gateway 192.168.137.1 wpa-ssid TP-LINK_123456 wpa-psk 1234567890
其中的IP,网关等按实际情况修改。
为了使Raspberry Pi不会自动装无线关掉,可在
/etc/network/interfaces
加上一行
wireless-power off
并修改
/etc/kbd/config,将
BLANK_TIME=改成
BLANK_TIME=0和
POWERDOWN_TIME=改成
POWERDOWN_TIME=0。
8. 无线上网卡配置
安装usb_modeswitch。sudo apt-get install usb-modeswitch usb-modeswitch-data
不同的无线上网卡配置的内容不一样。对于华为E3372,配置
/etc/usb_modeswitch.conf,在最后加上
EnableLogging=0 DefaultVendor=0x12d1 DefaultProduct=0x1f01 TargetVendor=0x12d1 TargetProduct=0x14dc MessageContent="55534243123456780000000000000a11062000000000000100000000000000" NoDriverLoading=1
然后输入命令
sudo usb_modeswitch -W -c /etc/usb_modeswitch.conf -I
将无线上网卡拔下,重启Raspberry Pi,再将无线上网卡插上。
修改
/etc/network/interfaces,加入
auto eht1 allow-hotplug eth1 iface eth1 inet dhcp
输入
sudo reboot重启。
参考
https://www.raspberrypi.orghttp://my.oschina.net/quanpower/blog/221920?fromerr=UueIXg7F
https://wiki.archlinux.org/index.php/List_of_applications
http://blog.kurrunk.com/post/401.html
https://sites.google.com/site/raspberypishare0918/home/di-yi-ci-qi-dong/1-6-you-xian-huo-wu-xian-dedhcp
相关文章推荐
- asp.net验证码注册
- 树莓派2 Raspberry Pi 2 ubuntu系统 分区大小调整
- LinQ 基础
- ASP.NET实现上传图片并生成缩略图的方法
- asp.net中使用 Repeater控件拖拽实现排序并同步数据库字段排序
- 解决imageView 设置aspect fil后出现多余照片
- ASP.NET MVC 应用,站点发布到本地IIS
- metasploit 学习
- ASP中if语句、select 、while循环的使用方法
- ASP.NET中IsPostBack详解
- ASP中用select case代替其他语言中的switch case, default用case else
- asp的SQL语句中and和or同时使用的注意事项
- ASP.net
- Asp.net MVC 中Controller返回值类型ActionResult
- asp.net chart美化+绑定数据--饼图
- 从java web的mvc理解asp.net的mvc(一)
- A simple Test Client built on top of ASP.NET Web API Help Page
- kali攻防第6章 SQLMAP介绍及ASP网站渗透
- Content Negotiation in ASP.NET Web API
- MVC ASP.net流程 源代码分析