Boa: Difference between revisions

From ArmadeusWiki
m (corrections for a better rendering)
 
(44 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<span style="font-size: 2em; font-weight:bold;"> How install and setup boa on your board </span>
<span style="font-size: 2em; font-weight:bold;"> How-to install and configure the Boa Web server on your Armadeus board </span>


[[Image:boa.png|right]]
<br />
<br />
<br />
==Installation==
==Install==
* Launch Buildroot's configuration:
 
<pre class="host">
$ cd armadeus
  $ make menuconfig
  $ make menuconfig
 
</pre>
* Select: ''Package Selection for the Target -> Other stuffs -> Boa''
* Select:  
<pre class="config">
...
Package Selection for the target  --->
    [*]  Show packages that are also provided by busybox
        ...
    [*] Networking  --->
            ...
        [*]  boa
</pre>
* Save the configuration
* Save the configuration
 
* Then build the binaries and the default filesystem. This will be useful later to perform the configuration:
Then we can create the binaries and the default filesystem. This will be usefull
<pre class="host">
later to perform the configuration :
 
  $ make
  $ make
</pre>


<br />
==Configuration==
<br />
==Configure==
 
<br />


=== Generalities ===
=== Generalities ===


To apply a permanent configuration, be sure not to change anything on the board filesystem: that would be erased the next time you reflash the rootfs. <br>
Instead, do all changes on the filesystem located on the Host, i.e. on ''buildroot/project_build_armv4t/apf9328/root/'' for the APF9328 or ''buildroot/project_build_armv5te/apf27/root/'' for the [[APF27]].


To apply a permanent configuration, be sure to not change anything on the board filesystem. <br />
The Boa configuration file is located in ''/etc/boa/boa.conf'' on the board; this means that to permanently change the configuration, you need to edit the file ''buildroot/project_build_armvXX/apfXX/root/etc/boa/boa.conf'' '''on the Host'''.<br>
That would be erased the next time you flash the fs. Instead, do all changes on the filesystem
located on the host, i.e. on ''buildroot/build_arm_nofpu/root/''
 
The boa configuration file is located in ''/etc/boa/boa.conf'' on the card <br />
This means that to permanently change the configuration, you need to edit the file
''buildroot/build_arm_nofpu/root/etc/boa/boa.conf'' '''on the host'''


<br />
As the root directory name is dependent of the target, there is a way to find it automatically:
<br />
$ make shell_env && source armadeus_env.sh
Then the directory can be accessed with ''$ARMADEUS_ROOTFS_DIR''.


=== Create a Dummy page ===
=== Create a Dummy page ===


By default, DocumentRoot is set to /var/www, so let's add a dummy file here to test
*By default, DocumentRoot is set to /var/www, so let's add a dummy file here to test our configuration:
our configuration :


  $ mkdir buildroot/build_arm_nofpu/root/var/www
  $ mkdir $ARMADEUS_ROOTFS_DIR/var/www
  $ vi buildroot/build_arm_nofpu/root/var/www/index.html
  $ vim $ARMADEUS_ROOTFS_DIR/var/www/index.html


And fill the file with :
*And fill the file with:
 
<source lang="html4strict">
<html>
<html>
  <head>
    <head>
  <title> Welcome on the Armadeus Board </title>
        <title> Welcome on the Armadeus Board </title>
  </head>
    </head>
  <body>
    <body>
    <nowiki><h1> Welcome on the Armadeus Board </h1></nowiki>
        <nowiki><h1> Welcome on the Armadeus Board </h1></nowiki>
  </body>
    </body>
</html>
</html>
 
</source>
<br />
<br />


=== Enable hostname resolution ===
=== Enable hostname resolution ===


Boa has to be able to resolve the hostname to work, so let's do :
*Boa has to be able to resolve the hostname to work, so let's do:


  $ echo "127.0.0.1 `cat buildroot/build_arm_nofpu/root/etc/hostname`" >> buildroot/build_arm_nofpu/root/etc/hosts
  $ echo "127.0.0.1 `cat $ARMADEUS_ROOTFS_DIR/etc/hostname`" >> $ARMADEUS_ROOTFS_DIR/etc/hosts
 
<br />
<br />


=== Create the access log directory ===
=== Create the access log directory ===


By default, boa logs will be stored in /var/log/boa/ on the card.
*By default, Boa logs will be stored in ''/var/log/boa/''. If you didn't not change this setting, you will need to perform the following :
If you did not change this setting, you will need to perform the following :
  $ ls -l $ARMADEUS_ROOTFS_DIR/var/log
 
  $ls -l buildroot/build_arm_nofpu/root/var/log/
 
If this is a link to /tmp, then
 
$ rm -f buildroot/build_arm_nofpu/root/var/log/ && mkdir buildroot/build_arm_nofpu/root/var/log/


Then, create the boa directory :
*If it's a link to ''/tmp'', then
  $ mkdir buildroot/build_arm_nofpu/root/var/log/boa
  $ rm -f $ARMADEUS_ROOTFS_DIR/var/log && mkdir $ARMADEUS_ROOTFS_DIR/var/log/


<br />
*Then, create the boa directory :
$ mkdir $ARMADEUS_ROOTFS_DIR/var/log/boa


-----
-----
Why shoud I delete the symbolink link ? <br />
Why shoud I delete the symbolink link? <br>
This is because during the filesystem creation, mkfs.jffs2 will keep the link from ''/var/log'' to ''/tmp'' on the board.
This is because during the filesystem creation, mkfs.jffs2 will keep the link from ''/var/log'' to ''/tmp'' on the board.
Thus, once on the board, you will have :
Thus, once on the board, you will have:
 
<pre class=apf>
  # ls -l /var/log
  # ls -l /var/log
  lrwxrwxrwx    1 root    root            4 Apr 15  2007 /var/log -> /tmp
  lrwxrwxrwx    1 root    root            4 Apr 15  2007 /var/log -> /tmp
</pre>


With a such behavior, even if you fill the directory ''buildroot/build_arm_nofpu/root/var/log/'' on your host
With such a behavior, even if you fill the directory ''$ARMADEUS_ROOTFS_DIR/var/log/'' on your host
(which actually fill /tmp on your host), nothing will be saved once the filesystem will be flashed on your board.
(which actually fill ''/tmp'' on your host), nothing will be saved once the filesystem will be flashed on your board.
<br />
-----
 
<br />
<br />


== Test the result ==
== Test the result ==


Create the final rootfs :
*Create the final rootfs:
 
  $ make
  $ make


Then [[Target_Software_Installation | update the rootfs]] on your board. <br />
*Then [[Target_Software_Installation | update the rootfs]] on your board. Reboot it, and start Boa:
<pre class=apf>
# boa
</pre>


And start boa
*To access your web page, use a browser:
http://''<your board's IP Address>''/


$ boa
You should see the page ! <br />
 
 
To access to your web page, use a browser:
http://''<your IP Address>''/
 
You sould see the page ! <br />
If not, check the file ''/var/log/boa/error_log'' on your board
If not, check the file ''/var/log/boa/error_log'' on your board


<br />
[[Image:Boa_welcome.png]]
<br />
 


== Working with cgi ==
== Working with cgi ==


*First, check the ''boa.conf'' file. Once more, you should use the one located on your host before changing anything.
$ vi $ARMADEUS_ROOTFS_DIR/etc/boa/boa.conf


First, check the boa.conf file. <br />
*Be sure to have an uncommented line like this:
Once more, you should use the one located on your host before changing anything.
 
$ vi buildroot/build_arm_nofpu/root/etc/boa/boa.conf
 
Be sure to have an uncommented line like this :
 
  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/


*Now, let's write a dummy cgi:


Now; let's write a dummy cgi :
  $ mkdir $ARMADEUS_ROOTFS_DIR/usr/lib/cgi-bin
 
  $ vim $ARMADEUS_ROOTFS_DIR/usr/lib/cgi-bin/get_ipconfig.sh
  $ mkdir buildroot/build_arm_nofpu/root/usr/lib/cgi-bin
  $ vi buildroot/build_arm_nofpu/root/usr/lib/cgi-bin/get_ipconfig.sh
 
And add the following :
 
#!/bin/sh
echo -e "Content-type: text/html\r\n\r\n";
echo -e `/sbin/ifconfig  eth0 | grep 'inet addr'`;


*And add the following :
<source lang="bash">
#!/bin/sh
echo -e "Content-type: text/html\r\n\r\n";
echo -e `/sbin/ifconfig  eth0 | grep 'inet addr'`;
</source>
The script have to be executable:  
The script have to be executable:  
$ chmod a+x $ARMADEUS_ROOTFS_DIR/usr/lib/cgi-bin/get_ipconfig.sh


$ chmod a+x buildroot/build_arm_nofpu/root/usr/lib/cgi-bin/get_ipconfig.sh
*Then change your index.html page to add a link to the cgi:
 
 
Then change your index.html page to add a link to the cgi:
 
$ vi buildroot/build_arm_nofpu/root/var/www/index.html
 


  <html>
  $ vi $ARMADEUS_ROOTFS_DIR/var/www/index.html
  <head>
<source lang="html4strict">
  <title> Welcome on the Armadeus Board </title>
<html>
  </head>
    <head>
  <body>
        <title> Welcome on the Armadeus Board </title>
    <nowiki><h1> Welcome on the Armadeus Board </h1></nowiki>
    </head>
    <nowiki><br /></nowiki>
    <body>
    <nowiki><br /></nowiki>
        <h1> Welcome on the Armadeus Board </h1>
    <nowiki><a href=http://<Your IP Address>/cgi-bin/get_ipconfig.sh> Get the board ip config </a></nowiki>
        <br> <br>
    <nowiki><br /></nowiki>
        <a href=http://<Your board IP Address>/cgi-bin/get_ipconfig.sh> Get the board ip config </a>
        <br>
     </body>
     </body>
</html>
</html>
 
</source>


Create the new root fs :
*Create the new rootfs:
  $ make
  $ make


Finally, [[Target_Software_Installation | Transfer the rootfs]] to the board & flash it.
*Finally, [[Target_Software_Installation | transfer the rootfs]] to the board & flash it.


You can now access to the new web page and click on the cgi link !
You can now access to the new web page and click on the cgi link !
==Links==
* [http://www.boa.org The Boa Web page]
[[Category:Network]]
[[Category:Web]]

Latest revision as of 11:03, 11 December 2012

How-to install and configure the Boa Web server on your Armadeus board

Boa.png


Installation

  • Launch Buildroot's configuration:
 $ make menuconfig
  • Select:
...
Package Selection for the target  --->
    [*]   Show packages that are also provided by busybox
        ...
    [*] Networking  --->
            ...
        [*]   boa
  • Save the configuration
  • Then build the binaries and the default filesystem. This will be useful later to perform the configuration:
 $ make

Configuration

Generalities

To apply a permanent configuration, be sure not to change anything on the board filesystem: that would be erased the next time you reflash the rootfs.
Instead, do all changes on the filesystem located on the Host, i.e. on buildroot/project_build_armv4t/apf9328/root/ for the APF9328 or buildroot/project_build_armv5te/apf27/root/ for the APF27.

The Boa configuration file is located in /etc/boa/boa.conf on the board; this means that to permanently change the configuration, you need to edit the file buildroot/project_build_armvXX/apfXX/root/etc/boa/boa.conf on the Host.

As the root directory name is dependent of the target, there is a way to find it automatically:

$ make shell_env && source armadeus_env.sh

Then the directory can be accessed with $ARMADEUS_ROOTFS_DIR.

Create a Dummy page

  • By default, DocumentRoot is set to /var/www, so let's add a dummy file here to test our configuration:
$ mkdir $ARMADEUS_ROOTFS_DIR/var/www
$ vim $ARMADEUS_ROOTFS_DIR/var/www/index.html
  • And fill the file with:
<html>
    <head>
        <title> Welcome on the Armadeus Board </title>
    </head>
    <body>
        <nowiki><h1> Welcome on the Armadeus Board </h1></nowiki>
    </body>
</html>

Enable hostname resolution

  • Boa has to be able to resolve the hostname to work, so let's do:
$ echo "127.0.0.1 `cat $ARMADEUS_ROOTFS_DIR/etc/hostname`" >> $ARMADEUS_ROOTFS_DIR/etc/hosts

Create the access log directory

  • By default, Boa logs will be stored in /var/log/boa/. If you didn't not change this setting, you will need to perform the following :
$ ls -l $ARMADEUS_ROOTFS_DIR/var/log
  • If it's a link to /tmp, then
$ rm -f $ARMADEUS_ROOTFS_DIR/var/log && mkdir $ARMADEUS_ROOTFS_DIR/var/log/
  • Then, create the boa directory :
$ mkdir $ARMADEUS_ROOTFS_DIR/var/log/boa

Why shoud I delete the symbolink link?
This is because during the filesystem creation, mkfs.jffs2 will keep the link from /var/log to /tmp on the board. Thus, once on the board, you will have:

 # ls -l /var/log
 lrwxrwxrwx    1 root     root            4 Apr 15  2007 /var/log -> /tmp

With such a behavior, even if you fill the directory $ARMADEUS_ROOTFS_DIR/var/log/ on your host (which actually fill /tmp on your host), nothing will be saved once the filesystem will be flashed on your board.

Test the result

  • Create the final rootfs:
$ make
 # boa
  • To access your web page, use a browser:
http://<your board's IP Address>/

You should see the page !
If not, check the file /var/log/boa/error_log on your board

Boa welcome.png

Working with cgi

  • First, check the boa.conf file. Once more, you should use the one located on your host before changing anything.
$ vi $ARMADEUS_ROOTFS_DIR/etc/boa/boa.conf
  • Be sure to have an uncommented line like this:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  • Now, let's write a dummy cgi:
$ mkdir $ARMADEUS_ROOTFS_DIR/usr/lib/cgi-bin
$ vim $ARMADEUS_ROOTFS_DIR/usr/lib/cgi-bin/get_ipconfig.sh
  • And add the following :
#!/bin/sh
echo -e "Content-type: text/html\r\n\r\n";
echo -e `/sbin/ifconfig  eth0 | grep 'inet addr'`;

The script have to be executable:

$ chmod a+x $ARMADEUS_ROOTFS_DIR/usr/lib/cgi-bin/get_ipconfig.sh
  • Then change your index.html page to add a link to the cgi:
$ vi $ARMADEUS_ROOTFS_DIR/var/www/index.html
<html>
    <head>
        <title> Welcome on the Armadeus Board </title>
    </head>
    <body>
        <h1> Welcome on the Armadeus Board </h1>
        <br> <br>
        <a href=http://<Your board IP Address>/cgi-bin/get_ipconfig.sh> Get the board ip config </a>
        <br>
    </body>
</html>
  • Create the new rootfs:
$ make

You can now access to the new web page and click on the cgi link !

Links