cubieboard mysql_Cubieboard 安装Nand系统,配置nginx,php,mysql,samba详细教程

安装前置条件

1.下载win32diskimager-v0.7-binary.zip

2.下载

将系统安装到Nand

1将TF卡装入读卡器,插入电脑USB接口.

2.解压win32diskimager,debian_wheezy_armhf_v1_mele到当前目录,执行Win32DiskImager.exe.

3.选择debian_wheezy_armhf_v1_mele.img,盘符选择你读卡器的盘符,点击Write,等待写入完成.

4.取出TF卡,插入cubieboard的TF卡插口,通电开机。

5.等cubieboard启动后,进入路由器查看DHCP客户端列表,记录下主机mele的IP地址,即为cubieboard的ip地址.

6.解压FlashFXP.zip和cubie_nand_uboot_partition_image.zip,打开FlashFXP,使用快速连接,类型选择SFTP(无SSH),输入cubieboard的ip,账号密码均为root,

7.登录后上传cubie_nand_uboot_partition_image.bin到root目录.

8.解压puttyfile_0.62cn.zip,执行目录内的putty.exe,在界面的主机名处输入上一步骤记录的IP地址,端口保持不变,点击打开.期间会弹出警告,选择’是’即可.

9.以账号root,密码root登录系统。

10.执行

dd bs=4096 if=cubie_nand_uboot_partition_image.bin of=/dev/nand #更新板载MBR

等待至少三十秒,执行

rm cubie_

/dev/*

/proc/*

/sys/*

/media/*

/mnt/*

/run/*

/tmp/*

输入完成后按ctrl+x,然后输入y,回车保存.

12.然后执行

rsync -avc –exclude-from=cplst.txt / /mnt #同步TF卡系统到NAND

等待上述命令执行完成后,输入shutdown -h now关闭电源,取出TF卡,重新启动,此时cubieboard已经脱离TF卡运行了。

执行

rm cplst.txt #删除文件

系统的初步设置

1.固定MAC地址

nano /etc/network/interfaces

在配置文件末尾新加入一行,内容如下

hwaddress ether AA:BB:CC:CB:EB:00

2.修改主机名

nano /etc/hostname

3.修改当前用户密码

passwd

4.用Panasonic SDFormatter格式化存储卡,否则插入存储卡cubieboard不能启动.注意选项’格式化大小调整’选’开启’.

5.设置自动挂载TF卡

插入TF卡,执行

cat /proc/partitions #查看当前所有分区

最后一个便是TF卡

执行 nano /etc/fstab

在行尾添加,如下内容

/dev/mmcblk0p1 /mnt vfat defaults,umask=000 1 2

保存,重启系统后,用”df -h”命令查看是否挂载成功

6.安装nginx,php,mysql

依次执行

apt-get update

apt-get install nginx

apt-get install php5-fpm

apt-get install php5-cli

apt-get install php5-curl

apt-get install php5-gd

apt-get install php5-mcrypt

apt-get install php5-

安装Mysql的过程中会提示输入密码,请记住你所输入的密码,Mysql中的root密码即是你所输入的。待所有安装完成,下面我们开始逐一配置相关程序。

首先创建网页目录

执行

mkdir /mnt/wwwroot #创建目录

touch /mnt/wwwroot/index.php #创建php探针文件

nano /mnt/wwwroot/index.php #为php探针写入内容

写入以下内容

?php

phpinfo();

?

先配置Nginx 请按照以下内容对照修改

nano /etc/nginx/

取消以下代码前的#,使之生效。

gzip on;

gzip_disable “msie6”;

gzip_vary on;

gzip_proxied any;

gzip_comp_level 6;

gzip_buffers 16 8k;

gzip_http_version 1.1;

gzip_types text/plain text/css application/json application/x-javascript

text/xml application/xml application/xml+rss text/javascript;

nano /etc/nginx/sites-available/default #修改default

server {

listen 80;

#listen [::]:80 default_server;

root /mnt/wwwroot; #此处请修改为你所需的网站路径 本条注释请勿添加

index index.html index.php;

# Make site accessible from http://localhost/

#server_name localhost;

if (!-e $request_filename)

{

rewrite ^(.*)$ /index.php$1 last;

}

location / {

try_files $uri $uri/ /index.html;

}

location /doc/ {

alias /usr/share/doc/;

autoindex on;

allow 127.0.0.1;

allow ::1;

deny all;

}

location ~ .*.php(/.*)*$ {

fastpath_info ^(.+.php)(/.+)$;

fastcgi_pass unix:/var/run/php5-fpm.sock;

fastcgi_index index.php;

include fastcgi_params;

}

}

接下来是对Mysql数据库软件针对CB硬件环境所进行的优化操作

nano /etc/mysql/my.cnf

[mysqld]

key_buffer = 64k

max_allowed_packet = 1M

thread_stack = 64K

thread_cache_size = 4

#以下两条并未出现在默认的配置文件中,需要额外添加进去。

default-storage-engine = MyISAM

loose-skip-innodb

skip-innodb

innodb=OFF

然后对PHP进行优化处理,依旧寻找相应代码后进行修改。

nano /etc/php5/fpm/php.ini

memory_limit=16M

nano /etc/php5/fpm/php-fpm.conf

process.max=4

至此,所有的安装优化工作进行完毕,我们可以逐一进行对Nginx、Php、Mysql三项所属服务进行重启验证配置文件是否更改正确.

service nginx reload #重启Nginx

service php5-fpm reload #重启Php5

service mysql reload #重启Mysql

然后reboot进行一次重启,通过浏览器访问cubieboard的IP地址,查看是否配置正确。

7.安装samba服务(方便上传以及更改网页)

执行

apt-get install samba #安装samba服务组件

nano /etc/samba/smb.conf #编辑配置文件,可清空原有配置,复制修改以下配置。

[global]

workgroup = WORKGROUP

netbios name = Cubieboard

server string = Cubieboard

security = share

guest ok = yes

guest account = root

[root]

path = /mnt

writeable = yes

/etc/init.d/samba restart #重启samba服务

8.如果网站提示无写入权限,执行

chmod 777 /mnt/wwwroot

其他设置

1.更改ssh默认端口

nano /etc/ssh/sshd_config

将端口22更改为你想设置的端口,然后reboot

2.设置时区

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

3.更新时间

ntpdate cn.pool.ntp.org

4.设置自动更新时间

执行

apt-get install cron

nano /etc/crontab

在末尾添加上

*/60 * * * * root ntpdate cn.pool.ntp.org

本文为整合过程中参考http://cb.e-fly.org/博文以及其他网站参考资料,对原作者表示感谢。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值