3、树莓派的配置:改静态IP、连接ssh、安装中文字体、安装谷歌输入法、增加USB电流、修改触摸屏分辨率、扩展sd卡空间、修复vi和vim乱码问题、安装配置远程桌面vnc
本博文仅作本人操作过程的记录,留作备忘。自强不息 QQ1222698
1、连接上HDMI线,插上触摸屏,插上键盘,鼠标,网线,启动。系统正常启动,但是一直闪烁,不停的黑屏,是由于触摸屏的usb口供电不足,等会再处理这个问题,先把触摸屏的usb插到另外的一个电源(手机充电器或电脑USB)上就行了,系统启动后,是桌面。

3、第一个工作,启用root用户,修改密码,打开命令行,运行下面的命令
命令:sudo passwd root
输入密码:123
重复输入:123
启用账号:sudo passwd --unlock root
切换root:su
输入密码:123
修改pi的密码:passwd pi
输入密码:123
重复输入:123
pi@raspberrypi:~$ sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
pi@raspberrypi:~$ sudo passwd --unlock root
passwd: password expiry information changed.
pi@raspberrypi:~$ su
y^H^HPassword:
root@raspberrypi:/home/pi# passwd pi
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@raspberrypi:/home/pi#
4、修改IP地址,打开命令行,先su到root下,输入leafpad /etc/network/interfaces,打开网络配置文件。
auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1
5、修改DNS配置
/etc/resolv.conf
nameserver 192.168.0.1
,也可以不改,好像会自动更新(我猜的)。
6、运行命令reboot,系统重启后,IP就可以用了。
使用ssh连接到树莓派上。SecureCRT,地址http://www.xdowns.com/soft/softdown.asp?softid=23625
a、刚连接的时候会出现乱码,等安装完中文就可以了。
b、如果执行完下面的步骤,还是乱码,就SecureCRT,选项,会话选项,终端,外观,字符编码,选择UTF-8,就显示中文了。

7、安装中文字体
sudo apt-get install fonts-arphic-gbsn00lp fonts-arphic-gkai00mp fonts-arphic-bsmi00lp fonts-arphic-bkai00mp(是L,不是1)
8、在/etc/profile文件最后添加,export LC_ALL="zh_CN.UTF-8"
9、命令sudo raspi-config,修改系统默认字体,选择第5项,internationalisation options,回车,选择I1 change locale,回车,往下翻(最下面),找到zh_CN.UTF-8,回车。等半天后,重启后就可以了。
10、下载输入法
sudo apt-get install fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-sunpinyin libsunpinyin3 sunpinyin-data
11、触摸屏的USB插在树莓派上,触摸屏就不停的闪烁,是因为树莓派的USB口输出电流不够,需要调整参数。
root后,修改/boot/config.txt
修改usb的最大输出电流为1A,max_usb_current=1
修改分辨率为
disable_overscan=1
hdmi_cvt 800 480 60 6 0 0 0
hdmi_group=2
hdmi_mode=87
重启,填满屏幕。
和上面的图片对比一下,就明白了。

12、(我又找到了新的办法。下面的操作,也是可以的。看下面的第10操作步骤。)
由于树莓派默认无法使用所有SD卡所有空间,很快就会系统空间不足,无法运行,所有需要尽快把sd的空间扩展起来。
pi@raspberrypi:~$ df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/root 3.5G 3.3G 0 100% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 463M 0 463M 0% /dev/shm
tmpfs 463M 6.4M 457M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 20M 41M 34% /boot
tmpfs 93M 0 93M 0% /run/user/1000
tmpfs 93M 0 93M 0% /run/user/109
pi@raspberrypi:~$ cat /sy-bash: 无法为立即文档创建临时文件: 设备上没有空间
-bash: 无法为立即文档创建临时文件: 设备上没有空间
pi@raspberrypi:/sys/block/mmcblk0/mmcblk0p2$ cat start
pi@raspberrypi:/sys/block/mmcblk0/mmcblk0p2$ cd ..
pi@raspberrypi:/sys/block/mmcblk0$ sudo fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Partition number (1,2, default 2):
Partition 2 has been deleted.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2):
First sector (2048-15278079, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (131072-15278079, default 15278079):回车
Created a new partition 2 of type 'Linux' and of size 7.2 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: 设备或资源忙
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
pi@raspberrypi:/sys/block/mmcblk0$ df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/root 3.5G 3.3G 976K 100% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 463M 0 463M 0% /dev/shm
tmpfs 463M 13M 451M 3% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 20M 41M 34% /boot
tmpfs 93M 0 93M 0% /run/user/1000
此时,系统的空间还没有变化,重启系统:reboot
重启后,空间还是没有变化,需要执行一个命令才行。
pi@raspberrypi:~$ df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/root 3.5G 3.3G 840K 100% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 463M 0 463M 0% /dev/shm
tmpfs 463M 6.3M 457M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 20M 41M 34% /boot
tmpfs 93M 0 93M 0% /run/user/1000
pi@raspberrypi:~$ sudo resize2fs /dev/mmcblk0p2
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p2 is now 1893376 (4k) blocks long.
pi@raspberrypi:~$ df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/root 7.1G 3.3G 3.5G 50% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 463M 0 463M 0% /dev/shm
tmpfs 463M 6.3M 457M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 20M 41M 34% /boot
tmpfs 93M 0 93M 0% /run/user/1000
pi@raspberrypi:~$
空间已经扩展开了。
13、新办法,我没做实验,不知道能不能行。sudo raspi-config,选择第1、expand filesystem,回车,再回车。
14、使用vi的时候,按方向键会出现字母,而不是移动光标,是因为vi不是完整版,我们先卸载vi,再安装vim;
sudo apt-get remove vim-common
sudo apt-get install vim
15、安装vnc,sudo apt-get install tightvncserver,安装完毕后,运行tightvncserver,输入控制密码,重复输入;选择是否设置查看密码,输入n;
16、win7上安装vnc客户端,我用的是http://www.realvnc.com/,输入密码,就能连接上去。


a、修改密码vncpasswd
b、查看远程列表,ps ax | grep Xtightvnc | grep -v grep
c、关闭一个连接,vncserver -kill :1(注意:前面的空格)。1是桌面编号。
d、启动一个桌面:vncserver,会显示出桌面编号。用客户端连接的时候输入:192.168.0.10:1 192.168.0.10:2 这种格式。
e、系统重启后,无法连接到vnc,网上提供的自启动方法(我测试的无效,还是无法启动,那就算球了,老子用ssh连上去再手工启动不就行了!)
网上抄来的方法,先登陆root用户,新建启动文件 /etc/init.d/tightvncserver
#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $syslog $remote_fs $network
# Required-Stop: $syslog $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts VNC Server on system start.
# Description: Starts tight VNC Server. Script written by James Swineson.
### END INIT INFO
# /etc/init.d/tightvncserver
VNCUSER='pi'
case "$1" in
start)
su $VNCUSER -c '/usr/bin/tightvncserver :1'
echo "Starting TightVNC Server for $VNCUSER"
;;
stop)
pkill Xtightvnc
echo "TightVNC Server stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0
然后运行:
sudo chmod 755 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults
重启看效果吧。
取消开机启动也很简单,就一行代码: sudo update-rc.d -f tightvncserver remove
备注:
1、查看服务列表 service --status-all
2、更新软件源
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb http://mirrors.neusoft.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb-src http://mirrors.neusoft.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb-src http://mirrors.ustc.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
3、树莓派的配置:改静态IP、连接ssh、安装中文字体、安装谷歌输入法、增加USB电流、修改触摸屏分辨率、扩展sd卡空间、修复vi和vim乱码问题、安装配置远程桌面vnc的更多相关文章
- 【树莓派】树莓派网络配置:静态IP、无线网络、服务等
一.网络配置之静态IP: 树莓派的默认网络为: haochuang@raspberrypi:~ $ vi /etc/network/interfaces # interfaces() file use ...
- VirtualBox配置centos7静态ip(详解)
VirtualBox安装centos7配置静态ip地址可以本机访问,可以联网. 在开始之前先说一下,不知道为什么,我在网上百度的大多数是不能用的,或者只能主机访问,或者只能联网. 我的配置文件为ifc ...
- 虚拟机桥接网卡下配置centOS静态IP
前面我们讲了怎么去配置asterisk,但是配置完了,是没有什么效果出现的,因为asterisk相当于一个服务器,我们需要一个客户端去给它连接起来,如果你是在自己的机子上装了虚拟机,那最好配一下cen ...
- VMware Fusion配置NAT静态IP
前言 本主机 CentOS8.2 Mac VMware Fusion 我们在使用虚拟机的时候,经常遇到这样的问题,我们会换地方,IP 会变化,如果虚拟机使用桥接的方式,那么很多与 IP 相关的服务都会 ...
- Centos7远程桌面 vnc/vnc-server的设置
Centos7与Centos6.x有了很大的不同. 为了给一台服务器装上远程桌面,走了不少弯路.写这篇博文,纯粹为了记录,以后如果遇到相同问题,可以追溯. 1.假定你的系统没有安装vnc的任何软件,那 ...
- centos中NAT模式下静态IP连接外网
使用linux虚拟机时,通常会用到yum命令来安装软件,然而这个命令需要连外网下载软件,用maven下载jar包也需要外网.虚拟机在内网可以互相ping通,然而ping不了外网,于是通过试验,终于找到 ...
- VMware虚拟机 安装centos7并设置静态ip 连接外网
首先下载VMware虚拟机:http://xzc.197746.com/VMware-Workstation-12.5.9.zip 然后下载centos7镜像:http://vault.centos. ...
- (11)树莓派3 有线网卡静态IP设置
https://www.cnblogs.com/10e-6/p/5778355.html 树莓派设置静态IP地址 首先终端输入: ifconfig 查看树莓派默认分配的动态IP地址. 图 1-4 配置 ...
- 设置树莓派3 B+的静态IP
修改/etc/dhcpcd.conf 文件 sudo vim /etc/dhcpcd.conf interface eth0 static ip_address= static routers=192 ...
随机推荐
- ChatterBot之使用mongodb 03
上一篇我们已经搭建好了mongodb环境,本篇为简单示例. 废话不多说先上代码然后开始讲解; !!!别忘了打开你的mongdb服务!!!,如果没有mongodb请看上篇如何安装mongodb; # - ...
- 导入Excel 文件(图片和文字)NPOI+BootStrap fileinput 插件 的结合使用
1.页面代码: <!DOCTYPE html><html><head> <meta name="viewport" content=&qu ...
- nyoj 2 括号配对问题 栈
nyoj 2 括号配对问题 题目链接: http://acm.nyist.net/JudgeOnline/problem.php?pid=2 思路: 栈:'(' '['入栈,遇到 ']' ')'出栈 ...
- 组件嵌套时报:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
在组件嵌套的过程中,报了一个错误: 这里报错的原因是:vue的组件(模板)只能有一个根节点,即.vue文件中的<template>标签下只能有一个子元素. 因此,建议大家在写.vue组件的 ...
- 获取串口映射的COM端口号
背景:近期由于项目需要,需要操作短信猫,当短信猫插入电脑后,会根据当前PC状况,映射COM口,这里需动态获取短信猫映射的COM端口号. 编程语言C#: 具体代码如下 public enum Hardw ...
- .9-浅析webpack源码之NodeEnvironmentPlugin模块总览
介绍Compiler的构造比较无趣,不如先过后面的,在用到compiler的时候再做讲解. 这一节主要讲这行代码: // 不管这里 compiler = new Compiler(); compile ...
- C#使用ManagementObjectSearcher来获取系统信息时会有out of memory的异常
在开发环境下,时不时出现out of memory的异常,最后是在服务界面重新启动 Windows Management Instrumentation后就好了.
- js onmouseover与onmouseout用法
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- C++map类型 之 简单介绍
一:map的前世今生 (1)从关联容器与顺序容器说起.关联容器通过键(key)存储和读取元素.而顺序容器则通过元素在容器中的位置顺序存储和訪问元素(vector,queue,stack,list等). ...
- Android酷炫有用的开源框架
一.代码库 1.from 代码家 整理比較好的源代码连接 一.兼容类库 ActionBarSherlock : Action Bar是Android 3.0后才開始支持的,ActionBarSher ...