SmallNetBuilder Forums
Go Back   SmallNetBuilder Forums > Wireless Networking > ASUS Wireless > Asuswrt-Merlin

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-16-2014, 05:18 PM
Xerxist Xerxist is offline
Senior Member
 
Join Date: Aug 2013
Posts: 113
Thanks: 14
Thanked 38 Times in 20 Posts
Xerxist is just starting out
Default [HOWTO]Debian Weezy for AC68 and AC56 + OwnCloud

Debian Weezy for AC68/AC56 (ARM)

Preperation

Note: In this tutorial my mount point for the usb disk is /mnt/sda1 and can defer for you.
The easiest way to find out is to check when you create the share and what your disk is called there and replace "sda1" with what its called or run mount from the shell and check it there.


Have the Merlin firmware installed on your router.
Have a disk formatted in ext4 and attached to the router.
Have ssh shell running
Create a folder called "debian" and share it via Samba

Download the debian weezy environment and the chroot
https://www.dropbox.com/s/f8es9x1x6z...llbase-arm.tgz
https://www.dropbox.com/s/i2fdsb437x3sm1l/chroot

Put the debian-wheezy-fullbase-arm.tgz on the debian share
Create a folder in the "debian" share called "utils" and put the chroot in there.

Now go into the shell of the router

Extracting the debian environment
Code:
cd /mnt/sda1/debian
tar -xvzf ./debian-wheezy-fullbase-arm.tgz
Create the startup script so the mounts are set at every boot
Code:
cd /jffs/scripts
vi services-start
Add the following lines

Code:
#!/bin/sh
sleep 10
mount -o bind /dev/ /mnt/sda1/debian/dev/
mount -o bind /proc/ /mnt/sda1/debian/proc/
mount -o bind /sys/ /mnt/sda1/debian/sys/
Save the file

Make the script executable
Code:
chmod +x services-start
Make chroot executable
Code:
chmod +x  /mnt/sda1/debian/utils/chroot
Reboot the router

Now your debian enviroment is setup and you can get in via this command from the shell.
Code:
/mnt/sda1/debian/utils/chroot /mnt/sda1/debian /bin/bash
If you want to get back into the Asus shell environment just type exit

Package example to run from the Debian environment

OwnCloud 6

Go into the Debian environment from the shell.

Code:
/mnt/sda1/debian/utils/chroot /mnt/sda1/debian /bin/bash
Install the following packages
Code:
apt-get install bzip2
apt-get install wget
apt-get install php5-cgi
apt-get install sqlite
apt-get install lighttpd
apt-get install php5-sqlite
apt-get install php5-gd
apt-get install openssl
Adjust the memory usage of php adjust the following lines
Code:
nano /etc/php5/cgi/php.ini
upload_max_filesize = 4000M
post_max_size = 4000M
memory_limit = 16M
Get OwnCloud 6
Code:
cd /var/www
rm index.lighttpd.html
wget http://download.owncloud.org/community/owncloud-6.0.2.tar.bz2
bzip2 -cd owncloud-6.0.2.tar.bz2 | tar -xv
chown -R www-data:www-data /var/www/owncloud
rm owncloud-6.0.2.tar.bz2

Generate the ssl certificates
Code:
cd /etc/lighttpd
mkdir certs
cd certs
openssl req -new -x509 -keyout lighttpd.pem -out lighttpd.pem -days 365 -nodes
chmod 400 lighttpd.pem
Adjust lighttpd for Owncloud and php to work
Code:
cd /etc/lighttpd/
nano lighttpd.conf
Replace the config with the config below

Code:
server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
#       "mod_rewrite",
        "mod_fastcgi",
)

server.document-root        = "/var/www/owncloud"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 6897


index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
fastcgi.server = (
  ".php" =>
    ( "localhost" =>
      ( "socket" => "/tmp/php-fcgi.sock",
        "bin-path" => "/usr/bin/php5-cgi",
        "max-procs" => 1,
        "bin-environment" =>
          ( "PHP_FCGI_CHILDREN" => "2",
            "PHP_FCGI_MAX_REQUESTS" => "1000"
          )
        )
     )
 )

$HTTP["url"] =~ "^/data/" {
  url.access-deny = ("")
}

$HTTP["url"] =~ "^/($|/)" {
  dir-listing.activate = "disable"
}

$SERVER["socket"] == ":443" {
  ssl.engine = "enable" 
  ssl.pemfile = "/etc/lighttpd/certs/lighttpd.pem" 
}
Restart lighttpd
Code:
service lighttpd stop
service lighttpd start
For Email from OwnCloud
Code:
nano /var/www/owncloud/config/config.php
Add the following lines and adjust to your needs
Code:
'mail_smtpmode' => 'smtp',
'mail_smtphost' => 'yoursmtpserver',
'mail_smtpport' => 587,
'mail_smtpsecure' => 'tls',
'mail_smtpauth' => true,
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpname' => 'email@email.com',
'mail_smtppassword' => 'yourpassword',
'mail_smtptimeout' => 10,
Now open up your browser and goto https://yourroutersip

If you want to access OwnCloud also from the internet run the following command when you exit the Debian evironment.
Code:
iptables -I INPUT -p tcp --dport 443 -j ACCEPT
To make OwnCloud start automatically after a reboot
Code:
cd /jffs/scripts
vi services-start
Add the following lines
Code:
iptables -I INPUT -p tcp --dport 443 -j ACCEPT
/mnt/sda1/debian/utils/chroot /mnt/sda1/debian service lighttpd start
Reboot the router and in this case Owncloud (lighttpd) is started automatically after each reboot.

Extra note: If you have allot of pictures uploaded OwnCloud makes thumbnails and makes it very slow but you can disable that by disabling the thumbnail generation.

Add the following line to /var/www/owncloud/config/config.php in the Debian environment

Code:
'enable_previews' => false,
Because the router only has 256MB of ram it can be useful to have a swap file although it can be slow like on a normal computer when running out of memory.

If you want to use a swapfile you can do the following.

Create a swap file of 512MB

Goto a folder where you want to create a swap file (in this instance /mnt/sda1)

Code:
cd /mnt/sda1
dd if=/dev/zero of=swapfile bs=1024 count=524288
mkswap swapfile
chmod 0600 swapfile
Use the swapfile

Code:
swapon swapfile
If you want this at every boot

Code:
cd /jffs/scripts
vi services-start
add the following line

Code:
swapon /mnt/sda1/swapfile

Last edited by Xerxist; 03-26-2014 at 08:58 AM.
Reply With Quote
The Following 10 Users Say Thank You to Xerxist For This Useful Post:
  #2  
Old 02-16-2014, 06:00 PM
Ford Prefect's Avatar
Ford Prefect Ford Prefect is offline
Senior Member
 
Join Date: Jan 2014
Posts: 195
Thanks: 15
Thanked 28 Times in 26 Posts
Ford Prefect is just starting out
Default

...great stuff

I'd suggest to explain that the path to the ext4 disk "/dev/sda1" might vary, depending
on the individual user's hardware setup.
__________________
ASUS RT-AC68U (1.0.1.6) - Firmware: Merlin RT-AC68U-3.0.0.4.374.43_2-05j9527
!! don't panic !!
Reply With Quote
  #3  
Old 02-16-2014, 06:07 PM
Ford Prefect's Avatar
Ford Prefect Ford Prefect is offline
Senior Member
 
Join Date: Jan 2014
Posts: 195
Thanks: 15
Thanked 28 Times in 26 Posts
Ford Prefect is just starting out
Default

Quote:
Originally Posted by Xerxist View Post
Create the startup script so the mounts are set at every boot
Code:
cd /jffs/scripts
vi services-start
Add the following lines

Code:
mount -o bind /dev/ /mnt/sda1/debian/dev/
mount -o bind /proc/ /mnt/sda1/debian/proc/
mount -o bind /sys/ /mnt/sda1/debian/sys/
Save the file
...my USB disks are always mounted on "/tmp/mnt/<sdX>"....not "/mnt/<sdX>".

...and the script will require the shebang "#!/bin/sh" in the first line.
__________________
ASUS RT-AC68U (1.0.1.6) - Firmware: Merlin RT-AC68U-3.0.0.4.374.43_2-05j9527
!! don't panic !!

Last edited by Ford Prefect; 02-16-2014 at 06:12 PM.
Reply With Quote
The Following User Says Thank You to Ford Prefect For This Useful Post:
  #4  
Old 02-16-2014, 06:14 PM
Xerxist Xerxist is offline
Senior Member
 
Join Date: Aug 2013
Posts: 113
Thanks: 14
Thanked 38 Times in 20 Posts
Xerxist is just starting out
Default

Yes I've got the same with /tmp/mnt/sdX but /mnt/sdX works too must be a soft link or something like that.
Give it a try from the shell.

Yes I need to explain the mount point a bit better but not sure how yet. Allot of variables...

Thanks! adjusted the "#!/bin/sh"
Missed that one

Sent from my GT-I9505 using Tapatalk

Last edited by Xerxist; 02-16-2014 at 06:18 PM.
Reply With Quote
  #5  
Old 02-16-2014, 06:24 PM
Ford Prefect's Avatar
Ford Prefect Ford Prefect is offline
Senior Member
 
Join Date: Jan 2014
Posts: 195
Thanks: 15
Thanked 28 Times in 26 Posts
Ford Prefect is just starting out
Default

Quote:
Originally Posted by Xerxist View Post
Yes I've got the same with /tmp/mnt/sdX but /mnt/sdX works too must be a soft link or something like that.
Give it a try from the shell.
Ahh....ok.
Yes, it is a softlink indeed.
Code:
admin@RT-AC68U:/tmp/home/root# ls -la /
drwxr-xr-x   17 admin    root           320 Jan 31 06:52 .
drwxr-xr-x   17 admin    root           320 Jan 31 06:52 ..
drwxr-xr-x    2 admin    root           711 Jan 31 06:52 bin
drwxr-xr-x    2 admin    root             3 Jan 31 06:52 cifs1
drwxr-xr-x    2 admin    root             3 Jan 31 06:52 cifs2
drwxr-xr-x    6 admin    root          1800 Feb 14 23:55 dev
lrwxrwxrwx    1 admin    root             7 Jan 31 06:52 etc -> tmp/etc
lrwxrwxrwx    1 admin    root             8 Jan 31 06:52 home -> tmp/home
drwxr-xr-x    5 admin    root             0 Feb 15 10:19 jffs
drwxr-xr-x    3 admin    root           417 Jan 31 06:52 lib
lrwxrwxrwx    1 admin    root             9 Jan 31 06:52 media -> tmp/media
drwxr-xr-x    2 admin    root             3 Jan 31 06:52 mmc
lrwxrwxrwx    1 admin    root             7 Jan 31 06:52 mnt -> tmp/mnt
lrwxrwxrwx    1 admin    root             7 Jan 31 06:52 opt -> tmp/opt
dr-xr-xr-x   90 admin    root             0 Jan  1  1970 proc
drwxr-xr-x    6 admin    root           661 Jan 31 06:52 rom
lrwxrwxrwx    1 admin    root            13 Jan 31 06:52 root -> tmp/home/root
drwxr-xr-x    2 admin    root          1986 Jan 31 06:52 sbin
drwxr-xr-x   11 admin    root             0 Jan  1  1970 sys
drwxr-xr-x    2 admin    root             3 Jan 31 06:52 sysroot
drwxrwxrwx   11 admin    root           560 Feb 16 20:53 tmp
drwxr-xr-x    7 admin    root           126 Jan 31 06:52 usr
lrwxrwxrwx    1 admin    root             7 Jan 31 06:52 var -> tmp/var
drwxr-xr-x   11 admin    root          5667 Jan 31 06:52 www
__________________
ASUS RT-AC68U (1.0.1.6) - Firmware: Merlin RT-AC68U-3.0.0.4.374.43_2-05j9527
!! don't panic !!
Reply With Quote
  #6  
Old 02-16-2014, 08:21 PM
wmz0731 wmz0731 is offline
New Member
 
Join Date: Feb 2014
Posts: 14
Thanks: 14
Thanked 1 Time in 1 Post
wmz0731 is just starting out
Default

owncloud working perfect,thank you very much!
Reply With Quote
  #7  
Old 02-16-2014, 10:44 PM
r00t4rd3d's Avatar
r00t4rd3d r00t4rd3d is offline
Senior Member
 
Join Date: Jan 2014
Location: Toilet
Posts: 143
Thanks: 2
Thanked 31 Times in 26 Posts
r00t4rd3d is just starting out
Default

How is this an improvement over AiCloud or isnt that service available for these models?
__________________
Asus RT-N66U
Reply With Quote
  #8  
Old 02-17-2014, 03:16 AM
Xerxist Xerxist is offline
Senior Member
 
Join Date: Aug 2013
Posts: 113
Thanks: 14
Thanked 38 Times in 20 Posts
Xerxist is just starting out
Default

Quote:
Originally Posted by r00t4rd3d View Post
How is this an improvement over AiCloud or isnt that service available for these models?
Check the site for the features but some key ones.

Multi user
Dropbox a like clients
Android/ios clients

Also this is an example of what you could run.
Because the ARM based routers don't have entware you would need something like this to load other packages.
Choices are limetless with a full debian repository at your disposal.

Sent from my GT-I9505 using Tapatalk

Last edited by Xerxist; 02-17-2014 at 03:19 AM.
Reply With Quote
  #9  
Old 02-17-2014, 12:41 PM
redstone redstone is offline
New Member
 
Join Date: Feb 2014
Posts: 10
Thanks: 3
Thanked 0 Times in 0 Posts
redstone is just starting out
Default

Hi, great work!
But I have a question. When I tried to instal libc6, it showed
Code:
root@RT-AC68U:/dev# apt-get install libc6
Reading package lists... Done
Building dependency tree... Done
Suggested packages:
  glibc-doc locales
The following packages will be upgraded:
  libc6
1 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
Need to get 0 B/4201 kB of archives.
After this operation, 8192 B of additional disk space will be used.
sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
dpkg-preconfigure: unable to re-open stdin: No such file or directory
Can not write log, openpty() failed (/dev/pts not mounted?)
(Reading database ... 9511 files and directories currently installed.)
Preparing to replace libc6:armel 2.13-38 (using .../libc6_2.13-38+deb7u1_armel.deb) ...
sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
/var/lib/dpkg/tmp.ci/preinst: 10: /var/lib/dpkg/tmp.ci/preinst: cannot create /dev/null: Permission denied
/var/lib/dpkg/tmp.ci/preinst: 303: /var/lib/dpkg/tmp.ci/preinst: cannot create /dev/null: Permission denied
dpkg: error processing /var/cache/apt/archives/libc6_2.13-38+deb7u1_armel.deb (--unpack):
 subprocess new pre-installation script returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/libc6_2.13-38+deb7u1_armel.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@RT-AC68U:/dev#
Could you please help me with this?
Reply With Quote
  #10  
Old 02-17-2014, 01:49 PM
Xerxist Xerxist is offline
Senior Member
 
Join Date: Aug 2013
Posts: 113
Thanks: 14
Thanked 38 Times in 20 Posts
Xerxist is just starting out
Default

I just tried it on my install and works but got a couple of errors about /dev/pts not being mounted but installed fine.

From the log it seems you have allot of permission errors.
Did you extract the debian tar with all options from the shell or extracted from say winrar?

Also can you post the output when you run mount from the asus shell?

Sent from my GT-I9505 using Tapatalk

Last edited by Xerxist; 02-17-2014 at 02:20 PM.
Reply With Quote
Reply

Tags
debian, howto

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT -4. The time now is 06:15 PM.


Top 10 Stats
Top Posters* Top Thanked
RMerlin  361
john9527  117
L&LD  115
stevech  93
htismaqe  91
azazel1024  90
huotg01  85
jegesq  81
watusi  62
ColinTaylor  56
RMerlin  6408
john9527  508
stevech  358
ryzhov_al  298
TeHashX  263
L&LD  255
RogerSC  205
sinshiva  149
sfx2000  138
hggomes  131
Most Viewed Threads* Hottest Threads*
Old New AC68...  9818
Old Why not...  8767
Old ASUS RT-N66U...  6216
Old RT-AC66U...  3655
Old Why ASUS?  2499
Old NAS...  1920
Old Help Plz:...  1663
Old OpenVPN...  1607
Old Asus...  1549
Old Remote...  1515
Old Why not...  81
Old Remote...  46
Old New AC68...  36
Old Whats going...  31
Old ASUS RT-N66U...  26
Old RT-N66U...  26
Old The future...  26
Old Extension...  26
Old OpenVPN...  25
Old What are the...  25


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2006-2014 Pudai LLC All Rights Reserved.