zoukankan      html  css  js  c++  java
  • 树莓派raspbian安装配置(基本配置+中文配置+远程桌面+lighttpd+php+mysql)

    raspbian为树莓派的官方系统,基于Debian裁剪过的Linux系统

    其配置过程如下

    • 烧录镜像

    首先从树莓派的官方网站上下载镜像和镜像工具

    http://www.raspberrypi.org/downloads 

    Win32DiskImager Raspbian “wheezy”

    镜像压缩包大概为400M,解压之后为1.8G,所以需要一张2G以上的SD卡才能完成镜像写入

    写完之后,插到树莓派上,插上电源即可启动

    • 开机后进行相应的设置

    只要包括以下几个部分

    expand-rootfs 把SD的所有空间扩展为raspberry pi的根目录(默认只是镜像的1。8G)

    overscan 在屏幕不能完整显示时配置

    configure-keyboard 修改键盘布局,俺选的是English(US)

    chang_timezone修改时区

    boot_behaviour 设置启动时自动进入桌面

    修改完通过TAB键切换到Finish选项,敲回车就自动重启了

    • 修改IP地址
    #设置IP、掩码
    sudo ifconfig eth0 20.20.16.123 netmask 255.255.255.0   
       
    #设置默认网关
    sudo route add
    default gw 20.20.16.1

    #启用网卡
    sudo ifconfig eth0 up

    如果需要设置固定IP,可以通过修改配置文件的方式:

    sudo /usr/bin/leafpad /etc/network/interfaces

    将其中的

    iface eth0 inet dhcp

    修改为

    auto eth0
    iface eth0 inet static
    address 20.20.16.123
    gateway 20.20.16.1
    netmask 255.255.255.0

    修改DNS

    sudo /usr/bin/leafpad /etc/resolv.conf

    在里面添加下面的内容并保存

    nameserver 202.96.128.86
    nameserver 202.96.134.133
    • 换一个速度比较快的软件源
    #备份原有的源
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
    
    #使用leafpad替换原有的源为下面几行
    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
    deb http://mirror.nus.edu.sg/raspbian/raspbian/ wheezy main contrib non-free rpi 
    deb-src http://mirror.nus.edu.sg/raspbian/raspbian/ wheezy main contrib non-free rpi  
    
    sudo /usr/bin/leafpad /etc/apt/sources.list 
    #更新软件列表 
    sudo apt-get update
    • 安装远程桌面软件
    sudo apt-get install xrdp

    在windows下通过mstsc,使用用户名pi密码raspberry就可以远程到raspbian上了

    • 安装中文字体及输入法
    #安装文泉驿中文字体
    sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
    
    #安装ibus五笔及拼音输入法
    sudo apt-get install ibus ibus-pinyin ibus-table-wubi

    Ctrl+Alt+backspace退出登陆后,再登陆进来就能看到右下角有ibus的图标了

    在ibus上右键选择Preferences>Input Method>Select an input method>Chinese>选择自己喜欢的输入法>Add

    • 修改raspbian的语言区域
    sudo raspi-config

    选择change_locale

    Locales to be generated: Zh_CN.UTF-8 UTF-8

    Default Locale for the system environment:Zh_CN.UTF-8

    最后重启使用设置生效

    sudo reboot
    • 安装lighttpd+php+mysql
    sudo apt-get install lighttpd mysql-server php5-cgi php5-mysql

    修改php.ini配置

    sudo nano /etc/php5/cgi/php.ini

    将下列配置的;去掉,让CGI能取到SCRIPT_FILENAME变量值

    ;cgi.fix_pathinfo = 1

    修改lighttpd.conf

    sudo nano /etc/lighttpd/lighttpd.conf

    server.modules中增加fastcgi

    server.modules = (
    "mod_access",
    "mod_alias",
    "mod_compress",
    # "mod_redirect",
    "mod_fastcgi",
    # "mod_rewrite",
    )

     最后添加

    fastcgi.server = ( ".php" => ((
        "bin-path" => "/usr/bin/php5-cgi",
        "socket" => "/tmp/php.socket"
    )))

    重启lighttpd服务

    sudo /etc/init.d/lighttpd restart

    编写测试页面

    sudo nano /var/www/index.php

    添加下面的内容

    <?php
    phpinfo();
    ?>

    Ctrl+x后,输入Y,回车保存

    浏览测试网页

    http://20.20.16.123

  • 相关阅读:
    LC 综合 中级算法笔记
    LC 212. 单词搜索2
    [NLP] 2.2 文本正规化 (Text Normalization)
    本地秘钥复制到github,实现两者之间的交互
    Python 实例化对象
    C# 左补齐+ 生成一个星期的日期
    hello world
    迭代器模式、观察者模式
    代理模式、桥接模式、装饰器模式、适配器模式
    外观模式、组合模式、享元模式
  • 原文地址:https://www.cnblogs.com/yondy/p/3033404.html
Copyright © 2011-2022 走看看