What's new

Tutorial How to build your own cloud storage using your own computer and access it anywhere

mtcddppi

Eternal Poster
Joined
Jan 28, 2017
Posts
572
Reaction
424
Points
265
Good day! Today, I'm going to show you on how to create your own cloud storage using your own computer and make it accessible anytime and anywhere. Before we start, let's know first the things that we need. We need an Ubuntu OS. Ubuntu is a free and open-source Linux distribution based on Debian. You can use Ubuntu as a server and even a desktop computer. We also need a Nextcloud. Nextcloud is a suite of client-server software for creating and using file hosting services. Nextcloud application functionally is similar to Dropbox. Unlike Dropbox, Nextcloud does not offer off-premises file storage hosting. Once we have these, the other requirements for creating a Nextcloud will follow. Now let's do this.

Requirements:
- Your computer (with Ubuntu OS)
you can format your computer using your bootable USB drive. Download ubuntu You do not have permission to view the full content of this post. Log in or register now.
- Nextcloud
  • Internet (we really need this thing obviously)
  • PHP (don't worry. even if you don't know how to code PHP, you can still build your own cloud storage)
  • MariaDB (we need this for database)
  • Let's encrypt (to create a SSL certificate)
  • Brain.exe

Note that every requirements above is downloadable and I'm going to provide it with steps.

STEPS:

1. Format your computer with Ubuntu using your bootable flash drive. If you don't know how to create a bootable USB and you don't know how to format, watch it here. If you don't want to format your computer, try it with your extra computer if you have.
2. Once you have your Ubuntu OS ready, open your terminal. Terminal is just the same as CMD or Command Prompt in Windows.
3. In your terminal, type in: sudo apt install apache2 and then hit enter. This will install an apache2.
4. After you successfully intalled the apache2, we will disable the directory listing. To do that, type in:

sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/apache2/apache2.conf

5. Now stop the apache2 service by typing: sudo systemctl stop apache2.service
6. Then start the apache2 service by typing: sudo systemctl start apache2.service
7. After you started the apache2, enable it by typing: sudo systemctl enable apache2.service

This is very important so that if our Ubuntu system restarts, the apache2 will automatically run and you don't have to enable it manually.

8. Now let's install MariaDB. This will handle our database. To install, type in: sudo apt-get install mariadb-server mariadb-client
9. After installing the MariaDB, we need to stop its service. To do that, type in: sudo systemctl stop mysql.service
10. Then start the MariaDB by typing: sudo systemctl start mysql.service
If the sudo systemctl start mysql.service won't work, try to type: systemctl start mariadb or service mariadb start.
11. Once you're done, let's open up the MySQL server to setup a secure password and change some settings. To do that, type in: sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.
  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y
12. After setting up MySQL server, restart your MariaDB by typing: sudo systemctl restart mysql.service
13. Now we're done with MariaDB setup. let's install PHP 7 and its modules. First, we need the packages. To do that, type in: sudo apt-get install software-properties-common
14. After that, we will add the repository by typing: sudo add-apt-repository ppa:eek:ndrej/php
15. Now let's check the updated repository. To do that, type in: sudo apt update
16. Now we can install the PHP 7 and its modules by typing:

sudo apt install php7.1 libapache2-mod-php7.1 php7.1-common libapache2-mod-php7.1 php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-apcu php7.1-smbclient php7.1-ldap php7.1-redis php7.1-gd php7.1-xml php7.1-intl php7.1-json php7.1-imagick php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl

Please follow the commands or just simply copy and paste it.


17. Once you're done installing everything, let's open up the php.ini file. To do that, type in: sudo nano /etc/php/7.1/apache2/php.ini
18. Then make the change the following lines below in the file and save.

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 64M
max_execution_time = 360

NOTE: this is very tricky as you need to scroll down to find these things. Don't worry, it's worth it anyways. :)


19. Now, let's create a Nextcloud database. Let's open up MySQL by typing: sudo mysql -u root -p
NOTE: It will ask for your MySQL password that you created earlier in STEP 11.

20. Once you're in, type the SQL command: CREATE DATABASE nextcloud;
this will create a database named nextcloud.
21. Let's create a database user to what ever name you like with the new password by typing: CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'new_password_here';

Example: CREATE USER 'kismet07'@'localhost' IDENTIFIED BY 'mypass123456';


22. After that, let's give kismet07@localhost a full access to our database by typing:
GRANT ALL ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

23. After that, let's save the changes by typing:

FLUSH PRIVILEGES;
and then type in:
EXIT;

24. Now let's download and install nextcloud. First, we will go to You do not have permission to view the full content of this post. Log in or register now. and then click GET NEXTCLOUD button.
1564793752267.png

25. After that, click Download for Server.
1564793799679.png


26. Right click the Download Nextcloud and then choose Copy link address.
1564793911211.png

As of now, the latest version is You do not have permission to view the full content of this post. Log in or register now.

27. you can just copy that above if you don't know how to copy the link address.
28. Let's go back to terminal and then type in:

cd /tmp && wget THE-LINK-OF-THE-NEXTCLOUD-FILE

EXAMPLE: cd /tmp && wget You do not have permission to view the full content of this post. Log in or register now.


29. Now let's download zip if you don't have one. To download and install zip, type in: apt-get install zip unzip
30. Now that you have zip, let's unzip the nextcloud by typing: unzip THE-NEXTCLOUD-ZIP-FILE

EXAMPLE: unzip nextcloud-16.0.3.zip

NOTE: the current version of the nextcloud is nextcloud-16.0.3.zip. In the future, this will change so you should change it to avoid errors.


31. Let's move the nextcloud file to /var/www/html/nextcloud/ by typing: sudo mv nextcloud /var/www/html/nextcloud/
32. Now let's give it the right permission by typing: sudo chown -R www-data:www-data /var/www/html/nextcloud/
33. After that, type in: sudo chmod -R 755 /var/www/html/nextcloud/
34. Now let's configure the apache by opening the nextcloud.conf. Type in: sudo nano /etc/apache2/sites-available/nextcloud.conf
35. Copy and paste the code below to your nextcloud.conf:

<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/nextcloud/
ServerName example.com
ServerAlias example.com

Alias /nextcloud "/var/www/html/nextcloud/"

<Directory /var/www/html/nextcloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

NOTE: you should change the server admin to what ever you like.
NOTE: you should change the server name and server alias to your registered domain name.
NOTE: do not include "www" in server alias


36. Save the file by pressing CTRL+X and then press Y and then press ENTER.
37. After configuring the VirtualHost above, enable it by running the commands below:

sudo a2ensite nextcloud.conf
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime

NOTE: type the commands above one by one.


38. After that, restart your Apache2 by typing: sudo systemctl restart apache2.service
39. Now let's install Let's Encrypt SSL by typing: sudo apt-get install python-certbot-apache
40. Once installed, obtain the free ssl certificate by typing: sudo certbot --apache -m admin@example.com -d example.com -d You do not have permission to view the full content of this post. Log in or register now.

EXAMPLE: let's say that my domain name is go-cloud.ddns.net, I will run the command by typing sudo certbot --apache -m kismet07@go-cloud.ddns.net -d go-cloud.ddns.net -d go-cloud.ddns.net


41.
After running the above commands, you should get prompted to accept the licensing terms. If everything is checked, the client should automatically install the free SSL/TLS certificate and configure the Apache2 site to use the certs.

Please read the Terms of Service at
You do not have permission to view the full content of this post. Log in or register now.. You must
agree in order to register with the ACME server at
You do not have permission to view the full content of this post. Log in or register now.
-------------------------------------------------------------------------------
(A)gree/(C)ancel: A


42. Choose Yes ( Y ) to share your email address

Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: Y


43. This is how easy is it to obtain your free SSL/TLS certificate for your Nginx powered website.

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2


43. Pick option 2 to redirect all traffic over HTTPS. This is important!

We are done!

Now let's move to port forwarding and hosting.

43. Let's go to no-ip.com and register an account if you don't have an account.
44. create a new hostname in no-ip by clicking DYNAMIC DNS menu. There, you should see a button CREATE HOSTNAME.
45. Once you created your hostname, click the date in Last update column.
1564795161264.png


46. Once you clicked the last update date, a modal will pop-up.
1564795202891.png

47. click on Configure Now button. After that, you will see a page like this:
1564795244661.png

48. Click the button Next Step.
49. In next step, type in your router name and the connection type. our connection type should be apache. After that, click Next Step.
1564795430585.png

50. After that, you will be asked if there is a computer always running on your network. just choose yes.
1564795520442.png

51. It will require you to download DUC. just download it and install it.
52. Now click Next step. It will show you the default ports which is used by apache.
1564795590930.png

53. We need to forward these ports. Before proceeding to next step, let's forward the port. In my case, I am using PLDT.
54. Log in to your PLDT administrator. It should look like this:
1564795722336.png

55. Now click on Application > Port fowarding. It should look like this:
1564795797219.png

56. Now open another terminal in your Ubuntu OS and then type in: ifconfig
this will let us now if what's our local IP address. let's say we have 192.168.1.14 as our local address.

NOTE: ifconfig is the same as ipconfig in Windows OS.

57. Now let's forward the port 80 and 443 with our local ip address. click on ADD button in your PLDT web interface. it should look like this if you want to add a port forward for port 80.
1564796015577.png

58. Do the same in 443. add another port forward for your port 443. this time, the public and private port should be 443.
1564796161819.png

59. Now let's check if the ports 80 and 443 is already forwarded by going to You do not have permission to view the full content of this post. Log in or register now..
60. The ports 80 and 443 should be forwarded successfully. if it's not forwarded, that means that the apache is not running.
61. Go back to your no-ip and proceed to next step. What will it do is that.. it will check your port 80 if it's being forwarded. if it is, hitting next step button will make your configuration done.
62. Once you're done with configuring your no-ip hostname, go to your nextcloud website with your no-ip hostname. for example: go-cloud.ddns.net

That's it and you have your own cloud storage which is accessible any time and anywhere. If you are confused or having a lot of questions in your mind, please feel free to comment or PM me.
 

Attachments

Good day! Today, I'm going to show you on how to create your own cloud storage using your own computer and make it accessible anytime and anywhere. Before we start, let's know first the things that we need. We need an Ubuntu OS. Ubuntu is a free and open-source Linux distribution based on Debian. You can use Ubuntu as a server and even a desktop computer. We also need a Nextcloud. Nextcloud is a suite of client-server software for creating and using file hosting services. Nextcloud application functionally is similar to Dropbox. Unlike Dropbox, Nextcloud does not offer off-premises file storage hosting. Once we have these, the other requirements for creating a Nextcloud will follow. Now let's do this.

Requirements:
- Your computer (with Ubuntu OS)
you can format your computer using your bootable USB drive. Download ubuntu You do not have permission to view the full content of this post. Log in or register now.
- Nextcloud

    • Internet (we really need this thing obviously)
    • PHP (don't worry. even if you don't know how to code PHP, you can still build your own cloud storage)
    • MariaDB (we need this for database)
    • Let's encrypt (to create a SSL certificate)
    • Brain.exe

Note that every requirements above is downloadable and I'm going to provide it with steps.

STEPS:

1. Format your computer with Ubuntu using your bootable flash drive. If you don't know how to create a bootable USB and you don't know how to format, watch it You do not have permission to view the full content of this post. Log in or register now.. If you don't want to format your computer, try it with your extra computer if you have.
2. Once you have your Ubuntu OS ready, open your terminal. Terminal is just the same as CMD or Command Prompt in Windows.
3. In your terminal, type in: sudo apt install apache2 and then hit enter. This will install an apache2.
4. After you successfully intalled the apache2, we will disable the directory listing. To do that, type in:

sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/apache2/apache2.conf

5. Now stop the apache2 service by typing: sudo systemctl stop apache2.service
6. Then start the apache2 service by typing: sudo systemctl start apache2.service
7. After you started the apache2, enable it by typing: sudo systemctl enable apache2.service

This is very important so that if our Ubuntu system restarts, the apache2 will automatically run and you don't have to enable it manually.

8. Now let's install MariaDB. This will handle our database. To install, type in: sudo apt-get install mariadb-server mariadb-client
9. After installing the MariaDB, we need to stop its service. To do that, type in: sudo systemctl stop mysql.service
10. Then start the MariaDB by typing: sudo systemctl start mysql.service
If the sudo systemctl start mysql.service won't work, try to type: systemctl start mariadb or service mariadb start.
11. Once you're done, let's open up the MySQL server to setup a secure password and change some settings. To do that, type in: sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.
  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y
12. After setting up MySQL server, restart your MariaDB by typing: sudo systemctl restart mysql.service
13. Now we're done with MariaDB setup. let's install PHP 7 and its modules. First, we need the packages. To do that, type in: sudo apt-get install software-properties-common
14. After that, we will add the repository by typing: sudo add-apt-repository ppa:eek:ndrej/php
15. Now let's check the updated repository. To do that, type in: sudo apt update
16. Now we can install the PHP 7 and its modules by typing:

sudo apt install php7.1 libapache2-mod-php7.1 php7.1-common libapache2-mod-php7.1 php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-apcu php7.1-smbclient php7.1-ldap php7.1-redis php7.1-gd php7.1-xml php7.1-intl php7.1-json php7.1-imagick php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl

Please follow the commands or just simply copy and paste it.


17. Once you're done installing everything, let's open up the php.ini file. To do that, type in: sudo nano /etc/php/7.1/apache2/php.ini
18. Then make the change the following lines below in the file and save.

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 64M
max_execution_time = 360

NOTE: this is very tricky as you need to scroll down to find these things. Don't worry, it's worth it anyways. :)


19. Now, let's create a Nextcloud database. Let's open up MySQL by typing: sudo mysql -u root -p
NOTE: It will ask for your MySQL password that you created earlier in STEP 11.

20. Once you're in, type the SQL command: CREATE DATABASE nextcloud;
this will create a database named nextcloud.
21. Let's create a database user to what ever name you like with the new password by typing: CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'new_password_here';

Example: CREATE USER 'kismet07'@'localhost' IDENTIFIED BY 'mypass123456';


22. After that, let's give kismet07@localhost a full access to our database by typing:
GRANT ALL ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

23. After that, let's save the changes by typing:

FLUSH PRIVILEGES;
and then type in:
EXIT;

24. Now let's download and install nextcloud. First, we will go to You do not have permission to view the full content of this post. Log in or register now. and then click GET NEXTCLOUD button.
View attachment 657837
25. After that, click Download for Server.
View attachment 657842

26. Right click the Download Nextcloud and then choose Copy link address.
View attachment 657844
As of now, the latest version is You do not have permission to view the full content of this post. Log in or register now.

27. you can just copy that above if you don't know how to copy the link address.
28. Let's go back to terminal and then type in:

cd /tmp && wget THE-LINK-OF-THE-NEXTCLOUD-FILE

EXAMPLE: cd /tmp && wget You do not have permission to view the full content of this post. Log in or register now.


29. Now let's download zip if you don't have one. To download and install zip, type in: apt-get install zip unzip
30. Now that you have zip, let's unzip the nextcloud by typing: unzip THE-NEXTCLOUD-ZIP-FILE

EXAMPLE: unzip nextcloud-16.0.3.zip

NOTE: the current version of the nextcloud is nextcloud-16.0.3.zip. In the future, this will change so you should change it to avoid errors.


31. Let's move the nextcloud file to /var/www/html/nextcloud/ by typing: sudo mv nextcloud /var/www/html/nextcloud/
32. Now let's give it the right permission by typing: sudo chown -R www-data:www-data /var/www/html/nextcloud/
33. After that, type in: sudo chmod -R 755 /var/www/html/nextcloud/
34. Now let's configure the apache by opening the nextcloud.conf. Type in: sudo nano /etc/apache2/sites-available/nextcloud.conf
35. Copy and paste the code below to your nextcloud.conf:

<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/nextcloud/
ServerName example.com
ServerAlias example.com

Alias /nextcloud "/var/www/html/nextcloud/"

<Directory /var/www/html/nextcloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

NOTE: you should change the server admin to what ever you like.
NOTE: you should change the server name and server alias to your registered domain name.
NOTE: do not include "www" in server alias


36. Save the file by pressing CTRL+X and then press Y and then press ENTER.
37. After configuring the VirtualHost above, enable it by running the commands below:

sudo a2ensite nextcloud.conf
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime

NOTE: type the commands above one by one.


38. After that, restart your Apache2 by typing: sudo systemctl restart apache2.service
39. Now let's install Let's Encrypt SSL by typing: sudo apt-get install python-certbot-apache
40. Once installed, obtain the free ssl certificate by typing: sudo certbot --apache -m admin@example.com -d example.com -d You do not have permission to view the full content of this post. Log in or register now.

EXAMPLE: let's say that my domain name is go-cloud.ddns.net, I will run the command by typing sudo certbot --apache -m kismet07@go-cloud.ddns.net -d go-cloud.ddns.net -d go-cloud.ddns.net


41.
After running the above commands, you should get prompted to accept the licensing terms. If everything is checked, the client should automatically install the free SSL/TLS certificate and configure the Apache2 site to use the certs.

Please read the Terms of Service at
You do not have permission to view the full content of this post. Log in or register now.. You must
agree in order to register with the ACME server at
You do not have permission to view the full content of this post. Log in or register now.
-------------------------------------------------------------------------------
(A)gree/(C)ancel: A


42. Choose Yes ( Y ) to share your email address

Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: Y


43. This is how easy is it to obtain your free SSL/TLS certificate for your Nginx powered website.

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2


43. Pick option 2 to redirect all traffic over HTTPS. This is important!

We are done!

Now let's move to port forwarding and hosting.

43. Let's go to no-ip.com and register an account if you don't have an account.
44. create a new hostname in no-ip by clicking DYNAMIC DNS menu. There, you should see a button CREATE HOSTNAME.
45. Once you created your hostname, click the date in Last update column.
View attachment 657848

46. Once you clicked the last update date, a modal will pop-up.
View attachment 657849
47. click on Configure Now button. After that, you will see a page like this:
View attachment 657850
48. Click the button Next Step.
49. In next step, type in your router name and the connection type. our connection type should be apache. After that, click Next Step.
View attachment 657851
50. After that, you will be asked if there is a computer always running on your network. just choose yes.
View attachment 657854
51. It will require you to download DUC. just download it and install it.
52. Now click Next step. It will show you the default ports which is used by apache.
View attachment 657855
53. We need to forward these ports. Before proceeding to next step, let's forward the port. In my case, I am using PLDT.
54. Log in to your PLDT administrator. It should look like this:
View attachment 657856
55. Now click on Application > Port fowarding. It should look like this:
View attachment 657857
56. Now open another terminal in your Ubuntu OS and then type in: ifconfig
this will let us now if what's our local IP address. let's say we have 192.168.1.14 as our local address.

NOTE: ifconfig is the same as ipconfig in Windows OS.

57. Now let's forward the port 80 and 443 with our local ip address. click on ADD button in your PLDT web interface. it should look like this if you want to add a port forward for port 80.
View attachment 657863
58. Do the same in 443. add another port forward for your port 443. this time, the public and private port should be 443.
View attachment 657864
59. Now let's check if the ports 80 and 443 is already forwarded by going to You do not have permission to view the full content of this post. Log in or register now..
60. The ports 80 and 443 should be forwarded successfully. if it's not forwarded, that means that the apache is not running.
61. Go back to your no-ip and proceed to next step. What will it do is that.. it will check your port 80 if it's being forwarded. if it is, hitting next step button will make your configuration done.
62. Once you're done with configuring your no-ip hostname, go to your nextcloud website with your no-ip hostname. for example: go-cloud.ddns.net

That's it and you have your own cloud storage which is accessible any time and anywhere. If you are confused or having a lot of questions in your mind, please feel free to comment or PM me.
haba ahahaha , salamats
 
Back
Top