R-Pi Server up and running again! (change to static IP)

Fresh in the morning, i reinstall web2py from Web2Py webpage to my home directory ( /home/pi) and run the following:

cd /home/pi/web2py
sudo python2.6 web2py.py

I can start server at 127.0.0.1 (localhost) but not my public IP. It encountered an error:

ERROR:Rocket.Errors.Port8000:Socket 10.0.0.189:8000 in use by other process and it won't share

Meh, can’t find any solution from the web.

So i set my Raspberry Pi IP address to static such as follow:
(ref: Using a Static IP Address)

$ sudo nano /etc/network/interfaces

Change the line that reads

iface eth0 inet dhcp

to

iface eth0 inet static

Below this line enter the desired settings:

address 10.0.0.132 # a static IP address of your choice
netmask 255.255.255.0 # from here onwards, it depends on your router settings
network 10.0.0.0
broadcast 10.0.0.255
gateway 10.0.0.100

For the network mask, broadcast address and gateway, type:

$ ifconfig

or

ipconfig

in your same network window command prompt.

CTRL+O to save and CTRL+X to exit.

Then from your same network computer, try to ping to the new static address you just set by typing in the command prompt:

ping

You can do the same thing on Raspberry Pi as well and ping to your same network computer.

Then i reinstall web2py using the following codes which does not require me to run the web2py.py everytime i want to start the server:

sudo su

wget http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
chmod +x setup-web2py-ubuntu.sh

./setup-web2py-ubuntu.sh

Remember to set an admin password when prompted!
Then go to a browser and type:
https://
for my case, https://10.0.0.132
then click “Admnistrative Interface” and it will prompt you for a your password!
And there you go! server up and running! But i am still wondering why must I install web2py… by right, after reinstalling apache, it should give me “It works!” or something.:/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s