지난번에 오라클 (otn.oracle.com : 오라클 테크놀러지 네트워크 )와 오라클 공식블로그에 제가 기고한 글이 5월 1일 퍼블리싱 되었습니다.
짧은 영어실력에 콩글리쉬로 인한 수정, 변경 작업이 좀 많았지만, 어찌되었던 솔라리스 기술 문서를 오라클 커뮤니티에 공식적으로 퍼블리싱 한 것만으로 부족하지만 기쁨을 느낍니다.
이번 퍼블리싱 이후 조금더 왕성하게 영문으로 퍼블리싱 해서 국내 기술능력을 세계로 전파(?) 하는 ...노력을 해 볼 생각입니다.
해당 문서는 원래 초안을 한글로 만들고 영어를 일일히 바꾸는 작업을 했는데 , 정작 한글 자료가 없네요..ㅠㅠ
조만간 한글버전도 만들어서 블로그와 커뮤니티에 배포 토록 하겠습니다.
https://blogs.oracle.com/OTNGarage/entry/how_to_build_a_cloud
본문은 아래와 같습니다.
How to Build a Web-Based Storage Solution Using Oracle Solaris 11.1
by Suk Kim
How to build a cloud storage service similar to Dropbox using Oracle Solaris 11.1 and AjaXplorer.
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.
Prerequisites
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:
- At least 2 GB of memory (1 GB of memory is recommended to be assigned in Oracle VM VirtualBox)
- At least 20 GB free disk space for Oracle VM VirtualBox and its image
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.
Install Oracle Solaris and Configure ZFS Storage
Perform the following steps.
- Using Oracle VM VirtualBox (shown in Figure 1), install Oracle Solaris 11.1 on your system.
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
- Add a disk to be used in the configuration ZFS, as shown in Figure 2.
Figure 2. Adding a Disk
- Add three more disks. When you are done, Oracle VM VirtualBox Manager will look similar to Figure 3.
Figure 3. After More Disks Are Added
- Start Oracle Solaris using the Start icon in Oracle VM VirtualBox.
- After logging in, change to the
root
user by using thesu
command. (From Oracle Solaris 11, you cannot log in directly asroot
; you must log in as a regular user first.) - Use the commands shown in Listing 1 to configure the ZFS storage and configure a RAIDZ volume.
The commands in Listing 1 create a ZFS pool named
data_pool
as a RAIDZ volume using three disks:c7t2d0
,c7t3d0
, andc7t4d0
. Then thedocs
ZFS file system is created underdata_pool
.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
Listing 1
Install the Apache and PHP Packages
- To install the PHP Server and Apache Web Server packages (which come with Oracle Solaris 11), run the following commands:
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
- Download AjaXplorer from sourceforge.net using the
wget
command:root@solaris:~# wget http://sourceforge.net/projects/ajaxplorer/files/ajaxplorer/stable-channel/4.2.3/ajaxplorer-core-4.2.3.tar.gz
- Unpack the downloaded file using the following command.
root@solaris:~# tar xvfz /ajaxplorer-core-4.2.3.tar.gz
AjaXplorer is installed in the default location of the Apache server, which is
/var/apache2/2.2/htdocs
. - In order to construct Web storage under the
htdocs
directory, we proceed as follows. First, create awebhard
subdirectory:root@solaris:~# mkdir /var/apache2/2.2/htdocs/webhard
- Next, change the mount point from
/var/apache2/2.2/htdocs/webhard
todata_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.
- As shown in Listing 2, you can enable deduplication for the ZFS file system, which is supported by the Oracle Solaris 11, and you can enable the compression feature, which allows efficient use of storage.
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
Listing 2
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.
- Run the following commands to set permissions to allow access to the directory:
root@solaris:~# chown -R webservd:webservd /var/apache2/2.2/htdocs root@solaris:~# chmod -R 777 /var/apache2/2.2/htdocs/webhard
Configure Security
- To set up HTTPS (SSL) communications, copy the
ssl.conf
file 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
- Note that due to limitations of the 32-bit PHP module, the file upload size is limited to 2 gigabytes. The upload limit is larger for a 64-bit module; unfortunately, only a 32-bit PHP module is available for Oracle Solaris for x86 platforms.
root@solaris:~# php -r 'echo PHP_INT_MAX;' 2147483647
- 32 bit: 2147483647 (= 2G)
- 64 bit: 9223372036854775807 (= 8388608T)
So, adjust the following values in
/etc/php/5.3/php.ini
:- Set
memory_limit
to128M
. - Set
post_max_size
to2G
. - Set
upload_max_filesize
to2G
.
Note:
post_max_size
must always be greater than or equal toupload_max_filesize
. - When you are finished making changes, restart the service.
root@solaris:~# svcadm restart http:apache22
- I installed and configured the
mod_secruity
Apache 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
Connect to the Client
- For a normal PC using a Web browser, the client connection and diagnostic messages are displayed first. Then, as shown in Figure 4, a security warning is displayed stating that the initial user ID and password are both admin. The password can be changed after the initial login.
Figure 4. Security Warning
Figure 5. Connecting to AjaXplorer
- In order to check and set the file size limit, select Settings and then select Global Configurations, Core Configs, Common 'uploader' plugins options, and Limitations. You can then see and change the file size, as shown in Figure 6.
Figure 6. Checking and Changing File Size Limits
- As shown in Figure 7, using a Web browser, you can use the Web storage.
Figure 7. Using the Web Storage from a Browser
- As shown in the Figure 8 through Figure 12, you can use the storage in the same way using an Android-based smartphone or an iPhone.
Figure 8. AjaXplorer for iOS
Figure 9. Server Settings
Figure 10. Created Server
Figure 11. Server Connection
Figure 12. File Access - A native application, which costs US$0.99, is available for accessing AjaXplorer through an iPhone or iPad.
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
Check ZFS Compression and Deduplication
File uploads and downloads are done brilliantly.
Use 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.
Also, zfs list
shows information about the file systems.
See Also
About the Author
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 |
'OS & network > solaris' 카테고리의 다른 글
솔라리스 11 grub2 보안 설정하기 (0) | 2013.05.05 |
---|---|
솔라리스 11.1의 grub2로 인한 변경사항. (0) | 2013.05.05 |
Oracle x86 Systems: The Best x86 Platform for Oracle Solaris 웹캐스트 후기 (0) | 2013.02.27 |
오라클 x86 시스템 웹 캐스트 등록하세요~ (0) | 2013.02.25 |
솔라리스 10 1/13 릴리즈 ( 업데이트 10 공개 ) (0) | 2013.02.12 |