Installing ownCloud and PageKite into a Supercharged IBM OS/2 Operating System
In 1696, 175 years after the 1521 invasion of Tenochtitlan (modern Mexico), king Charles II of Spain made a decree banning the use of Nahuatl, Mexico's own language par excellence, throughout the so-called Spanish Empire. Today Spanish continues to be the dialect spoken in Mexico and the country is ruled by pro-Iberian monarchy colonizers whose allegiance is to Spain. Notwithstanding, unable to match the level of civilization their Iberian forefathers destroyed, modern rulers of Mexico exploit its human and natural resources and capitalize on tourists whom are attracted by the art and architecture created by the ancestors of the surviving native inhabitants --the real Mexicans now marginalized and living in extreme poverty in their own land. But "that One who walks shining like fire", Nanahuatzin, is rising and has begun to shine once again above the clouds.
I will show how an OS/2 lone cuetlachtli (wolf) consultant --or team member working in an environment where OS/2 is a component-- may deploy ownCloud -- a cloud that can be accessed via web interface or WebDAV. You may extend your ownCloud with Python-based PageKite "view & sync your contacts, calendars and bookmarks across all your devices and enables basic editing right on the web." OwnCloud is part of KDE open source cloud project that, unlike other cloud offerings out in the market, is totally under the user's control since it runs in his/her own hardware. Accordingly, implementing ownCloud is more like creating your own private cloud which maximum dimension depends on the quantity of single or distributed resources allocated.
The beauty of ownCloud is that it only requires the Apache web server, PHP 5, and Oracle's MySQL -- or alternatively Monty's MariaDB or SQLite database. Most of these components of LAMP stack have been ported to OS/2 by Paul Smedley, who updates them on a regular basis. If you use his software, kindly make a donation so that he may continue his work.
OS/2 background from the Verne theme of GNU/Linux Fedora 16
Operations will be done with respect to OS/2 drive W:; accordingly we create a workspace directory where to download all the required components.
MKDIR W:\workspace
As in the last post (yes it's been a while ) I assume that you can expand (on the command line or via a GUI interface) files downloaded in compressed ZIP, TAR, and bzip2 format. You can use the limited PKWARE self-executable utility from Hobbes to yield pkzip.exe or you can download Smedley's InfoZip; you will also need the tape archive utility, TAR, from Smedley (needs libc063.dll) and bzip2; the latter needs gcc445.dll in addition to libc063.dll above discussed.
After you have the tools above you may begin downloading the LAMP stack components that will be required for your ownCloud:
NOTE: In PHP 5.3 there was an issue for several months that forced an user to return to PHP 5.2; however in 2011-09-22 build release modphp5.dll has been fixed and you can run PHP 5.3 with no issues.
Optional (only if you don't have file extractors):
Alternatively, you may download Metzlti-EMX.OS2, a small self-executable EMX environment, I make available without any warranty, that you can execute at the root of your OS/2 workspace drive:
Metzlti-EMX.OS2 /dir
It will create a couple of directories, EMX and OS2; under the latter one you will only find myEMX.cmd. Execute it by running it once and your EMX environment will be relative to the drive where you extracted resources.
Thus, these resources are what I have collected under W:\Workspace:
Setting up necessary dynamic link libraries DLL
Assuming that drive W: is also our OS/2 root drive, we proceed to decompress the supporting DLLs into a PATH referenced by OS/2's LIBPATH environment variable. Accordingly I use pkzip.exe to decompress and simultaneously place appropriately the required DLLs:
pkzip /extr libc-0.6.3-csd3.zip w:\os2\dll\
pkzip /extr gcc434.zip w:\os2\dll\
pkzip /extr gcc453.zip w:\os2\dll\
Setting up MySQL v5.1.59
We extract MySQL to the root of drive W:, which we specify relatively as \. to our extractor:
pkzip /extr /dir mysql-5.1.59-os2-20110921.zip \.
CD \mysql51
Examining the decompressed MySQL resources and reading the README.OS2, we see that there is no mysql_sample_database.zip to decompress here. It would be fine if you are upgrading your database, but not if this is a first install. For the latter case, we may get the resource from a previous release. In this case, since I'm creating a new installation, I got the sample database from older MySQLv5.1.56 release. Subsequently we extract it:
pkzip /extr /dir mysql_sample_database.zip
After the data directory is extracted, let's start mysqld.exe by:
CD bin
START mysqld
Verifying that it starts similar to as shown above, we proceed to log in a root:
mysql -u root
remove (drop) the test database and create ownclouddb database as well as create our typical user xiuhtecuhtli to whom we (as root) grant all rights on the database created.
Note: if you will be exposing your OS/2 ownCloud, or any other resources, to the wild of the Internet with PageKite, make sure to read local/online MySQL documentation and set a strong root and user(s) password to prevent a cracker (p)owning your resources.
Decompressing the Apache httpd Web Server and Setting up PHP 5.3.8
First we decompress Apache web server:
pkzip /extr /dir httpd-2.2.21-os2-20110921.zip \.
We need a PHP 5 initialization file, php.ini, that does not come in the resource that we will expand subsequently. The php.ini file that I make available comes from a Debian Wheezy GNU/Linux distribution.
Please supply your own php.ini file or download the one referenced above into your \MPTN\ETC relative to the root of your OS/2 installation. And decompress the PHP 5 resorce:
pkzip /extr /dir php-5.3.8-os2-20110922.zip \.
and change your location to the newly created directory:
CD \PHP5
Please read the README.OS2 file and operate on the Apache2 module:
[W:\php5]move apache2\modphp5.dll \apache2\modules\.
Now we edit the php.ini file that was placed under our OS/2 root [drive letter]:\MPTN\ETC\ where below I assume to be W:
EPM W:\MPTN\ETC\php.ini
After line 809, I add directive:
extension_dir = "/php5/modules"
And just after line 934, in the section "Dynamic Extensions" I add the following directives:
extension=mysql.dll
extension=gd.dll
extension=mbstring.dll
extension=curl.dll
extension=sqlite.dll
And that's it! We are ready to start up our fresh install of PHP 5:
START php.exe
And another OS/2 window will instantiate with no verbose output except a blinking underscore. Here is a snapshot of MySQL and PHP 5 daemon in executing concurrently:
Extracting ownCloud and Setting Up Apache httpd Web Server
Now we change our location to Apache httpd server:
CD W:\APACHE2
at this location we expand the bzip2 compressed archive into a TAR archive with the command:
bzip2 -dk ..\workspace\owncloud-2.0.1.tar.bz2
it will yield the file without the .bz2 extension:
..\workspace\owncloud-2.0.1.tar
And we proceed to unTAR the archive at our current location:
tar -xvPf ..\workspace\owncloud-2.0.1.tar
the result will be a owncloud directory which absolute path relative to our drive will be W:\apache2\owncloud
When setting up PHP 5, we moved modphp5.dll the Apache modules directory. Please verify the existence of the referenced file in the modules\. directory.
Now we will be operating in the conf directory relative to our current position. We do:
DIR conf
to get a list of its contents and proceed to obtain an Apache httpd configuration conf\httpd.conf by manipulating the relevant content as:
MOVE conf\httpd.conf conf\httpd.conf.Original
to save a copy of the original; and we immediately create another as:
MOVE conf\httpd.conf.sample conf\httpd.conf
Subsequently, we edit the file with OS/2's EPM text editor:
EPM conf\httpd.con
At the end of the loadable modules listed in the "Dynamic Shared Object (DSO) Support" section, I add the directive:
LoadModule php5_module modules/modphp5.dll
Remember, the file given as the last argument in the directive above must exist.
You may also want to enable the rewrite_module, listed earlier in the resource, by removing the initial comment hash (#) from the beginning of the directive
LoadModule rewrite_module modules/rewrite.dll
Further down the file, we will operate on the DocumentRoot directive, changing it to reflect our recently created owncloud directory instead of the htdocs default.
DocumentRoot "/apache2/owncloud"
Additionally, after the guidance: # This should be changed to whatever you set DocumentRoot to.
make sure to place within the brackets the directive:
Directory "/apache2/owncloud"
Now after the guidance that states: # DirectoryIndex: sets the file that Apache will serve if a directory is requested.
make sure to add (next to index.html) the directive index.php; else your visitors will have to manually append that directive to the root directory into their browsers --they should never be bothered to do that
Finally, we scroll to the end of conf/httpd.conf and add the following PHP directives:
ScriptAlias /php5/ "/php5"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php5/php.exe"
We save our modifications and close conf/httpd.conf
Oh one last edit. Make a copy of startup.cmd found in your current file system location:
COPY startup.cmd startup.cmdOrig
and open the file in OS/2's EPM editor:
EPM startup.cmd
since we want to observe any potential errors to be shown, only leave the following directives:
set beginlibpath=w:\apache2\bin;w:\apache2\modules;
bin\httpd -d .
Notice that I have modified the default u: drive to reflect w: --which is the drive where Apache2 is installed. Additionally, notice that the dot (.) must not be removed.
Here I marked the deletions to startup.cmd
Again save the modifications and close startup.cmd; we just need to create a test file to verify that once we start our Apache2 web server, it will work harmoniously with PHP (already executing concurrently with MySQL).
Relative to our current location, do:
EPM owncloud\info.php
And write the following directive into it:
<? phpinfo(); ?>
Save and close info.php; we are ready to spark Apache2:
START startup.cmd
Point your browser to http://localhost/info.php and, after a couple of seconds, a page similar to the screenshot below will emerge.
Cool! We are ready to begin installation of owncloud
Installing OwnCloud Into Our OS/2-Hosted Apache Web Server
Well, user xiuhtecuhtli, who was granted all rights on MySQL database ownclouddb created by root user of MySQL, will install owncloud by pointing his browser at http://localhost and receives similar to the following notice:
Data directory (W:/apache2/owncloud/data) is readable for other users
Please change the permissions to 0770 so that the directory cannot be listed by other users.
Well, OS/2 can only implement limited UNIX/Linux functions and apparently the only way around this issue is to delete the owncloud\data directory as owncloud installation routine will allow you to recreate it as it proceeds. We will create a directory outside of Apache so that our owncloud data may not be exposed to those who do not have a right to access it.
Hence xiuhtecuhtli removes the the directory:
RMDIR owncloud\data
creates another directory outside Apache:
MKDIR \secret
and another one:
MKDIR \secret\ownclowd
Xiuhtecuhtli once again points Firefox at http://localhost again:
This time the installation routine proceeds and presents several fields to be filled. Some of those are exposed after selecting appropriate buttons.
And Xiuhtecuhtli fills the relevant fields; note how he manually specifies the owncloud/data outside of Apache web server.
Xiuhtecuhtli is presented with a bare ownCloud container, ready to accept data.
In the new folder field Xiuhtecuhtli enters MP3s and after pressing Enter, the folder is created and appears below.
An user can upload files, like pictures and *.mp3s which may be shared or accessed locally from different points. And once one understands ownCloud principles, an user may want to extend them online with pagekite -- which we will discuss later.
One should remember that ownCloud is at an early state of development and that issues are bound to be experienced. But continuing our exploration, selecting Apps from the lower left corner we can enable or disable them.
Selecting Users the administrator is able to add more users and create groups to organize the use of his/her environment.
And from the (administrator) Personal tab, again at the bottom and to the left, the time zone may be set as well as the hour format.
And there is a calendar app enabled as well that reminded me of my eyeOS.org experiments. With the exception of the description of an event, the calendar performs its routine.
Installing Python 2.6.4
We change our directory location:
CD \WORKSPACE
and extract the Python 2.6.4 archive to the root W: drive:
pkzip /extr /dir python-2.6.4-os2-20100126.zip \.
Please read the README.OS2 file for general setup instructions.
Subsequently, we may move python26.dll to our root [OS/2 drive]:\OS2\DLL\.
MOVE \python26\python26.dll \os2\dll\.
Then we rename python2.6.exe to python.exe as:
MOVE \python26\bin\python2.6.exe \python26\bin\python.exe
We will prepend location of python.exe to OS/2's PATH environment variable in either of two forms.
Either we set the following environment variables in the OS/2 CONFIG.SYS or place them in a file that we may call myWPython26.cmd and can create in our root [OS/2 drive]:\OS2\. as well -- to be invoked when Python support is required:
PATH w:/python26/bin;%PATH%
SET PYTHONHOME=w:/python26
SET PYTHONPATH=w:/python26/Lib;w:/python26/Lib/plat-os2knix;w:/python26/Lib/lib-dynload;w:/python26/Lib/site-packages;
(PYTHONPATH all on a single line without breaks)
PageKite Enables an OS/2-Hosted ownCloud to Make its Resources Available Online
As virtualization has enabled other operating systems to participate in the cloud, OS/2 hosting solutions are scarce and not very cost effective. It is precisely due to a lack of a sufficiently skilled pool of developers ---and IBM's refusal to open source the code-- that OS/2 has had no penetration into cloud services.
This is where PageKite shines as a complement to ownCloud. These components enable an individual OS/2 die hard or an OS/2 team to share resources and collaborate more richly online like any other supported operating system.
Now that I've shown that OS/2 may participate locally in an infrastructure supporting cloud services, I will show how to expand ownCloud on OS/2 to offer its services globally online via PageKite. Simply place the pagekite.py Python file into the bin directory of your Python 2.6.4 installation:
COPY pagekit.py \python26\bin\.
and, assuming that you have set your Python 2.6.4 required environment either in your OS/2 CONFIG.SYS or in an invocable file placed in OS/2's executable path, simply type:
pagekit.py
SYS0191: w:/python26/bin\pagekite.py cannot be run in an OS/2 session.
...apparently an OS/2 command line session is alien to pagekite.py and refuses to execute. On the other hand, executing the EMX mini-environment encapsulated in Metzlti-EMX.OS2 with the public domain Korn Shell is adequate to satisfy pagekite.py.
I've not tested pagekite.py with ash.exe nor with bash.exe OS/2 ports, I've only done so with ksh.exe which is included in Metzlti-EMX.OS2 and that is what I execute now:
ksh.exe
and invoke again:
pagekit.py
and voila!
Well it works, now lets try it passing Apache web server port 80 and my OS/2 hostname as arguments to service at pagekite.me:
pagekite.py 80 mixtecatl.pagekite.me
and it prints to OS/2 command line -- ksh -- output:
>>> Creating kite: mixtecatl.pagekite.me
=> Use the PageKite.net service? [Y/n]
=> What is your e-mail address?
(after I provide it ...)
Do you accept the license and terms of service?
* 1) Yes, I agree!
2) View Software License (AGPLv3).
3) View PageKite.net Terms of Service.
4) No, I do not accept these terms.=> Your choice: [1-4, default=1]
(accept default ...)
*** Your kite, mixtecatl.pagekite.me, is live!
***
*** IMPORTANT NOTE:
*** An activation link has been mailed to: myEmail@address.com
*** Unverified accounts are deactivated after 15 minutes.=> Save settings to X:/EMX/USR/.pagekite.rc? [Y/n]
*** Your kite, mixtecatl.pagekite.me, is live!
***
*** IMPORTANT NOTE:
*** An activation link has been mailed to: josex#x#x****###*com
*** Unverified accounts are deactivated after 15 minutes.=> Save settings to X:/EMX/USR/.pagekite.rc? [Y/n]
Settings saved to: X:/EMX/USR/.pagekite.rc
>>> Hello! This is pagekite.py v0.4.5a. [CTRL+C = Quit]
Connecting to front-end xyz.230.155.abc:443 ...
- Protocols: http http2 http3 https websocket irc finger httpfinger raw
- Ports: 79 80 443 843 2222 3000 4545 5222 6667 8000 8080 8081 9292
- Raw ports: UV virtual
!!! You have 0.00 MB of quota left.~<> Flying localhost:80 as https://mixtecatl.pagekite.me/
pagekite.py [flying] Kites are flying and all is well.
In effect, Free and Open Source (FOSS) continue to enable OS/2 users to fly to the cloud when no proprietary technology would. Here is a graphical representation of of the FOSS at work in OS/2: Apache, MySQL, PHP5, ownCloud, and PageKite ... oh and the EMX environment with the public domain Korn shell.
Once you have verified yourself/email to PageKite, your trial account begins. They allocate a certain amount so that you can try (and appreciate the usefulness of their service. After you deplete your trial allocation, PageKite charges for data transfer --as you can read at their site. This page is shown to your visitors if you disconnect your services from the Internet, while your account is active with PageKite.
For instance if someone tries to visit "my kite" --for OS/2 in this particular case-- at mixtecatl.pagekite.me the following page would display:
Starting my services again, I do not have to provide an argument for my local host -- nor provide the port where the web server listens for connections-- those are kept in a file located where my HOME environment variable points.
Aneh!
NOTE I make available as a resource of this post Python 2.6.4. It is an older distribution that I downloaded from Paul Smedley's OS/2 ports web resource. It works with PageKite but there is no link to download it from Smedley site. His most recent Python-2.6.5 fails at executing PageKite.
The views and/or opinions reflected here are my own and in no way necessarily reflect (by association) those of Metztli Information Technology as a whole and/or our business associates.
Suggestion code for commands entered at the OS/2 shell(s) prompt are provided on an AS-IS basis. Although due diligence has been applied, the information may not be accurate under all circumstances.
Any resource suggested and/or offered, like the GNU/Linux Debian php.ini file and/or PageKite, is intended only for illustrative purposes and not intended for production environments where additional security measures should be applied. Accordingly, please do not hold myself, Metztli IT, and/or associates responsible if unforeseen effects are experienced. You are not obliged to use the information provided.
Metztli IT reserves the right to modify the procedure --including deleting the blog entry.