6 Replies Latest reply on Jan 13, 2016 11:16 AM by Scott_42isMOL

    Edison with LAMP environment XDK compatibel

    DieterW

      Hi there,

       

      I would like to make a project with the Edison, where data is measured, stored locally in a database (preferable mySQL), with a local web server (Apache) and PHP, so that I can call web pages, which should be shown in iframes from the Intel XDK IoT (the purpose is to show the measured data (current and history) as nice graphs with highcharts on a mobile device).

       

      Most of the things are clear to me, but I have very little knowledge of Linux and I searched for many hours for a solution, but I found surprisingly almost nothing. I found Ubilinux as an alternative distribution, where it should be easier to setup LAMP, but it seems to me nobody got it working with the XDK. The nearest thing I found is AlexT's repository, where I find packages for Apache, PHP, and mySQL. But I have no idea what to do.

       

      So, I kindly ask for some more or less detailed instructions, what I have to do to get an Edison (with Arduino board) up and running with LAMP environment and XDK compatibility. If I have that I am pretty sure I can handle the rest.

       

      By the way, I am aware of the alternatives, i.e. posting data to an external web server, which would be easy, I know. Then I would not even need an Edison, as an Adruino Uno would do too. However, I do not want to rely on another device. The sytem should measure and store data on its own.

        • 1. Re: Edison with LAMP environment XDK compatibel
          DieterW

          OK. I think I found the answer after visiting AlexT's thread Edison opkg package repo created again (reading it more carefully), and following the posts of user rubidium.This is what I think I understood:

          * Yes, the LAMP setting is possible and since it is still Yocto Linux it should be compatible with Intel XDK.

          * Steps to do:

          1. Configure Edison for AlexT's repo according to Edison Package Repo Configuration Instructions
          2. Install Apache and PHP with opkg install apache2 modphp
          3. Start Apache with systemctl start apache2

          Unfortunately my knowledge of Linux is such limited that I am stuck here:

          • Does systemctl make that Apache will start automatically when Edison powered on?
          • How to install MariaDB and start the service automatically?
          • I think I read that the Edison has already some webserver running on port 80. Is this true and can I change the port, so that the Apache will answer to a standard request?
          • Anything else to keep in mind (e.g. to have enough space for DB)?

          Sorry to ask so many questions, but I want to make sure that the Edison is exactly what I need before I go any buy one.

          • 2. Re: Edison with LAMP environment XDK compatibel
            DieterW

            Unfortunately I am stuck and need help!

            Everything went more or less smoothly until I tried to install the MariaDB package. After installing and starting Apache as mentioned above I ran:

            opkg install mariadb-server

            This ended in a FATAL ERROR as it ran our of space (I think on the root partition).

             

            Please help me!

             

            Here is the output I got:

            root@flaumibbq:/# opkg install mariadb-server
            Installing mariadb-server (5.5.40-r0) to root...
            Downloading http://repo.opkg.net/edison/repo/core2-32/mariadb-server_5.5.40-r0_core2-32.ipk.
            Installing libaio1 (0.3.109-r2) to root...
            Downloading http://repo.opkg.net/edison/repo/core2-32/libaio1_0.3.109-r2_core2-32.ipk.
            Installing perl-module-sys-hostname (5.14.3-r1) to root...
            Downloading http://repo.opkg.net/edison/repo/core2-32/perl-module-sys-hostname_5.14.3-r1_core2-32.ipk.
            Installing perl-module-file-temp (5.14.3-r1) to root...
            Downloading http://repo.opkg.net/edison/repo/core2-32/perl-module-file-temp_5.14.3-r1_core2-32.ipk.
            Running groupadd commands...
            NOTE: Performing groupadd with [ --system mysql] and 10 times of retry
            Running useradd commands...
            NOTE: Performing useradd with [ --system --home-dir /var/mysql -g mysql --shell /bin/false mysql] and 10 times of retry
            Configuring libaio1.
            /sbin/ldconfig: Writing of cache data failed: No space left on device
            Configuring perl-module-sys-hostname.
            Configuring perl-module-file-temp.
            Configuring mariadb-server.
            mkdir: can't create directory '/var/lib/mysql': No space left on device
            chown: /var/lib/mysql: No such file or directory
            
            FATAL ERROR: Could not find my_print_defaults
            
            The following directories were searched:
            
                /usr/bin
                /usr/extra
            
            If you compiled from source, you need to run 'make install' to
            copy the software into the correct location ready for operation.
            
            If you are using a binary release, you must either be at the top
            level of the extracted archive, or pass the --basedir option
            pointing to that location.
            
            The latest information about mysql_install_db is available at
            https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
            Collected errors:
            * copy_file_chunk: write: No space left on device.
            * pkg_run_script: package "libaio1" postinst script returned status 1.
            * opkg_configure: libaio1.postinst returned 1.
            * opkg_conf_write_status_files: Couldn't close //var/lib/opkg/status: No space left on device.
            
            
            • 3. Re: Edison with LAMP environment XDK compatibel
              mhahn

              You probably will have to repartition your rootfs as described elsewhere on this forum

              Try "df -h" in console in order to see the remaining space

              • 4. Re: Edison with LAMP environment XDK compatibel
                DieterW

                Thanks a lot. Yes, this is what I already confirmed as df shows that the root fs has no space left:

                 

                Filesystem            Size  Used     Available
                Use%Mounted on
                /dev/root           463.9M453.7M       0100%/
                devtmpfs            479.9M     479.9M 0%/dev
                tmpfs               480.2M     480.2M 0%/dev/shm
                tmpfs               480.2M504.0K  479.7M 0%/run
                tmpfs               480.2M     480.2M 0%/sys/fs/cgroup
                systemd-1             5.7M  5.3M  462.0K92%/boot
                systemd-1             2.2G 13.1M    2.2G 1%/home
                tmpfs               480.2M  4.0K  480.2M 0%/tmp
                tmpfs               480.2M     480.2M 0%/var/volatile
                /dev/mmcblk0p5     1003.0K 19.0K  913.0K 2%/factory
                /dev/mmcblk0p10       2.2G 13.1M    2.2G 1%/home
                /dev/mmcblk0p7        5.7M  5.3M  462.0K92%/boot

                 

                Unfortunately I could not find instructions on the internet how to reallocate space from one of the other filesystems to the rootfs (at least not for my level of knowledge). But thanks a lot for the hint regarding this forum. I will search it this evening.

                • 6. Re: Edison with LAMP environment XDK compatibel
                  Scott_42isMOL

                  It seems that some time between then and now, the amount of room in the file systems has been adjusted and this is no longer a problem.

                   

                   

                   

                   

                  FilesystemSizeUsedAvailableUse%Mounted on
                  /dev/root1.4G561.2M798.8M41%/
                  devtmpfs 479.8M        0   479.8M 0% /dev
                  tmpfs

                  480.0M       

                  0    480.0M 0% /dev/shm
                  tmpfs                 

                  480.0M  

                  572.0K    479.5M 0%
                  /run
                  tmpfs                 

                  480.0M      

                  0   480.0M  0% /sys/fs/cgroup
                  systemd-1 

                     5.8M    

                  5.4M    458.0K 92%
                  /boot
                  tmpfs                 

                  480.0M   

                    4.0K   480.0M  0% /tmp
                  systemd-1  

                  1.3G   

                  75.8M      1.2G 6%
                  /home
                  tmpfs

                  480.0M     

                    0   480.0M  0% /var/volatile
                  /dev/mmcblk0p5  

                  1003.0K   

                  19.0K   913.0K 2%
                  /factory
                  /dev/mmcblk1p1

                  14.9G   

                  32.0K    14.9G  0% /media/sdcard
                  /dev/mmcblk0p10 

                  1.3G   

                  75.8M      1.2G 
                  6%
                  /home
                  /dev/mmcblk0p75.8M      5.4M   458.0K  92% /boot

                   

                   

                  I followed the installation and start instructions for Apache2 that you listed, and followed the instructions from How do you disable the default Edison server? to dissable the default server so the Apache server comes up by default. Thanks for the info.