Installing Owncloud on the server

Giteqa

If suddenly you need to create your own cloud storage on the server, then you can choose a owncloud file with because it is free (The version is very limited, but you can use it).

We have a video instruction that will clearly explain to you what actions you need to do to install owncloud on the server.

However, if you need a printed version of the instructions, then it will be slightly lower.

Installing owncloud on the server

We will install it on a server built on Ubuntu 20.04 and the latest version of ownCloud at the moment is 10.9.1

The first thing to do is to check if your server needs updates by entering the commands one by one

  • sudo apt update
  • sudo apt upgrade

After checking the system and updating (if necessary), you can restart it if the system requires it, or proceed to the next step.

Installing the server lamp

to install the lamp stack on your server, you will need to enter the following command on behalf of the root user.

apt install lamp-server^-y

After the installation of this stack is completed, start the apache server using the commands.

  • sudo systemctl starts apache2
  • sudo systemctl enable apache2

After starting the Apache server, you can check whether it works by entering the IP address of your server in the address bar.

Apache

If your page shows the same as the screenshot above, then everything went well.

Installing PHP protocols

You will need to install protocols for PHP this is done using the following command

sudo apt-get install php php-gd php-curl php-mysqlnd php-intl php-json php-ldap php-mbstring php-xml php-zip -y

After that restart the apache server using the command

sudo systemctl restarts apache2

Installing a MySQL Server

You will need to enable MySQL on your server using the following commands

  • sudo systemctl start mysql
  • sudo systemctl enable mysql

After that, configure it using the command

sudo mysql_secure_installation

Next, log in to MySQL and create: a database, a user and give him the rights to access the database, then log out of the MySQL database. You can do all this with the following commands:

  • CREATE DATABASE Databasename ;
  • CREATE USER 'Username'@'localhost' IDENTIFIED BY 'password';
  • GRANT ALL ON databasename.* TO 'ownclouduser'@'localhost' WITH GRANT OPTION;
  • FLUSH PRIVILEGES;
  • exit

Download and install owncloud

In order to download owncloud, use the command and then unpack it.

  • wget https://download.owncloud.org/community/owncloud-latest.zip
  • unzip owncloud-latest.zip

Using this command, the latest free version of your own cloud will be downloaded to your server.

After unpacking this archive, you will have an owncloud directory created, move it to the apache directory and change the owner to www-data using the commands:

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

Installing an SSL certificate

In order to install the SSL certificate protocol, you will need to enter the command and restart the apache server. This is all done by the following two commands:

sudo a2enmod ssl
sudo systemctl restart apache2

Next, we will create a secure SSL certificate using the command:

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/owncloud.key -out /etc/ssl/certs/owncloud.crt

Configuring Apache Server

Since we are using the command line, we need to enter the following command to configure:

sudo nano /etc/apache2/sites-available/owncloud.conf

After entering this command, a text editor will open in which we will configure the Apache server.
In this file, you will need to enter the following.

<VirtualHost *:443> 
ServerName localhost 
DocumentRoot /var/www/owncloud
SSLEngine on 
SSLCertificateFile /etc/ssl/certs/owncloud.crt 
SSLCertificateKeyFile /etc/ssl/private/owncloud.key
</VirtualHost>

local host - replace with your domain or IP address of the server.

It is necessary for the changes to take effect, and it is also necessary to include several additions. to do this, enter the following:

sudo a2ensite owncloud.conf
sudo a2enmod rewrite mime unique_id

After that, restart the Apache server and go to your IP address or domain. This way you will get access to your cloud storage, and also if you need you can make a redirect to HTTPS with automatic using the command

sudo nano /etc/apache2/sites-available/000-default.conf
And in this editor by entering the following:
Redirect / localhost/

After these actions, your cloud storage will be available.

List of commands:

  1. sudo apt update
  2. sudo apt upgrade
  3. sudo apt install lamp-server^-y
  4. sudo systemctl start apache2
  5. sudo systemctl enable apache2
  6. sudo apt-get install php php-gd php-curl php-mysqlnd php-intl php-json php-ldap php-mbstring php-xml php-zip -y
  7. sudo systemctl restart apache2
  8. sudo systemctl start mysql
  9. sudo systemctl enable mysql
  10. sudo mysql_secure_installation
  11. sudo mysql 
  12. CREATE DATABASE Databasename ;
  13. CREATE USER 'Username'@'localhost' IDENTIFIED BY 'password';
  14. GRANT ALL ON databasename.* TO 'ownclouduser'@'localhost' WITH GRANT OPTION;
  15. FLUSH PRIVILEGES;
  16. exit
  17. wget https://download.owncloud.org/community/owncloud-latest.zip
  18. unzip owncloud-latest.zip
  19. sudo mv owncloud /var/www/
  20. sudo chown -R www-data: /var/www/owncloud
  21. sudo a2enmod ssl
  22. sudo systemctl restart apache2
  23. sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/owncloud.key -out /etc/ssl/certs/owncloud.crt
  24. sudo nano /etc/apache2/sites-available/owncloud.conf
  25. <VirtualHost *:443> 
    ServerName localhost 
    DocumentRoot /var/www/owncloud
    SSLEngine on 
    SSLCertificateFile /etc/ssl/certs/owncloud.crt 
    SSLCertificateKeyFile /etc/ssl/private/owncloud.key
    </VirtualHost>
  26. sudo a2ensite owncloud.conf
  27. sudo a2enmod rewrite mime unique_id
  28. sudosystemctl restart apache2
  29. sudo nano /etc/apache2/sites-available/000-default.conf
  30. Redirect / localhost/