- What is ownCloud?
- How to prepare web server for installation?
- Installation of ownCloud
- Completion of the establishment
First, we’ll see what exactly ownCloud is!
It is an open source application for cloud storage and online file management. Basically it is similar to the famous DropBox, because it can store and synchronize files between one or more work stations or servers and ownCloud server. It is also fulfilling the role of backup server for safekeeping files and server synchronization. To implement this service you must have a web server running PHP and MySQL or SQLite.
Among all these features, there is obviously the possibility to share files; also you can play music directly online with the integrated player, can manage calendar, contact management, viewing and editing documents online, the visualization and filing photos in galleries, etc…. Moreover, many plugins are available in order to insert new functionality to ownCloud.
Here, we took Debian server and we are going to see together how to install ownCloud with Apache on web server that coupled with PHP and SQLite.
But, before we proceed, it is important to know how to prepare web server for the installation!!!
Before installing ownCloud application, ensure that your web server is equipped with essentials. If you haven’t, then first install Apache and PHP libraries for ownCloud’s different needs. We will enter the following commands:
apt-get update apt-get install apache2 php5 php5-common php5-gd apt-get install php5-sqlite curl libcurl3 libcurl3-dev php5-curl
For information, we install apache2, php5 and SQLite and several PHP modules. However, MySQL installs automatically with ownCloud during the installation via apt-get.
Installation of ownCloud
Now we continue with the installation of ownCloud. Following are the commands that we would type:
echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_7.0/ /' >> /etc/apt/sources.list.d/owncloud.list apt-get update apt-get install owncloud
Here, we just insert a new row to the repository containing ownCloud Addons to our sources.list and then we updated our deposits and installed ownCloud. When installing ownCloud, MySQL database service is also installed, it will then have to indicate a password twice for the “root” or MySQL.
Note: PHP5 packages allowing PHP to communicate with MySQL, which is also installed automatically during installation of ownCloud. So it makes our work easier.
We will then set the “group www-data”, containing the user of the same name used by Apache as a group owner on useful directories in the operation of ownCloud. We will seize it for the following commands:
cd /var/www/ chown www-data:www-data -R owncloud/
Then we will move on the change the permission on these directories, the option “-R” allows for recursion, that is to say, rights of the changes will apply to all sub-directories as well:
chmod 770 -R owncloud/
For ownCloud work correctly in Apache, activate modules rewrite and headers in Apache. Rewrite allows URL rewriting and headers allow managing the headers of HTTP requests and responses:
a2enmod rewrite a2enmod headers
For security, you must prevent access to “directory data” of ownCloud. For this, a file .htaccess is already present and preconfigured in ownCloud. It contains a directive to deny access to everyone and a second for preventing the listing of any directory contents:
deny from all IndexIgnore *
Note: "data" is the data directory of ownCloud.
So the .htaccess file is taken into account, the directive allow override of your web server that must be set to “All” and not “None” if the files .htaccess are ignored. Change the default file located in “/etc/apache2/sites-enabled” to obtain this:
Options -Indexes FollowSymLinks MultiViews AllowOverride ALL Order allow,deny allow from all
Then, finally, we can restart the Apache server:
service apache2 restart
Access from the browser on data from the data folder should be blocked.
Completion of the establishment!!!
Finally, go to ownCloud from web interface to complete the installation and create the “user admin”. Then, go to the web browser and enter the URL. For example: http://domain_IP/ownCloud.
There you will see that the system SQLite database is sufficient for standard installations. If you do not think you need a very large volume for your ownCloud, simply enter the username and password of your admin user and click “Finish the Installation”.
But if you know your ownCloud will have to handle a certain load, click on “Storage and Database” to access the possibility of using of other database systems. Then select MySQL or MariaDB.
If you are using MySQL, it will go from the command line on your MySQL interface to seize control lines that will create a database and a user dedicated to ownCloud. It creates the user and the database.
CREATE USER "owncloud"@"localhost" IDENTIFIED BY "password"; CREATE DATABASE owncloud;
Note: Remember to replace "password" with a strong password.
We give all the rights to the user on the database:
GRANT ALL PRIVILEGES ON owncloud.* TO "owncloud"@"localhost"; FLUSH PRIVILEGES;
It will then fill the fields (user, password, name of the database…):
Remember to enter the password for your main administrator and click “Finish the installation”.
OwnCloud is ready, everything is functional. You can log in with the user” admin “by going to the URL” http: // domain_IP / owncloud”
It only remains to have fun with OwnCloud!!!