Install LAMP, FTP and PhpMyAdmin on your Onion Omega



  • @Josip-Mlakar Such a nice tutorial. I will modify it a bit to use the pivot-overlay method instead of pivot-root.



  • @Josip-Mlakar Fantastic šŸ™‚
    I have been wanting to be able to use my 32GByte USB drive for some time in order to get more space.
    While I don't need LAMP etc. there were some packages that I wanted that I couldn't install for lack of space.

    However, following the instructions you referenced from https://samhobbs.co.uk/2013/11/more-space-for-packages-with-extroot-on-your-openwrt-router I now have my Omega running entirely from USB without any problems.

    Consequently, I am now able to install jamvm (which I need for a compact Java VM on the Omega) though I did need to use the --force-depends option on opkg because of kernel/repo version mismatches - though it is in fact not causing any problems.

    @Boken-Lin While I don't understand your reference to pivot-overlay vs pivot-root, if it makes an important difference, I will await your updates and re-do the loading on to USB



  • @Kit-Bishop Here's how you setup rootfs with the pivot-overlay method. https://wiki.onion.io/Tutorials/Using-USB-Storage-as-Rootfs. I'm still working on the pivot-root method.



  • @Boken-Lin Thanks - looking at the instructions for pivot-overlay it looks like it would be preferable to pivot-root in that it only puts the /overlay directory on to the USB rather than the whole system.

    While the pivot-root method as referenced by @Josip-Mlakar in https://samhobbs.co.uk/2013/11/more-space-for-packages-with-extroot-on-your-openwrt-router appears to work well, i think I will change to the overlay-root method.

    Will let you know if I hit any problems. And again thanks for the info šŸ™‚



  • @Boken-Lin I have tried following the instructions you give at https://wiki.onion.io/Tutorials/Using-USB-Storage-as-Rootfs for pivot-overlay method.
    I am having a problem.
    When I try the command in Step 3 :

    • mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt

    I get the messages

    • tar: empty archive
      tar: short read

    I think this may be related to the fact that Step 2 said:

    • mount /dev/sda1 /mnt/sda1

    I think there is some issue as to where /dev/sda1 is mounted.
    I am confused - can you clarify please. Thanks.



  • This post is deleted!


  • @Kit-Bishop That's quite strange. Can you try running the commands separately to see if it helps?

    mount /dev/sda1 /mnt
    

    then

    tar -C /overlay -cvf - . | tar -C /mnt -xf -
    

    Finally,

    umount /mnt
    


  • @Boken-Lin I'm having one of those days when nothing seems to go right! šŸ˜ž
    I have managed to move on a bit. Not sure why, but when I tried the

    mount /dev/sda1 /mnt ; tar -C /overlay -cvf - . | tar -C /mnt -xf - ; umount /mnt
    

    via PuTTY I continued to get the same error. However using MobaXTerm it worked.
    Now, my /mnt/sda1 directory has a copy of my /overlay directory.

    So I proceeded with the subsequent steps:

    block detect > /etc/config/fstab
    

    Edited /etc/config/fstab to set enabled to '1'

    reboot
    

    But nothing seems to have changed on my Omega.
    Sorry to swamp you with lots of information, but after the reboot, I have:

    Output from df -h

    root@Omega-0A97:/# df -h
    Filesystem                Size      Used Available Use% Mounted on
    rootfs                    8.4M    376.0K      8.1M   4% /
    /dev/root                 6.5M      6.5M         0 100% /rom
    tmpfs                    29.9M    456.0K     29.4M   1% /tmp
    /dev/mtdblock3            8.4M    376.0K      8.1M   4% /overlay
    overlayfs:/overlay        8.4M    376.0K      8.1M   4% /
    tmpfs                   512.0K         0    512.0K   0% /dev
    /dev/sda1                29.2G     44.0M     27.7G   0% /mnt/sda1
    root@Omega-0A97:/#
    

    Output from mount

    root@Omega-0A97:/# mount
    rootfs on / type rootfs (rw)
    /dev/root on /rom type squashfs (ro,relatime)
    proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
    sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
    tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
    /dev/mtdblock3 on /overlay type jffs2 (rw,noatime)
    overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
    tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
    devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600)
    /dev/sda1 on /mnt/sda1 type ext4 (rw,relatime,data=ordered)
    debugfs on /sys/kernel/debug type debugfs (rw,noatime)
    root@Omega-0A97:/#
    

    Contents of /etc/config/fstab

    root@Omega-0A97:/# cat /etc/config/fstab
    config 'global'
            option  anon_swap       '0'
            option  anon_mount      '0'
            option  auto_swap       '1'
            option  auto_mount      '1'
            option  delay_root      '5'
            option  check_fs        '0'
    
    config 'mount'
            option  target  '/mnt/sda1'
            option  uuid    'cad99fb9-c045-467a-b629-3acd4c170ae3'
            option  enabled '1'
    
    root@Omega-0A97:/#
    

    It looks like my USB is not getting mounted on /overlay.

    Do you see anything wrong? Is there some step I have missed? Is there any other info I can supply that might help?



  • @Josip-Mlakar Wiki article is online: https://wiki.onion.io/Tutorials/How-To-Install-LAMP-Stack-on-the-Omega šŸ™‚ I will put up a separate article for PHPMyAdmin.



  • @Kit-Bishop I think you should change:

    config 'mount'
            option  target  '/mnt/sda1'
            option  uuid    'cad99fb9-c045-467a-b629-3acd4c170ae3'
            option  enabled '1'
    

    from /etc/config/fstab to:

    config 'mount'
            option  target  '/overlay'
            option  uuid    'cad99fb9-c045-467a-b629-3acd4c170ae3'
            option  enabled '1'
    


  • @Boken-Lin cool šŸ˜„



  • @Boken-Lin Thanks - had just figured out that something like that was needed - having a slow brain day today šŸ™‚
    That works!
    Perhaps this should be made clearer on the bit on editing /etc/config/fstab in the WiKi page at https://wiki.onion.io/Tutorials/Using-USB-Storage-as-Rootfs



  • @Kit-Bishop Done!



  • @Boken-Lin Cool šŸ™‚ That was quick. Thanks for your help



  • @Boken-Lin ,

    While adapting @Josip-Mlakar 's guide to the Wiki, this step was missed.

    Seems simple enough of a step, but it is assumed the drive is formatted as ext4 in further steps.

    Thanks for both of yours' work!

    @Josip-Mlakar said:

    To do that you will have to format your USB storage into ext4 filesystem. You can do this by following commands:

    opkg update
    opkg install e2fsprogs
    mkfs.ext4 /dev/<your partition>



  • @Chris-MacKay I think I mentioned that somewhere in the prerequisite section.



  • @Josip-Mlakar Great tutorial works like a charm. It only seems that apache isn't autostarting after a boot. Any ways you have solved that one?



  • @Danny-van-der-Sluijs well I tried to make file named apache in /etc/init.d with content:

    #!/bin/sh /etc/rc.common
    START=95
    start() {
    	apachectl start
    }
    restart() {
    	apachectl restart
    }
    stop() {
    	apachectl stop
    }
    

    made it executable with chmod +x /etc/init.d/apache
    and then executed /etc/init.d/apache enable. It gets enabled and I can start it with /etc/init.d/apache startbut script doesen't start on boot šŸ˜ž I'll keep You updated if I find the solution:)



  • @Josip-Mlakar Unless I am much mistaken (I'm sure others will correct me if I am :-)) what you need is:

    • A symlink in /etc/rc.d named S95apache that references your /etc/init.d/apache file
      Files named like S<nn>Xxxx in /etc/rc.d are executed in order of the <nn> at system boot time as S<nn>Xxxx start thus starting the referenced file
      Files named like K<nn>Xxxx in /etc/rc.d are executed in order of the <nn> at system shutdown time as K<nn>Xxxx stop thus stopping the referenced file

    One small thing I would check though is your use of START=95 (and corresponding usage of 95 in S95apache and K95apache) - as far as I can see 95 is currently being used by /etc/init.d/done and /etc/rc.d/S95done and I am unsure about the effects of resuing the same number.



  • @Kit-Bishop Thank You for Your help, but /etc/init.d/apache enable creates symlink automatically. I also tried manual as you stated, but still no luck. Also tried to change START=95 into all kinds of numbers, but nothing works šŸ˜ž



Looks like your connection to Community was lost, please wait while we try to reconnect.