Install the Nand System on Cubieboard A10 and configure nginx, php, mysql, and samba.

Source: Internet
Author: User
Tags ssh port win32diskimager

Prerequisites
1. Download win32diskimager-v0.7-binary.zip
2.download debian_wheezy_armhf_v1_mele.zip
3.download cubie_nand_uboot_partition_image.zip
4.download flashfxp.zip
5.download panasonicsdformatter.zip
6.download puttyfile_0.62cn.zip

The above files: http://pan.baidu.com/share/link? Consumer id = 3403213788 & uk = 2267413926

Install the system on Nand

1. Mount the TF card into the card reader and insert it into the USB interface of the computer.
2.decompress win32diskimagerand debian_wheezy_armhf_v1_meleto the current directory and run win32diskimager.exe.
3. Select debian_wheezy_armhf_v1_mele.img, select the drive letter of your card reader, and click Write.
4. Remove the TF card, insert the TF card plug-in of cubieboard, and power it on.
5. After the cubieboard is started, go to the vro to view the DHCP client list and record the IP address of the host mele, that is, the IP address of the cubieboard.
6.decompress flashfxp.zipand cubie_nand_uboot_partition_image.zip, open FlashFXP, use quick connection, select SFTP (without SSH) as the type, enter the ip address of cubieboard, And the account password is root,
7. After logging on, upload cubie_nand_uboot_partition_image.bin to the root directory.
8.decompress puttyfile_0.62cn.zip to execute putty.exe in the directory, enter the IP address recorded in the previous step in the host name on the interface, and the port remains unchanged. Click Open. A warning will pop up, and select 'yes.
9. log on to the system with the account root and password root.
10. Run
Dd bs = 4096 if = cubie_nand_uboot_partition_image.bin of =/dev/nand # update onboard MBR
Wait for at least thirty seconds.
Rm cubie_nand_uboot_partition_image.bin # delete an object
Reboot # restart cubieboard
11. After the restart is complete, use putty to log on and execute the following commands in sequence.
Mkfs. ext4/dev/nandb # format the onboard storage
Mount/dev/nandb/mnt # mount
Mkdir/tmp/boot # create a temporary directory
Mount/dev/mmcblk0p1/tmp/boot # mount the first partition of the SD card to the temporary directory just now
Mkdir/mnt/boot # create a boot directory in the on-board storage
Cp/tmp/boot/uImage/mnt/boot/uImage # import the boot Image in the first partition of the SD card to the boot directory in the onboard directory.
Touch cplst.txt # create a txt file
Nano cplst.txt # edit the content as follows:

/Dev /*
/Proc /*
/Sys /*
/Media /*
/Mnt /*
/Run /*
/Tmp /*

Press ctrl + x, enter y, and press enter to save.
12. Then execute
Rsync-avc --exclude-from?cplst.txt // mnt # synchronize the TF card system to the NAND
After the preceding command is executed, enter shutdown-h now to turn off the power, remove the TF card, and restart the system. At this time, the cubieboard is no longer running from the TF card.
Run
Rm cplst.txt # delete an object

Initial System settings
1. Fixed MAC address
Nano/etc/network/interfaces
Add a new line at the end of the configuration file. The content is as follows:
Hwaddress ether AA: BB: CC: CB: EB: 00

2. Modify the Host Name
Nano/etc/hostname

3. modify the current user password
Passwd

4. format the storage card with Panasonic SDFormatter. Otherwise, the cubieboard cannot be started when the storage card is inserted. Be sure to select 'Enable 'For 'formatting size '.

5. Set automatic TF card mounting
Insert TF card and execute
Cat/proc/partitions # view all current partitions

The last one is the TF card.
Run nano/etc/fstab
Add at the end of a row as follows:
/Dev/mmcblk0p1/mnt vfat defaults, umask = 000 1 2
Save and restart the system. Run the "df-h" command to check whether the mounting is successful.

6. Install nginx, php, and mysql
Run
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
Apt-get install php5-cgi
Apt-get install mysql-server

When installing Mysql, you will be prompted to enter the password. Remember the password you entered. the root password in Mysql is what you entered. After all the installation is complete, we will start to configure relevant programs one by one.
First, create a webpage directory
Run
Mkdir/mnt/wwwroot # create a directory
Touch/mnt/wwwroot/index. php # create a php probe File
Nano/mnt/wwwroot/index. php # write content to the php Probe

Write the following content

<? Php
Phpinfo ();
?>

Configure Nginx as follows:
Nano/etc/nginx. conf # modify nginx. conf
Worker_processes 1;
Worker_connections 128;

Cancel the # Before the following code to make it take effect.
Gzip on;
Gzip_disable "msie6 ";
Gzip_vary on;
Gzip_proxied any;
Gzip_comp_level 6;
Gzip_buffers 16 8 k;
Gzip_http_version 1.1;
Gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml + rss text/javascript;

Nano/etc/nginx/sites-available/default # modify default

Server {
Listen 80;
# Listen [:]: 80 default_server;

Root/mnt/wwwroot; # modify the website path required here. Do not add this comment
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 // index.html;
}

Location/doc /{
Alias/usr/share/doc /;
Autoindex on;
Allow 127.0.0.1;
Allow: 1;
Deny all;
}


Location ~ . * \. Php (\/. *) * $ {
Fastcgi_split_path_info ^ (. + \. php) (/. +) $;
Fastcgi_pass unix:/var/run/php5-fpm.sock;
Fastcgi_index index. php;
Include fastcgi_params;
}
}

The next step is to optimize the CB hardware environment of the Mysql database software.
Nano/etc/mysql/my. cnf
[Mysqld]
Key_buffer = 64 k
Max_allowed_packet = 1 M
Thread_stack = 64 K
Thread_cache_size = 4

# The following two items are not displayed in the default configuration file and need to be added.
Default-storage-engine = MyISAM
Loose-skip-innodb
Skip-innodb
Innodb = OFF

Then optimize PHP and modify the code.
Nano/etc/php5/fpm/php. ini
Memory_limit = 16 M

Nano/etc/php5/fpm/php-fpm.conf
Process. max = 4

So far, all the installation and optimization work has been completed. We can restart the Nginx, Php, and Mysql services one by one to verify that the configuration file is correct.
Service nginx reload # restart Nginx
Service php5-fpm reload # restart Php5
Service mysql reload # restart Mysql

Then reboot restarts and access the IP address of cubieboard through a browser to check whether the configuration is correct.

7. Install the samba Service (easy to upload and modify webpages)
Run
Apt-get install samba # install samba service components
Nano/etc/samba/smb. conf # edit the configuration file to clear the original configuration and copy and modify the following configuration.

[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 # restart the samba Service


8. If the website prompts no write permission, execute
Chmod 777/mnt/wwwroot

Other settings
1. Change the default ssh port
Nano/etc/ssh/sshd_config
Change port 22 to the port you want to set, and then reboot

2. Set the time zone
Cp/usr/share/zoneinfo/Asia/Shanghai/etc/localtime

3. Update Time
Ntpdate cn.pool.ntp.org

4. Set the automatic update time
Run
Apt-get install cron
Nano/etc/crontab
Add at the end
*/60 *** root ntpdate cn.pool.ntp.org

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.