Showing posts with label OwnCloud. Show all posts
Showing posts with label OwnCloud. Show all posts

Thursday, May 04, 2017

HOWTO : OwnCloud 10.0.0 and Hiawatha 10.6 on Ubuntu 16.04 LTS

Step 1 - Update Ubuntu :

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get autoclean
sudo apt-get --purge autoremove


Step 2 - Hiawatha Installation :

sudo apt-get install libc6-dev libssl-dev dpkg-dev debhelper fakeroot libxml2-dev libxslt1-dev

wget https://cmake.org/files/v3.5/cmake-3.8.1.tar.gz
tar -xvzf cmake-3.8.1.tar.gz
cd cmake-3.8.1
./configure
make
sudo make install


wget https://github.com/hsleisink/hiawatha/archive/v10.6.tar.gz
tar -xzvf v10.6.tar.gz
cd hiawatha-10.6/extra
./make_debian_package
cd ..
sudo dpkg -i hiawatha_10.6_amd64.deb


sudo mkdir /etc/hiawatha/enable-sites

sudo nano /etc/hiawatha/hiawatha.conf

Add "SocketSendTimeout" just before "Binding Setting" :

SocketSendTimeout = 240

Add "MaxRequestSize" to "Binding Settings" :

# BINDING SETTINGS
# A binding is where a client can connect to.
#
Binding {
    Port = 80
    # MaxRequestSize is 100GB
    MaxRequestSize = 104857600
    MaxUploadSize = 2047
    TimeForRequest = 24,100
    MaxKeepAlive = 72000000
}


Append the following line at the end of the file :

Include /etc/hiawatha/enable-sites/

Create "owncloud" file at /etc/hiawatha/enable-sites :

sudo nano /etc/hiawatha/enable-sites/owncloud

VirtualHost {
    Hostname = [your domain or IP address here]
    WebsiteRoot = /var/www/owncloud
    StartFile = index.php
    AccessLogfile = /var/log/hiawatha/owncloud-access.log
    ErrorLogfile = /var/log/hiawatha/owncloud-error.log
    TimeForCGI = 72000000
    WebDAVapp = yes
    UseFastCGI = PHP70
    UseToolkit = denyData
    EnablePathInfo = yes
    AllowDotFiels = yes
    HTTPAuthToCGI = yes
}

UrlToolkit {
    ToolkitID = denyData
    Match ^/data DenyAccess
}

FastCGIserver {
    FastCGIid = PHP70
    ConnectTo = /var/run/php/php7.0-fpm.sock
    Extension = php
    SessionTimeout = 72000000
}


sudo nano /etc/php/7.0/fpm/php-fpm.conf

Append the following lines at the end of the file :

; for OwnCloud
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

[www]
pm=dynamic
pm.max_children=1000
pm.start_servers=50
pm.min_spare_servers=25
pm.max_spare_servers=75


Step 3 - MySQL Setting :

sudo mysql -u root -p

create database owncloud;
GRANT ALL ON owncloud.* TO owncloud@'127.0.0.1' IDENTIFIED BY '[your password here]';
flush privileges;
quit


Step 4 - OwnCloud Installation :

wget -nv https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/Release.key -O Release.key
sudo apt-key add - < Release.key

rm Release.key

sudo sh -c "echo 'deb http://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/ /' >> /etc/apt/sources.list.d/owncloud.list"
sudo apt-get update
sudo apt-get install owncloud-files


sudo apt-get install exim4 exim4-base exim4-config exim4-daemon-light libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 s-nail php-common php7.0-cli php7.0-common php7.0-curl php7.0-gd php7.0-imap php7.0-intl php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-readline php7.0-xml php7.0-zip php7.0-pgsql php7.0-sqlite3 php7.0-fpm php-apcu mysql-server mysql-client php7.0-cgi php7.0-mbstring

sudo nano /var/www/owncloud/.user.ini

The content of the file may looking like this one :

upload_max_filesize=100G
post_max_size=100G
memory_limit=12G
mbstring.func_overload=0
always_populate_raw_post_data=-1
default_charset='UTF-8'
output_buffering=0
max_input_time=3600
max_execution_time=3600
upload_tmp_dir='/tmp/'
max_file_upload=5000

Open browser and point to http://[your owncloud server IP] and create your admin user and password. Then select database on the same page. Otherwise, it will use SQLite by default.

After that, do the following :

sudo nano /var/www/owncloud/config/config.php

Insert the following line into the end of the block of the code :

'memcache.local' => '\OC\Memcache\APCu',

To restart OwnCloud and Hiawatha services :

sudo systemctl restart php7.0-fpm
sudo systemctl restart hiawatha
sudo systemctl enable php7.0-fpm
sudo systemctl enable hiawatha


Then, you can install the desktop sync client to sync your desktop to ownCloud.

Remarks :

If you want to have https connection, you need to generate the private SSL certificate or purchase one. You can also use Let's Encrypt when necessary. If so, the "binding settings" at Hiawatha should be "Port 443".

That's all! See you.

Thursday, June 02, 2016

HOWTO : OwnCloud 9.0.2 and Hiawatha 10.2 on Ubuntu 16.04 LTS

Step 1 - Update Ubuntu :

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get autoclean
sudo apt-get --purge autoremove


Step 2 - Hiawatha Installation :

sudo apt-get install libc6-dev libssl-dev dpkg-dev debhelper fakeroot libxml2-dev libxslt1-dev

wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz
tar -xvzf cmake-3.5.2.tar.gz
cd cmake-3.5.2
./configure
make
sudo make install


wget http://www.hiawatha-webserver.org/files/hiawatha-10.2.tar.gz
tar -xzvf hiawatha-10.2.tar.gz
cd hiawatha-10.2/extra
./make_debian_package
cd ..
sudo dpkg -i hiawatha_10.2_amd64.deb


sudo mkdir /etc/hiawatha/enable-sites

sudo nano /etc/hiawatha/hiawatha.conf

Add "SocketSendTimeout" just before "Binding Setting" :

SocketSendTimeout = 30

Add "MaxRequestSize" to "Binding Settings" :

# BINDING SETTINGS
# A binding is where a client can connect to.
#
Binding {
    Port = 80
    # MaxRequestSize is 100GB
    MaxRequestSize = 104857600
    MaxUploadSize = 2047
    TimeForRequest = 5,50
    MaxKeepAlive = 14400
}


Append the following line at the end of the file :

Include /etc/hiawatha/enable-sites/

Create "owncloud" file at /etc/hiawatha/enable-sites :

sudo nano /etc/hiawatha/enable-sites/owncloud

VirtualHost {
    Hostname = [your domain or IP address here]
    WebsiteRoot = /var/www/owncloud
    StartFile = index.php
    AccessLogfile = /var/log/hiawatha/owncloud-access.log
    ErrorLogfile = /var/log/hiawatha/owncloud-error.log
    TimeForCGI = 14400
    WebDAVapp = yes
    UseFastCGI = PHP70
    UseToolkit = denyData
    EnablePathInfo = yes
}

UrlToolkit {
    ToolkitID = denyData
    Match ^/data DenyAccess
}

FastCGIserver {
    FastCGIid = PHP70
    ConnectTo = /var/run/php/php7.0-fpm.sock
    Extension = php
    SessionTimeout = 14400
}


sudo nano /etc/php/7.0/fpm/php-fpm.conf

Append the following lines at the end of the file :

; for OwnCloud
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

[www]
pm.max_children=1000
pm.start_servers=50
pm.min_spare_servers=25
pm.max_spare_servers=75


Step 3 - MySQL Setting :

sudo mysql -u root -p

create database owncloud;
GRANT ALL ON owncloud.* TO owncloud@'127.0.0.1' IDENTIFIED BY '[your password here]';
flush privileges;
quit


Step 4 - OwnCloud Installation :

wget -nv https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/Release.key -O Release.key
sudo apt-key add - < Release.key

rm Release.key

sudo sh -c "echo 'deb http://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/ /' >> /etc/apt/sources.list.d/owncloud.list"
sudo apt-get update
sudo apt-get install owncloud-files


sudo apt-get install exim4 exim4-base exim4-config exim4-daemon-light libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 s-nail php-common php7.0-cli php7.0-common php7.0-curl php7.0-gd php7.0-imap php7.0-intl php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-readline php7.0-xml php7.0-zip php7.0-pgsql php7.0-sqlite3 php7.0-fpm php-apcu mysql-server mysql-client php7.0-cgi

sudo nano /var/www/owncloud/.user.ini

The content of the file may looking like this one :

upload_max_filesize=100G
post_max_size=100G
memory_limit=12G
mbstring.func_overload=0
always_populate_raw_post_data=-1
default_charset='UTF-8'
output_buffering=0
max_input_time=3600
max_execution_time=3600
upload_tmp_dir='/tmp/'
max_file_upload=5000


sudo nano /var/www/owncloud/config/config.php

Insert the following line into the end of the block of the code :

'memcache.local' => '\OC\Memcache\APCu',

You may need to edit the following file at client sync program when necessary :

sudo nano /etc/ownCloud/sync-exclude.lst

To restart OwnCloud and Hiawatha services :

sudo /etc/init.d/php7.0-fpm restart
sudo /etc/init.d/hiawatha restart


Remarks :

If you want to have https connection, you need to generate the private SSL certificate or purchase one. You can also use Let's Encrypt when necessary. If so, the "binding settings" at Hiawatha should be "Port 443".

That's all! See you.

Saturday, February 02, 2013

HOWTO : OwnCloud with Apache on Ubuntu Server 12.04 LTS

At the early beginning, I want to create an OwnCloud server (4.5.6) with Hiawatha (8.7) on Ubuntu Server (12.04). However, I encounted a lot of problems when making it working properly. The main problem is that I cannot make any changes through the OwnCloud web interface and the applications cannot be activated and deactivated.

However, OwnCloud with Apache on Ubuntu Server is not a bad idea indeed. Furthermore, OwnCloud is designed for Apache environment. So, let's go.

OwnCloud will use your whole hard drive capacity. Therefore, the server should be dedicated for the purpose. Consider to use hardware RAID 1, 5 or 6 if possible.

(A) Installation of Ubuntu Server

Install Ubuntu Server 12.04 LTS as usual. Make sure you choose OpenSSH server, LAMP server and Mail Server when ask. Make sure you write down the MySQL password and make it strong enough.

(B) Installation of OwnCloud

To make the work simple, I choose to install from the Ubuntu respository even it is an old version as I want it to install a lot of packages automatically. Later, I will install the latest version from OwnCloud respository.

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install owncloud


wget http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_12.04/Release.key
sudo apt-key add - < Release.key


sudo -i
echo 'deb http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_12.04/ /' >> /etc/apt/sources.list.d/owncloud.list


Exit from root.

sudo apt-get update
sudo apt-get install owncloud


sudo chown -R www-data:www-data /var/www/owncloud/

(C) Configuration of Apache and .htaccess

sudo nano /etc/apache2/sites-enabled/000-default

Change all "AllowOverride" setting from "None" to "All".

And set "/var/www" or "/var/www/" to "/var/www/owncloud" or "/var/www/owncloud/" respectively.

sudo nano /var/www/owncloud/.htaccess

You can change the following values if necessary :

php_value upload_max_filesize 512M
php_value post_max_size 512M
php_value memory_limit 512M


Append "AcceptPathInto On" at the end of the file. Then save and exit.


sudo a2enmod rewrite
sudo a2enmod fcgid
sudo a2enmod headers


sudo /etc/init.d/apache2 restart

*** Please also to Official Manual and Administrators Manual for detail.

(D) Installation of OwnCloud via Broswer

Open Firefox and point the url to OwnCloud (e.g. http://192.168.0.100).

OwnCloud will create an Admin account when you first access the web interface.

Enter your Admin User Name (OwnCloud will create for you).
Enter your Admin Password (OwnCloud will crate for you).

Click "Advance" button to select MySQL.
Enter MySQL Admin User Name (e.g. root).
Enter MySQL Admin Password (The password when you install Ubuntu Server and MySQL that you have entered).
Enter Database Name that you want to use for this server (e.g. owncloud).

Press "Enter".

Then, you can configure your OwnCloud server via browser.

*** Make sure to backup the /var/www/owncloud/config/config.php

(E) Installation of OwnCloud client for desktop

Go to the Offical site to download (http://owncloud.org/sync-clients/).

If Ubuntu Desktop user, you can install it via the respository. The installation is similar to OwnCloud Server.

Make sure to add the "/usr/bin/owncloud" to the "Application Startup Preference" in order to make it to launch on every system boot up.

(F) Installation of Fail2ban

sudo apt-get install fail2ban

Make sure the ssh setting is set to "true".

sudo nano /etc/fail2ban/jail.conf

(G) Installation of Suricata (Optional)

You can refer to this link to install IPS on your Ubuntu Server.

(H) Tunning of MySQL (Optional)

You can refer to the MySQL section for tunning the performance of MySQL.

(I) Secure your Ubuntu Server in a passive way (Optional)

You can refer to this link for securing your Ubuntu server in a passive way.

(J) Send mail to GMail via Postfix (Optional)

You can configure your Postfix mail server to sent mail via GMail. You can refer to this link for detail.

(K) Logwatch (Optional)

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install logwatch


Make changes to the logwatch configure file in order to tell her to send you a email report.

sudo nano /usr/share/logwatch/default.conf/logwatch.conf

Change the settings of the following lines.

Output = mail
Format = html
MailTo = samiux@gmail.com


(L) Secure Apache (Optional)

You can refer to this link to make your Apache more secure.

Remarks : I just found out that mod-security may problem for operating the OwnCloud. It should be disabled.

(M) SSL for Apache (Optional)

You can secure your connection with SSL (HTTPS) in Apache. You can refer to this link.

sudo a2enmod ssl
sudo a2ensite default-ssl
sudo nano /etc/apache2/sites-enabled/default-ssl


Make some change on the file.

(N) Apparmor for Aapche (Optional)

sudo apt-get install apparmor-profiles apparmor-utils

Copy the following in a file namely "usr.lib.apache2.mpm-prefork.apache2" and placed it at "/etc/apparmor.d/" :



sudo aa-enforce usr.lib.apache2.mpm-prefork.apache2

Remarks :

At this writing, users cannot upload a file that is larger than 2GB to the OwnCloud via the web interface for 64-bit system. However, the client sync program can do it. The bug has been filed.

If your server is behind Cloudflare, your maximum file size upload via web interface should be limited to 50MB and you should disable the caching feature in the Cloudflare too.

Reference :

Apparmor manual for Ubuntu

That's all! See you.