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/f8es9x1x6zuekgm/debian-wheezy-fullbase-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
Create the startup script so the mounts are set at every boot
Add the following lines
Save the file
Make the script executable
Make chroot executable
Reboot the router
Now your debian enviroment is setup and you can get in via this command from the shell.
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.
Install the following packages
Adjust the memory usage of php adjust the following lines
Get OwnCloud 6
Generate the ssl certificates
Adjust lighttpd for Owncloud and php to work
Replace the config with the config below
Restart lighttpd
For Email from OwnCloud
Add the following lines and adjust to your needs
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.
To make OwnCloud start automatically after a reboot
Add the following lines
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
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)
Use the swapfile
If you want this at every boot
add the following line
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/f8es9x1x6zuekgm/debian-wheezy-fullbase-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: