Rabu, 24 Juni 2015

Owncloud Centos Nginx

Install Layanan Cloud Storage Owncloud on Nginx

http://motaroirhaby.blogspot.com/2013/08/install-layanan-cloud-storage-owncloud.html

Sedikit ingin share tentang cara install layanan Cloud Storage yang saat ini mungkin banyak dikenal kaya Google Drive, Dropbox , SugarSync, SpiderOak dan Microsoft SkyDrive Etc ..

nah disini kita juga bisa buat sendiri layanan seperti itu, disini saya coba memakai Owncloud. yang pasti owncloud ini "Open Source" dan bisa di download secara gratis.

Fitur apa aja yang ada di dalamnya ?
see this link : owncloud

OwnCloud termasuk dalam kategori Infrastructure as a Service (IaaS) Layanan Cloud. Dengan ownCloud kita dapat menyimpan file, folder, kontak, audio, galeri foto, kalender dan dokumen lainnya. Kita juga dapat mengakses file dan melakukan sinkronisasi file yang terdapat pada server ownCloud dengan perangkat mobile, desktop, atau webbase .


ok langsung ke cara installasi.

Di Post ini server yang ane pakai :
- Centos Final 6.4 64bit
- Nginx
- PHP 5.4.14
- Mysql 5.5.30

Login ke Server / VPS
1. Update Repo dan install beberapa package

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

atau create file di /etc/yum.repos.d/epel.repo

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$ba                                             search
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
yum -y update

yum install ntp 
service ntpd start 
chkconfig ntpd on

2. Install dan Konfigurasi PHP Disini Direkomendasikan pakai PHP 5.4 karena kalo pakai PHP 5.3 ada beberapa bug (CVE-2006-7243) yang saya baca di beberapa command di github nya Owncloud

yum --enablerepo=epel install php-fpm php-gd php-ldap php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mbstring php-mcrypt php-shout php-snmp php-soap php-tidy php-mysql 

Edit php.ini
vi /etc/php.ini
post_max_size = 100M
cgi.fix_pathinfo = 0
upload_max_filesize = 100M
date.timezone = "Asia/Jakarta"

Edit php-fpm dan agar listen di unix socket nya.
vi /etc/php-fpm.d/www.conf
;listen = 127.0.0.1:9000
listen = /var/run/php-fpm/php-fpm.sock

start service php-fpm nya :
chkconfig php-fpm on 
service php-fpm start

3. Database login ke mysql/database yang dipakai:
CREATE DATABASE owncloud;
GRANT ALL ON owncloud.* TO ‘dbuser‘@’localhost‘ IDENTIFIED BY ‘dbpass‘;
FLUSH PRIVILEGES;

4. Konfigurasi Nginx - install nginx (via yum / source)
yum install nginx 
service nginx start 
chkconfig nginx on

5. edit konfigurasi virtualhost/nginx
# redirect http to https.
server {
  listen 80;
  server_name owncloud.example.com;
  rewrite ^ https://$server_name$request_uri? permanent;  # enforce https
}
# owncloud (ssl/tls)
server {
  listen 443 ssl;
  ssl_certificate /etc/nginx/certs/momot-cloud.crt;
  ssl_certificate_key /etc/nginx/certs/momot-cloud.key;
  server_name owncloud.example.com;
  root /var/www/owncloud;
  index index.php;
  client_max_body_size 64M; # set maximum upload size
  # deny direct access
  location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
    deny all;
  }
  # default try order
  location / {
    try_files $uri $uri/ @webdav;
  }
  # owncloud WebDAV
  location @webdav {
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS on;
    include fastcgi_params;
  }
  # enable php
  location ~ \.php$ {
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS on;
    include fastcgi_params;
  }
}

serve_name, root_folder, ssl_folder bisa disesuaikan ketawa Create certificate karena disini kita menggunakan service 443/SSL
openssl req -newkey rsa:2048 -x509 -days 365 -nodes -keyout /etc/nginx/certs/momot-cloud.key -out /etc/nginx/certs/momot-cloud.crt

restart service nginx
service nginx reload

5. Download dan install owncloud
wget http://download.owncloud.org/community/owncloud-4.5.10.tar.bz2 
tar xjf owncloud-4.5.10.tar.bz2
mv owncloud /var/www/ 
mkdir -p /var/www/owncloud/data 
chmod 770 /var/www/owncloud/data 
chown -R root:apache /var/www/owncloud

dan sekarang kita akses owncloud : 

isikan username administrator , user dan password database. selesai kita check database.. 

 ok selesai , kita login dan begini tampilannya : 

contoh sync client , bisa sync ke server cloud kita ddan ga kalah seperti dropbox atau googledrive 
Sync Client

sumber : http://doc.owncloud.org/server/5.0/admin_manual/installation/installation_others.html#nginx-configuration

Semoga bermanfaat :D

Tidak ada komentar:

Posting Komentar