Play Raspberry Pi(1)System and nodeJS/nginx

小木兮子 2014-12-16

Play Raspberry Pi(1)System and nodeJS/nginx
 
Download the software from here http://www.raspberrypi.org/downloads/
I prefer to try RAPBIAN, because I usually use ubuntu system.
 
I download the file 2014-09-09-wheezy-raspbian.zip
Unzip the file and open distutil on MAC system.
 
Find the 16 GB disk and clean that with MS-DOS(FAT) format.
 
Open command line and type
> diskutil list
 
Unmount the disk first
> sudo diskutil unmount /dev/disk2s1
 
Write the file to the disk
> sudo dd if=2014-09-09-wheezy-raspbian.img of=/dev/disk2 bs=2m
 
Type the username and password, pi, raspberry.
 
I change the password and add one user for myself.
>adduser carl
 
Add sudoer
>visudo
root    ALL=(ALL:ALL) ALL
carl    ALL=(ALL:ALL) ALL
 
ctrl + X to exit.
 
Set up the static ip
> cat /etc/network/interfaces
auto lo

iface lo inet loopback
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.0.106
gateway 192.168.0.1
netmask 255.255.255.0
dns-nameservers 8.8.8.8 8.8.4.4

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
 
Restart the system
> sudo reboot
 
Set up nodeJS env on raspberry pi.
 
Unzip the file and go to the working directory
> ./configure --prefix=/home/carl/tool/node-v0.10.33
>make
>make install
 
It will take a great long time to compile the source codes on that small machine. I may choose this one http://node-arm.herokuapp.com
Or I can download the arm-pi.tar.gz from some URLs like this http://nodejs.org/dist/v0.11.9/.
 
I pick up to install v0.10.28 or v0.11.11. Let me start with the latest one.
 
Some discussion about “ Illegal instruction"
 
Finally I found this version is working on my raspberry pi B+. http://nodejs.org/dist/v0.10.28/
> node -v && npm --version
v0.10.28
1.4.9
 
Set up nginx on raspberry pi
Download and try with version 1.6.2, unzip the file and try to build that
> ./configure --prefix=/home/carl/tool/nginx-1.6.2
 
Configure not pass, I need to install this first
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz
 
This command will help
> ./configure --prefix=/home/carl/tool/nginx-1.6.2 --with-pcre=/home/carl/tool/commons/pcre-8.36
 
It does not work well with manually installing PCRE. I may use this command to install PCRE instead.
> sudo apt-get install libpcre3
> sudo apt-get install libpcre3-dev
 
Command to test the config file
> sudo sbin/nginx -t
 
Command to start
> sudo sbin/nginx
 
Command to restart
> sudo sbin/nginx -s reload
 
Command to stop
> sudo sbin/nginx -s stop
 
References:
 
 
nginx installation
http://sillycat.iteye.com/blog/562634
http://sillycat.iteye.com/blog/2074417
http://sillycat.iteye.com/blog/2075245
http://sillycat.iteye.com/blog/1055873
 
 

相关推荐