How to Install OwnCloud on Ubuntu 16.04 or 18.04
This post will guide you how to install and configure OwnCloud on your Ubuntu Linux 18.04 or 16.04. How do I install ownCloud platform with Apache on Ubuntu Linux system.
- What is OwnCloud?
- Prerequisites
- Step1: Installing Apache
- Step2: Configuring Apache
- Step3: Installing PHP
- Step4: Installing MySQL or MariaDB
- Step5: Creating Database and User
- Step6: Downloading the Latest OwnCloud
- Step7: Installing OwnCloud
What is OwnCloud?
ownCloud is the market leading open source content collaboration solution worldwide. ownCloud enables users to securely access and share data from any device, anywhere in the world.
ownCloud is the open platform for more productivity and security in digital collaboration. ownCloud is secure enterprise file sharing. As easy to use as consumer products, but hosted in your data center. ownCloud offers unsurpassed transparency, security and control and can be flexibly integrated into the existing environment.
In this tutorial, you will see the basic steps of installing and configuring OwnCloud on your ubuntu 16.04 or 18.04 server. you can also refer the below steps on Debian Linux.
Prerequisites
• A running Ubuntu Linux system or VM
• You need to have a non-root user with sudo privileges
• A FQDN Domain name that point to your IP address. Such as: mytest.com
Step1: Installing Apache
Before you begin to install packages on your Ubuntu system, you need to make sure that your system is up to date, so you need to run yum update command to update the APT index and upgrade all packages that can be updated.
$ sudo apt update $ sudo apt upgrade
Then you can begin to install the Apache package with the following command:
$ sudo apt-get install apache2 libapache2-mod-php
Outputs:
devops@devops:~$ sudo apt-get install apache2 libapache2-mod-php [sudo] password for devops: Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-4.18.0-22 linux-headers-4.18.0-22-generic linux-image-4.18.0-22-generic linux-modules-4.18.0-22-generic linux-modules-extra-4.18.0-22-generic Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: apache2-bin apache2-data apache2-utils Suggested packages: apache2-doc apache2-suexec-pristine | apache2-suexec-custom The following NEW packages will be installed: libapache2-mod-php The following packages will be upgraded: apache2 apache2-bin apache2-data apache2-utils 4 upgraded, 1 newly installed, 0 to remove and 56 not upgraded. Need to get 1,413 kB of archives. After this operation, 16.4 kB of additional disk space will be used. Do you want to continue? [Y/n] ….. Setting up libapache2-mod-php (1:7.2+60ubuntu1) ... Processing triggers for ureadahead (0.100.0-21) ... Setting up apache2-utils (2.4.29-1ubuntu4.7) ... Setting up apache2-bin (2.4.29-1ubuntu4.7) ... Setting up apache2-data (2.4.29-1ubuntu4.7) ... Processing triggers for systemd (237-3ubuntu10.23) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Setting up apache2 (2.4.29-1ubuntu4.7) ...
Step2: Configuring Apache
Once Apache package is installed on your system, you need to create a basic configuration file for Apache, and it will set DocumentRoot variable to specify the location of your website files and set ServerName variable to specify what you domain name is. And you can create it by copying a default config file, and then modify it. Just do the following steps:
1# Run the following command to copy the default config file to use it as a template.
$ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mytest.com.conf
2# edit the configuration file mytest.com.conf with vim text editor, and uncomment the ServerName line, and replace example.com with you domain name, and then update the remain lines as below:
$ sudo vim /etc/apache2/sites-available/mytest.com.conf
ServerName mytest.com ServerAdmin test@mytest.com Documentroot /var/www/html/mytest.com <Directory /var/www/html/mytest.com> AllowOverride All </Directory>
3# you need to create the directory to store your website files with the following mkdir command:
$ sudo mkdir /var/www/html/mytest.com
4# you need to disable the default configuration file and enable the newly created one, mytest.com.conf, run the below command:
$ sudo a2dissite 000-default.conf $ sudo a2ensite mytest.com.conf
Outputs:
devops@devops:~$ sudo a2dissite 000-default.conf Site 000-default disabled. To activate the new configuration, you need to run: systemctl reload apache2 devops@devops:~$ sudo a2ensite mytest.com.conf Enabling site mytest.com. To activate the new configuration, you need to run: systemctl reload apache2
5# you also need to enable the mod_rewrite Apache module for OwnCloud with the following command:
$ sudo a2enmod rewrite
6# need to restart Apache service with the following command:
$ sudo systemctl restart apache2.service
Step3: Installing PHP
You need to install php package on your Ubuntu system for OwnCloud software. Just run the following command to install it:
$ sudo apt install php libapache2-mod-php
Ouputs:
devops@devops:~$ sudo apt install php libapache2-mod-php [sudo] password for devops: Reading package lists... Done Building dependency tree Reading state information... Done libapache2-mod-php is already the newest version (1:7.2+60ubuntu1). The following packages were automatically installed and are no longer required: linux-headers-4.18.0-22 linux-headers-4.18.0-22-generic linux-image-4.18.0-22-generic linux-modules-4.18.0-22-generic linux-modules-extra-4.18.0-22-generic Use 'sudo apt autoremove' to remove them. The following NEW packages will be installed: php 0 upgraded, 1 newly installed, 0 to remove and 56 not upgraded. Need to get 3,084 B of archives. After this operation, 12.3 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://mirrors.aliyun.com/ubuntu bionic/main amd64 php all 1:7.2+60ubuntu1 [3,084 B] Fetched 3,084 B in 0s (14.6 kB/s) Selecting previously unselected package php. (Reading database ... 210189 files and directories currently installed.) Preparing to unpack .../php_1%3a7.2+60ubuntu1_all.deb ... Unpacking php (1:7.2+60ubuntu1) ... Setting up php (1:7.2+60ubuntu1) ...
Then you still need to install other required PHP modules with the following command:
$ sudo apt install php7.2-common php7.2-cli php7.2-fpm php7.2-opcache php7.2-gd php7.2-mysql php7.2-curl php7.2-intl php7.2-xsl php7.2-mbstring php7.2-zip php7.2-bcmath php7.2-soap
Outputs:
devops@devops:~$ sudo apt install php7.2-common php7.2-cli php7.2-fpm php7.2-opcache php7.2-gd php7.2-mysql php7.2-curl php7.2-intl php7.2-xsl php7.2-mbstring php7.2-zip php7.2-bcmath php7.2-soap Reading package lists... Done Building dependency tree Reading state information... Done php7.2-cli is already the newest version (7.2.19-0ubuntu0.18.04.1). php7.2-common is already the newest version (7.2.19-0ubuntu0.18.04.1). php7.2-common set to manually installed. php7.2-curl is already the newest version (7.2.19-0ubuntu0.18.04.1). php7.2-gd is already the newest version (7.2.19-0ubuntu0.18.04.1). php7.2-mysql is already the newest version (7.2.19-0ubuntu0.18.04.1). php7.2-opcache is already the newest version (7.2.19-0ubuntu0.18.04.1). php7.2-intl is already the newest version (7.2.19-0ubuntu0.18.04.1). php7.2-mbstring is already the newest version (7.2.19-0ubuntu0.18.04.1). php7.2-zip is already the newest version (7.2.19-0ubuntu0.18.04.1). The following packages were automatically installed and are no longer required: linux-headers-4.18.0-22 linux-headers-4.18.0-22-generic linux-image-4.18.0-22-generic linux-modules-4.18.0-22-generic linux-modules-extra-4.18.0-22-generic Use 'sudo apt autoremove' to remove them. Suggested packages: php-pear The following NEW packages will be installed: php7.2-bcmath php7.2-fpm php7.2-soap php7.2-xsl 0 upgraded, 4 newly installed, 0 to remove and 56 not upgraded. Need to get 1,550 kB of archives. After this operation, 5,456 kB of additional disk space will be used. Do you want to continue? [Y/n]
Step4: Installing MySQL or MariaDB
Now you can begin to install MySQL database management or MariaDB database to store data for your OwnCloud. Just run the following command to install it:
$ sudo apt install mariadb-server
Or
$ sudo apt install mysql-server mysql-client
Once the installation is completed, you’d better to run mysq_secure_installation script to secure your MySQL or MariaDB installation by running the following command:
$ sudo mysql_secure_installation
Step5: Creating Database and User
Once the Database installation is completed, and you need to create a database for your OwnCloud site, and create one mysql user.
Firstly, you need to log in to your MySQl shell by issue the following command:
$ sudo mysql -u root -p
Then run the following SQL statement to create a new database called myowncloud in the MySQL Shell prompt:
Mysql> create database myowncloud;
Outputs:
mysql> create database myowncloud; Query OK, 1 row affected (0.00 sec)
Next, you need to create a MySQL username called mypres and you also need to grant the necessary permissions to this user account, just issue the following MySQL commands:
Mysq> create user 'mypres'@'localhost' identified by 'password'; Mysql> grant all on myowncloud.* to 'mypres'@'localhost'; Mysql> flush privileges; Mysql> exit;
Outputs:
mysql> create user 'mypres'@'localhost' identified by 'password'; Query OK, 0 rows affected (0.00 sec) mysql> grant all on myowncloud.* to 'mypres'@'localhost'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec)
Step6: Downloading the Latest OpenCart Package
Before installing OwnCloud on your Ubuntu server, you need to download it from its official web site with wget command. At the time of writing this post, the latest version of OwnCloud is 10.2.1. Before downloading with the below command, you should better visit the ownCloud download page to check if there is a new version of ownCloud available. type:
$ wget https://download.owncloud.org/community/owncloud-10.2.1.zip
Outputs:
devops@devops:~$ wget https://download.owncloud.org/community/owncloud-10.2.1.zip --2019-09-02 01:52:27-- http://wget/ Resolving wget (wget)... failed: Name or service not known. wget: unable to resolve host address ‘wget’ --2019-09-02 01:52:27-- https://download.owncloud.org/community/owncloud-10.2.1.zip Resolving download.owncloud.org (download.owncloud.org)... 116.203.164.24, 2a01:4f8:1c0c:8147:: Connecting to download.owncloud.org (download.owncloud.org)|116.203.164.24|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 32195939 (31M) [application/zip] Saving to: ‘owncloud-10.2.1.zip’ owncloud-10.2.1.zip 100%[================================================================>] 30.70M 78.4KB/s in 9m 30s 2019-09-02 02:01:58 (55.2 KB/s) - ‘owncloud-10.2.1.zip’ saved [32195939/32195939] FINISHED --2019-09-02 02:01:58-- Total wall clock time: 9m 31s Downloaded: 1 files, 31M in 9m 30s (55.2 KB/s)
Once the download is completd, and you need to extract the archive file into Apache2 root directory /var/www/html, type:
$ unzip owncloud-10.2.1.zip $ sudo mv upload/ /var/www/html/mytest.com
Step7: Installing OpenCart
Now you can start the ownCloud installation and configuration by the following steps:
Firstly,you need to set the correct permissions for your Apache root directory using the following command:
$ sudo chown -R www-data:www-data /var/www/html/mytest.com/ $ sudo chmod -R 755 /var/www/html/mytest.com/
Next, you need to open your browser and type the following URL link to install ownCloud:
http://mytest.com/owncloud/
or
http://IP_ADDRESS/owncloud/
Then you need to enter your desired admin username and password and you also need to enter the database information so that the installation can continue.
Last, click on the Finish Setup button. Once the installation process is completed. And you just enter the admin user and its password to login your ownCloud server.
Conclusion
You should know that how to install and configure OpenCart on your Ubuntu or Debian Linux. If you want to see more detailed information about OpenCart , you can directly go to its official web site.