by Suk Kim
Published April 2013
Oracle Solaris 11 is a cloud operating system that is very powerful. Using Oracle Solaris 11, you will be able to provide various services. For example, it is possible to create storage that can be utilized by AjaXplorer, which provides Web-based access to files.
This article describes a PHP-based open source solution that uses AjaXplorer, Oracle Solaris 11.1, and Apache Web server (although other Web servers can be used) to build a cloud-based storage service that is similar to Dropbox.
Of course, you can also build the storage in the same way using AjaXplorer with other operating systems, such as Microsoft Windows, Mac OS X, and Linux. However, when using Oracle Solaris 11.1, you will be able to configure the storage in a more powerful and secure way by taking advantage of ZFS.
After you implement the solution described in this article, you will be able to use any Web browser to access the Web-based storage. In addition, you can use apps on Android and Apple iOS smartphones and tablets to access the storage.
You can use Oracle VM VirtualBox to install Oracle Solaris 11.1 on a system. Or, if you already have Oracle Solaris 11.1 installed on a system, you can use that.
The following are the system requirements for Oracle VM VirtualBox:
Note: If instead of installing Oracle VM Virtual Box, you use a system that already has Oracle Solaris 11.1 installed, that system should have at least 1 GB of memory (2 GB is recommended). The approach described in this article uses Oracle VM VirtualBox to install Oracle Solaris 11.1.
Perform the following steps.
Note: If you do not have Oracle VM VirtualBox installed, you can download it here and then refer to the Oracle VM VirtualBox User Manual for installation information. You can also download the Oracle Solaris 11.1 VM for Oracle VM VirtualBox image—a preinstalled virtual machine that provides a convenient way to evaluate Oracle Solaris 11 from inside Oracle VM VirtualBox—by referring to this article.
Figure 1. Oracle VM VirtualBox
Figure 2. Adding a Disk
Figure 3. After More Disks Are Added
rootuser by using the
sucommand. (From Oracle Solaris 11, you cannot log in directly as
root; you must log in as a regular user first.)
The commands in Listing 1 create a ZFS pool named
data_pool as a RAIDZ volume using three disks:
c7t4d0. Then the
docs ZFS file system is created under
root@solaris:~# format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c7t0d0 <ATA-VBOX HARDDISK-1.0-16.00GB> /pci@0,0/pci8086,2829@d/disk@0,0 1. c7t2d0 <ATA-VBOX HARDDISK-1.0-2.00GB> /pci@0,0/pci8086,2829@d/disk@2,0 2. c7t3d0 <ATA-VBOX HARDDISK-1.0-2.00GB> /pci@0,0/pci8086,2829@d/disk@3,0 3. c7t4d0 <ATA-VBOX HARDDISK-1.0-2.00GB> /pci@0,0/pci8086,2829@d/disk@4,0 Specify disk (enter its number): ^D root@solaris:~# zpool create data_pool raidz c7t2d0 c7t3d0 c7t4d0 root@solaris:~# zfs create data_pool/docs
root@solaris:~# pkg install pkg:/web/server/apache-22 root@solaris:~# pkg install pkg:/web/php-53 root@solaris:~# pkg install pkg:/web/server/apache-22/module/apache-php53
root@solaris:~# wget http://sourceforge.net/projects/ajaxplorer/files/ajaxplorer/stable-channel/4.2.3/ajaxplorer-core-4.2.3.tar.gz
root@solaris:~# tar xvfz /ajaxplorer-core-4.2.3.tar.gz
AjaXplorer is installed in the default location of the Apache server, which is
htdocsdirectory, we proceed as follows. First, create a
root@solaris:~# mkdir /var/apache2/2.2/htdocs/webhard
data_pool/docs, which is Web-based storage:
root@solaris:~# zfs set mountpoint=/var/apache2/2.2/htdocs/webhard data_pool/docs
Or, if you don't want to change the mount point, you can achieve the same result by modifying the configuration of the Apache server.
Deduplication and compression can be turned on or off during operation. Encryption, which was not used here, can be enabled only when you create a volume. Once a volume has been encrypted, the encryption setting cannot be changed.
root@solaris:~# zfs get all data_pool/docs | grep compress data_pool/docs compression off local data_pool/docs compressratio 1.00x root@solaris:~# zfs get all data_pool/docs | grep dedup data_pool/docs dedup off local root@solaris:~# zfs set compression=on data_pool/docs root@solaris:~# zfs set dedup=on data_pool/docs root@solaris:~# zfs get all data_pool/docs | grep dedup data_pool/docs dedup on local root@solaris:~# zfs get all data_pool/docs | grep compress data_pool/docs compression on local data_pool/docs compressratio 1.00x
Now, if the same file is copied, there is no change to the block due to deduplication saving space. Additional space is saved due to compression.
root@solaris:~# chown -R webservd:webservd /var/apache2/2.2/htdocs root@solaris:~# chmod -R 777 /var/apache2/2.2/htdocs/webhard
ssl.conffile to create a key and certificate. After the copying and configuration tasks are complete, restart the Web service.
root@solaris:~# cp /etc/apache2/2.2/sample-config.d/ssl.conf /etc/apache2/2.2/conf.d root@solaris:~# openssl genrsa -out server.key 2048 root@solaris:~# openssl req -new -key server.key -out server.csr root@solaris:~# openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt root@solaris:~# cp server.* /etc/apache2/2.2 root@solaris:~# svcadm restart http:apache22
root@solaris:~# php -r 'echo PHP_INT_MAX;' 2147483647
So, adjust the following values in
post_max_size must always be greater than or equal to
root@solaris:~# svcadm restart http:apache22
mod_secruityApache module for security. If desired, you can install and configure it using the following commands.
root@solaris:~# pkg install web/server/apache-22/module/apache-security root@solaris:~# cp /etc/apache2/2.2/sample-config.d/security2.conf /etc/apache2/2.2/conf.d
Figure 4. Security Warning
Figure 5. Connecting to AjaXplorer
Figure 6. Checking and Changing File Size Limits
Figure 7. Using the Web Storage from a Browser
Figure 8. AjaXplorer for iOS
Figure 9. Server Settings
Figure 10. Created Server
Figure 11. Server Connection
Figure 12. File Access
As shown in Figure 13 through Figure 15, even without using that app, you can use a mobile Web browser to access the storage.
Figure 13. Connected Screen on Mobile Web Browser
Figure 14. Login Screen on Mobile Web Browser
Figure 15.Access to Files on Mobile Web Browser
File uploads and downloads are done brilliantly.
zpool list to verify that the deduplication and compression functions are working:
root@solaris:~# zpool list NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT data_pool 5.94G 28.2M 5.91G 0% 2.97x ONLINE - rpool 15.6G 4.01G 11.6G 25% 1.00x ONLINE - root@solaris:~# zfs list NAME USED AVAIL REFER MOUNTPOINT data_pool 20.0M 3.87G 36.0K /data_pool data_pool/docs 19.6M 3.87G 19.6M /var/apache2/2.2/htdocs/webhard
If a file is duplicated, the value shown under the
DEDUP column in the output of the
zpool list command will be greater than 1.00x. In this example, the value is 2.97x, which means the file is compressed.
zfs list shows information about the file systems.
Suk Kim is an Oracle Ace Director for Oracle Solaris in South Korea. He is also chairman of the Korea Oracle Solaris User Network, manager of Oracle Solaris TechNet, manager of the Solaris School community, an adjunct professor at Ansan University, and a senior system and security consultant at NoBreak Co., LTD.
|Revision 1.0, 04/25/2013|