Changes

How to forge a local file system server with IGEPv2 Board

17,633 bytes added, 13:47, 15 June 2015
no edit summary
=== Objectives ===
This project aims to create a local file system server using ARM Platform. It is very useful for this purpose for the next reasons:<br>
-*ARM is designed for low power consumption. This server should be connected to power supply all the day, if you use this architecture , you can save lower your electric bill. *ARM-Embedded is usually cheaper than a lot of moneyX86-Embedded processor. *If you have a good internet broadband connection, is not difficult to configure your server to accept external http requests. *Your data are 100% under your control, other services you don't know where are your files. *Commercial services offer premium accounts with extra hard disk space, in this project you can use all the space as your HD or SD supports.<br>
<br> When you finish this how-And ARM-Embedded is usually cheaper to, you will have your own local web service similar than a X86-Embedded processorDropbox and SugarSync. Your service will powered by [http://www.owncloud.org Owncloud.org] software. I used for this tutorial Owncloud 3 alpha 1 release to prove all new characteristics, but you can follow this tutorial using the stable version, there characteristics are: File management, WebDAV access, sharing, music streaming, calendar, contacts, users &amp; groups, image gallery, online text editor, online task manager and bookmarks. For more information go to [http://www.owncloud.org Owncloud.org] page.<br>
=== Limitations === When you finish i finished this tutorialproject, i tested the system performance making some tests. After this i did the next conclusions:  *If you will have your own local web service similar upload a folder with more than Dropbox and SugarSync. I used Owncloud 3 alpha 1 release to prove all new platform <span lang="en-GB">characteristics100 files, but i recommend that you can follow this tutorial using compress it before the stable versionupload. *Don't compress via Web a folder large than 100 MB, use WebDAV for download it. *Don't upload more than 750 MB via Web, there characteristics are:</span>use WebDAV for this purpose.<br> File management, WebDAV access, sharing, music streaming, calendar, contacts, users &amp; groups*The Web uses HTML5 technology, image galleryit tested with Firefox 7, online text editor, online task manager Google Chrome 14 browser and bookmarksmobile phone with IOS 4.3.3.<br>For more information go to Older browsers maybe have problems. = Hardware Used = The hardware used for this project is:  *[httphttps://www.owncloudisee.biz/products/igep-processor-boards/igepv2-dm3730 IGEPv2 Board]*5 V power supply. *MicroSD card 2GB at least with SD card adapter.org Owncloud*IGEPv2 Serial Debug cable (it isn't necessary later). *Ethernet cable. *Switch or Router.<br> *External USB Hard Disk with USB&nbsp;cable.org]<br>
Under Construction= Software Used =
I used the following software:  *[http://releases.linaro.org/platform/linaro-m/headless/final/linaro-m-headless-tar-20101108-2.tar.gz Linaro Headless] *[http://gparted.sourceforge.net/ Gparted] *[http://downloads.isee.biz/pub/releases/IGEP_xloader/igep-x-loader-2.4.0-2.tar.bz2 igep-x-loader-2.4.0-2.tar.bz2] *[http://software.opensuse.org/download/package?project=isv:ownCloud:community&package=owncloud Owncloud software] *[http://labs.igep.es/index.php/Linux_Kernel_2.6.35.y Kernel 2.6.35.y] *[http://en.wikipedia.org/wiki/LAMP_%28software_bundle%29 LAMP] *[http://www.openssh.com/ OpenSSH Server]'''NOTE:''' Tested using Owncloud version 2 = Limitations Installing Linaro Headless === Use this [http://labs.igep.es/index.php/How_to_boot_from_MicroSD_Card tutorial](microSD) and this [http://labs.igep.es/index.php/The_IGEP_X-loader other](IGEPxloader) to install Linaro Headless in your SD card. It runs well with the software detailed above.&nbsp; You can compile the IGEPxloader and Kernel, but is not necessary.  '''NOTE: '''Use FAT16 for boot partition and EXT3 for rootfs partition.
Under constructionCreate a new plan text file into the boot partition named igep.ini with these content and save it. <pre>[kernel]; Kernel load address, NOT Modifykaddress=0x80008000; RAM disk load Address, NOT Modify;rdaddress=0x84000000; Board Serial IDserial.low=00000001serial.high=00000000; Board Revisionrevision=0003; Kernel Image NamekImageName=zImage; Kernel RAM Disk Image Name;kRdImageName=initrd.img-2.6.35-1010-linaro-omapMachineID=2344; Where Machine ID = 2344 for IGEPv2 and ID = 2717 for IGEP Module [kparams];buddy=igep0022;buddy=base0010; Setup the Kernel console paramsconsole=ttyS2,115200n8; Enable early printk;earlyprintk=serial,ttyS2,115200; Setup the Board Memory Configuration;mem=430Mmem=512M; Setup the Boot Delayboot_delay=0; Setup the ARM Processor Speed;mpurate=800; Setup the loglevel;loglevel=7; Enable Kernel Debug Output;debug=1; Fix RTC Variable;fixrtc=1; Configure nocompcache variablenocompcache=1; Configure Frame Buffer Configuration;omapfb.mode=dvi:1280x720MR-16@60;omapfb.mode=dvi:hd720-16@60; Configure Video Ram assignedvram=40M; Configure Video RAM assigned to every frame bufferomapfb.vram=0:12M,1:16M,2:12M; Configure frame buffer debug output;omapfb.debug=1; Configure DSS Video Debug option;omapdss.debug=1; Configure the Board Ethernet Mac Addresssmsc911x.mac=0xb2,0xb1,0x1f,0xb5,0xcd,0xdf; --- Configure UBI FS boot --- ;ubi.mtd=2 ;root=ubi0:igep0020-rootfs ;rootfstype=ubifs; --- Configure NFS boot --- ;ip=192.168.2.123:192.168.2.129:192.168.2.1:255.255.255.0::eth0:;root=/dev/nfs;nfsroot=192.168.2.129:/srv/nfs/igep_rootfs; --- Configure MMC boot --- root=/dev/mmcblk0p2 rw rootwait; Assign Init program;init=/bin/bash</pre> NOTE: Check MAC address is not used for avoid conflicts.<br>
= Hardware Used Set up internet connection =
Under constructionLogin as root via serie, and use "vi" editor to add the following lines to<span class="st"> the bottom of </span>/etc/network/interfaces <pre>auto eth0iface eth0 inet dhcp</pre> NOTE: Some routers give a static IP&nbsp;via Dhcp identifying the MAC&nbsp;address, others give a free IP when we send Dhcp request. Also you can configure /etc/network/interfaces to get a static IP with the following lines: <pre>auto eth0iface eth0 inet staticaddress &lt;type your address&gt;netmask &lt;normally: 255.255.255.0&gt;gateway &lt;where send Dhcp request&gt;</pre> Save changes and restart the system with via "reboot" command. <br> After reboot, if you don't know private ip of your server, find it typing: <pre>ifconfig</pre> Search in eth0: "inet addr:X.X.X.X", where X.X.X.X is the private IP server.
= Software Used =Test your server connection sending a ping request: <pre>ping X.X.X.X </pre> After this, upgrade your system via "apt-get".
Under construction= Installing Open SSH Server =
= Installing Linaro Headless =Login as root via serie, type: <pre>apt-get install openssh-server</pre> Change root password typing:<br> <pre>passwd root</pre> Enter new password, i recommend use letters, numbers and symbols like:?¿!...
Under constructionSearch in eth0: inet addr:X.X.X.X, where X.X.X.X is the server private IP. We are going to prove it login as root via ssh: <pre>ssh root@X.X.X.X</pre> Now we be able to connect to server via SSH, using the password typed above.
= Set up internet connection =The next steps are not necessary use serial communication .
Under construction= Creating and editing Server Users =
= Creating Using root user can be dangerous, for this reason we are going to create a new user named adminserver to access server. Create new user typing:<br> <pre>adduser adminserverThe next steps are not necessary use serial communication . </pre> Follow the assistant entering a password and editing Server Users =your user data.
Under constructionOnce adminserver user was create, we are going to give sudoers privileges. Type: <pre>visudo</pre> Go to: # User privilege specification, and add below: <br> <pre>adminserver ALL=(ALL) ALL
Defaults:adminserver timestamp_timeout= Installing Open SSH Server 0, runaspw, passwd_tries=1</pre> The first line says that adminserver user can access like root with sudo command.
Under constructionThe second line, configure some paremetres to adminserver sudo access: adminserver needs root's password to run sudo (runaspw), the password will not be remembered (timestamp_timeout) and he gets only one chance to enter it (passwd_tries).<br>NOTE: Is important use visudo editor because it can detect spelling errors before write sudoers file.<br>
= Installing LAMP =
=== Apache ===
Under construction The Apache HTTP Server is an open-source HTTP server for modern operating systems including UNIX, Microsoft Windows, Mac OS/X and Netware.  We are going to install it: <pre>sudo apt-get install apache2 apache2-mpm-prefork</pre> After installation, we are going to make some configurations: <pre>mkdir /home/adminserver/web/</pre> We create that folder called web to store all the web files.  Now we are going to change some basic Apache configuration, edit: /etc/apache2/sites-available/default  Search line: <pre>DocumentRoot /var/www/</pre> Replace by: <pre>DocumentRoot /home/&lt;user&gt;/web/</pre> DocumentRoot is the root folder that contains our web pages.  Search line: <pre>Directory /var/www/ Options Indexes FollowSymLinks MultiViews</pre> Replace by: <pre>Directory /home/&lt;user&gt;/web/  Options FollowSymLinks</pre> For security reasons, we are going to hide our files and folders.  Search line: <pre>AllowOverride None</pre> Replace by: <pre>AllowOverride all</pre> Allows a file .htaccess to override the options for the respective directory  Save and exit.  Add the following lines to the bottom of /etc/apache2/apache2.conf <pre>ServerSignature OffServerTokens Prod</pre> For security reasons, this lines hide the version of Apache and Linux Distro.  Restart Apache: <pre>sudo /etc/init.d/apache2 restart</pre> Now we have a Apache with basic improved configuration.<br>  === PHP === Now we are going to install, the required packages to run Owncloud, if you want to install more Webs like Wordpress, Joomla, etc. Maybe you need install others. Type: <pre>sudo apt-get install php5 php5-sqlite php5-common</pre> Restart Apache: <pre>sudo /etc/init.d/apache2 restart</pre> === MySQL + PHPmyAdmin ===<pre>sudo apt-get install mysql-server mysql-client phpmyadmin</pre> When we are installing MySQL, we configure it entering password for root MySQL database. Also when we are installing phpmyadmin we should choose: configure database for phpmyadmin with dbconfig-common, type root MySQL password again,&nbsp; type phpmyadmin password database and choose apache2 confiuration .<br>  Restart Apache: <pre>sudo /etc/init.d/apache2 restart</pre> Make a simbolic link to phpmyadmin:<br> <pre>sudo ln -s /usr/share/phpmyadmin /home/adminserver/web/phpmyadmin</pre> With phpmyadmin you can handle your mysql databases (managing databases, tables, fields, relations, indexes, users, permissions, etc) via web browser. It is useful for Owncloud or another program than uses MySQL.<br>  = Enabling Automatic Updates =
Automatic updates can be used to automatically install updated packages. You can configure it to update all packages or just security packages. Install the following package:<br> <pre>sudo apt-get install unattended-upgrades</pre> To configure <span class=== PHP ==="application">unattended-upgrades</span>, edit:/etc/apt/apt.conf.d/50unattended-upgrades and adjust the following to fit your needs: <br>
Under constructionThe double “//” serve as comments, so whatever follows "//" will not be evaluated. Coment/uncoment the repositoris that you prefe, i recommend this configuration: <pre>Unattended-Upgrade::Allowed-Origins { "${distro_id} stable"; "${distro_id} ${distro_codename}-security";// "${distro_id} ${distro_codename}-updates";// "${distro_id} ${distro_codename}-proposed-updates";};</pre> You can blacklisted some packeges, you can enable automatic removes, autoremove orphans packages,etc.
=== MySQL ===To set everything first create a file: /etc/apt/apt.conf.d/10periodic and edit it with your favorite editor, my configuration is: <pre>APT::Periodic::Update-Package-Lists "1";APT::Periodic::Download-Upgradeable-Packages "1";APT::Periodic::AutocleanInterval "7";APT::Periodic::Unattended-Upgrade "1";</pre> The above configuration updates the package list, downloads, and installs available upgrades every day. The local download archive is cleaned every week.
Under construction For more information go to [https://help.ubuntu.com/12.04/serverguide/automatic-updates.html here.]
=== PHPmyAdmin Set up a External HD ===
Under constructionExternal HD is useful to get more space for our project. In this part we are going to set up our HD when it is connected to server.
= Enabling Automatic Updates =Format your HD with a EXT3 Filesystem.
Under constructionCreate the following script: /etc/udev/rules.d/50-mount-external.rules, and paste this: <pre>KERNEL!= "sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
# Import FS infosIMPORT{program}= Set up a External HD ="/sbin/blkid -o udev -p&nbsp;%N"
Under construction# Get a label if present, otherwise specify oneENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k" # Global mount optionsACTION=="add", ENV{mount_options}="relatime"# Filesystem-specific mount optionsACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002" # Mount the deviceACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}" # Clean up after removalACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}" # ExitLABEL="media_by_label_auto_mount_end"</pre> Stop/start the udev deamon: <pre>/etc/init.d/udev stop/etc/init.d/udev start</pre> Connect your HD to server. Use "mount" command to see External HD information. <pre>/dev/root on / type ext3 (rw)none on /proc type proc (rw,noexec,nosuid,nodev)none on /sys type sysfs (rw,noexec,nosuid,nodev)none on /sys/kernel/debug type debugfs (rw)none on /dev type tmpfs (rw,mode=0755)none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)none on /dev/shm type tmpfs (rw,nosuid,nodev)none on /var/run type tmpfs (rw,nosuid,mode=0755)none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)/dev/sda1 on /media/usbhd-sda1 type ext3 (rw,relatime)</pre> Where our HD isi mounted in media folder, and its name is u"sbhd-sda1"
= Set up Owncloud.org Software =
=== Installing Owncloud.org ===
Under construction Owncloud software need some extra packages:<br>
=== Configuring For improved scanning of music files: <pre>sudo apt-get install mp3info</pre> For downloading multiple files: <pre>sudo apt-get install zip</pre> For the OpenID plugin <pre>sudo apt-get install curl libcurl3 libcurl3-dev php5-curl</pre> This how-to uses the lastest release of Ownlcoud but if you use stable version it would be similar. Download Owncloudin your root Apache folder. <pre>sudo apt-get install wgetcd /home/adminserver/web/wget http://gitorious.org ===/owncloud/owncloud/archive-tarball/master</pre> Uncompres it: <pre>tar -zxvf master</pre> Make Root file folder in External HD: <pre>cd /media/usbhd-sda1sudo mkdir DATAsudo chown -R www-data:www-data DATA</pre> Make ownCloud directory accessible to Apache: <pre>cd /home/adminserver/web/sudo chown -R www-data:www-data owncloud-owncloud/
Under construction</pre> The estable version, the folder is named owncloud. [[Image:Previewowncloudinstallation1.png|right|331px]]  Open your web browser and finish your Owncloud installation. Go to: http://&lt;IP PRIVATE SERVER&gt;/owncloud-owncloud/ Put your personal information and select MySQL Database. once finish, click Finish Setup. <br><br><br><br><br><br><br>
=== Configuring Apache and PHP for Owncloud ===
Under constructionPHP and Apache have a standard configuration, we need to change it to improve performance&nbsp; of our project and server.<br>  Edit &lt;span style="font-family: monospace;" /&gt;/etc/apache2/apache2.conf <pre>LockFile ${APACHE_LOCK_DIR}/accept.lockPidFile ${APACHE_PID_FILE}Timeout 700KeepAlive OnMaxKeepAliveRequests 500KeepAliveTimeout 600&lt;IfModule mpm_prefork_module&gt; StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 10 MaxRequestsPerChild 0&lt;/IfModule&gt;&lt;IfModule mpm_worker_module&gt; StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxClients 10 MaxRequestsPerChild 0&lt;/IfModule&gt;&lt;IfModule mpm_event_module&gt; StartServers 2 MaxClients 10 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxRequestsPerChild 0&lt;/IfModule&gt;User ${APACHE_RUN_USER}Group ${APACHE_RUN_GROUP}AccessFileName .htaccess&lt;Files ~ "^\.ht"&gt; Order allow,deny Deny from all Satisfy all&lt;/Files&gt;DefaultType text/plainHostnameLookups OffErrorLog ${APACHE_LOG_DIR}/error.logLogLevel warnInclude mods-enabled/*.loadInclude mods-enabled/*.confInclude httpd.confInclude ports.confLogFormat "%v:%p&nbsp;%h&nbsp;%l&nbsp;%u&nbsp;%t \"%r\"&nbsp;%&gt;s&nbsp;%O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combinedLogFormat "%h&nbsp;%l&nbsp;%u&nbsp;%t \"%r\"&nbsp;%&gt;s&nbsp;%O \"%{Referer}i\" \"%{User-Agent}i\"" combinedLogFormat "%h&nbsp;%l&nbsp;%u&nbsp;%t \"%r\"&nbsp;%&gt;s&nbsp;%O" commonLogFormat "%{Referer}i -&gt;&nbsp;%U" refererLogFormat "%{User-agent}i" agentInclude conf.d/Include sites-enabled/ServerSignature OffServerTokens Prod</pre> I reduce the number of clients and increased the persistent connection time.  Edit: /etc/php5/apache2/php.ini.<br> <pre>max_file_uploads = 20 max_file_uploads = 100upload_max_filesize = 2M upload_max_filesize = 750Mpost_max_size = 8M post_max_size = 800Mdefault_socket_timeout = 60 default_socket_timeout = 600max_execution_time = 30 max_execution_time = 500max_input_time = 60 max_input_time = 600memory_limit = 128M memory_limit = 1025Mmysql.connect_timeout = 60 mysql.connect_timeout = 600</pre> I configure it for a local connection.  Edit Owncloud .htaccess and erase the following lines: <pre>php_value upload_max_filesize 512Mphp_value post_max_size 512M</pre> Now .htacces don't limit the upload filesize and post size.  Restart Apache service: <pre>sudo /etc/init.d/apache2 restart</pre> === Configuring WebDAV for Owncloud === Owncloud development team are creating a native client to manage files more easyly, but is not release yet. Although we can set up a WebDAV protocol to solve it. I tested with a Ubuntu 10.04 laptop, but can be use in other paltforms, see this [http://owncloud.org/use/webdav/ page] for more information.<br>  Install the WebDAV support: <pre>sudo apt-get install davfs2</pre> Reconfigure davfs2 to allow access to normal users: <pre>&lt;code&gt;sudo dpkg-reconfigure davfs2&lt;/code&gt;</pre> Select ''Yes'' when prompted  Add the users you want to be able to mount the share to the <code></code>davfs2 group: <pre>sudo usermod -aG davfs2 &lt;userclient&gt;</pre> Edit /etc/fstab, and add the following line for each user who wants to mount the folder (with your details where appropriate) <pre>http://&lt;IPPRIVATE&gt;/owncloud-owncloud/files/webdav.php /home/&lt;username&gt;/owncloud davfs user,rw,noauto 0 0</pre> Create the folders owncloud &amp; .davfs2 in your home directory Create the file named secrets inside .davfs2 folder, fill it with the following (with your credentials where appropriate) <pre>http://&lt;IPPRIVATE&gt;/owncloud-owncloud/files/webdav.php &lt;yourowncloudusername&gt; &lt;yourowncloudpassword&gt;</pre> Ensure the file is only writable by you either through the file manager: <pre>chmod 600 ~/.davfs2/secrets</pre> Mount your Virtual Owncloud Hardrive with the command: mount ~/owncloud You can automatically mount the folder on login, add the last command to ~/.bashrc  [[Category:Tutorials]]
0
edits