In this post you can find instructions for preparing your system for ADOS installation.
Below you will find out how to configure:- IPKG system
- lighttpd server
- PHP
- cron
These instructions were originally written by Reyter. Down there is only English translation with minor changes.
---------------
Step 1. Configuring IPKG system.
First of all check which repository your IPKG uses. We will need an alternative repository.
So if you used other one here is a list of commands, which will help you easily migrate to the new repository (all packages will be uninstalled and then installed again, but configuration files (if there are any) will remain unchanged):
Code:
echo "src unslung http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable" > /opt/etc/ipkg.conf
echo "dest root /" >> /opt/etc/ipkg.conf
ipkg update && ipkg install uclibc-opt && awk '/^Package:/{system("ipkg install -force-reinstall -force-defaults " $2)}' /opt/lib/ipkg/status
If your IPKG is already configured for using an alternative repository, just skip everything above.
Step 2. Installing packages.
We will need these packages: cron, lighttpd, sqlite and php-fcgi.
Also we will need download engines that will be used by ADOS: cURL and Wget.
And these packages are optional but recommended: php-gd and php-mbstring.
The installation is very simple. Just execute this code in terminal:
Code:
ipkg update
ipkg install cron
ipkg install lighttpd
ipkg install sqlite
ipkg install php-fcgi
ipkg install libcurl
ipkg install wget
ipkg install php-gd
ipkg install php-mbstring
---------------
Step 3. Configuring lighttpd web server.
Now let’s edit configuration file of lighttpd.
Open /opt/etc/lighttpd/lighttpd.conf and uncomment (remove ‘#’ at the beginning) these strings:
Code:
"mod_access",
"mod_fastcgi",
"mod_cgi",
"mod_accesslog"
Set root directory (change value inside double quotes to written below):
Code:
server.document-root = "/opt/share/www/"
Assign port (you can choose any value that you prefer):
And finally set up fast-cgi (uncomment and edit strings as written below):
Code:
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"min-procs" => 1,
"max-procs" => 1,
"max-load-per-proc" => 4,
"socket" => "/tmp/php-fastcgi.socket",
"bin-path" => "/opt/bin/php-fcgi"
)
)
)
Save changes and close file.
---------------
Step 4. Configuring PHP.
We must enable some important extensions.
To do this, open file /opt/etc/php.ini and uncomment present strings and add missed ones:
Code:
extension=pdo.so
extension=sqlite.so
extension=pdo_sqlite.so
Save changes and close file.
---------------
Step 5. Configuring cron.
Open file /opt/etc/crontab and insert there these strings (if they are not already present):
Code:
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=""
HOME=/
# ---------- ---------- Default is Empty ---------- ---------- #
*/1 * * * * admin /opt/bin/run-parts /opt/etc/cron.1min
*/5 * * * * admin /opt/bin/run-parts /opt/etc/cron.5mins
01 * * * * admin /opt/bin/run-parts /opt/etc/cron.hourly
02 4 * * * admin /opt/bin/run-parts /opt/etc/cron.daily
22 4 * * 0 admin /opt/bin/run-parts /opt/etc/cron.weekly
42 4 1 * * admin /opt/bin/run-parts /opt/etc/cron.monthly
Note: Replace admin here with your login, if you changed the default one.
Save changes and close file.
Step 6. Making script to run cron tasks.
Make new file named /opt/bin/run-parts and insert there this code:
Code:
#!/bin/sh
#
# runparts.sh by macsat@macsat.com
# intended for use with cron
#
# based on rc.unslung by unslung guys :-)
#
if [ -z "$1" ]
then
echo "Usage : $0 "
fi
RUNDIR=$1"/*"
for i in $RUNDIR ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
Save and close file.
Now, make it executable. In the terminal execute command:
Code:
chmod +x /opt/bin/run-parts
Step 7. Making directories for cron scripts.
Now, we must make some new directories. Execute these commands in the terminal:
Code:
mkdir /opt/etc/cron.1min
mkdir /opt/etc/cron.5mins
mkdir /opt/etc/cron.hourly
mkdir /opt/etc/cron.daily
mkdir /opt/etc/cron.weekly
mkdir /opt/etc/cron.monthly
Scripts from directory /opt/etc/cron.1min will be executed every minute; scripts from directory /opt/etc/cron.5mins will be executed once in every 5 minutes; and so on. Just note this when you’ll be installing ADOS.
---------------
Step 8. [Optional] Running server and cron automatically after hard disk mounting.
If you want cron and lighttpd to start automatically just after you connect a USB cable, you must add these strings to your /usr/local/sbin/post-mount file:
Code:
#!/bin/sh
/opt/etc/init.d/S10cron
/opt/etc/init.d/S80lighttpd start
Note: Do not add the first string if it is already present in the file!
Save this file to flash and commit changes:
Code:
flashfs save && flashfs commit && flashfs enable
---------------
Congratulations, everything is done!
Now, let’s restart lighttpd to apply new configuration:
Code:
/opt/etc/init.d/S80lighttpd restart
That’s all. Now all packages should work fine and you’re ready to install ADOS.