Learning by doing.
Nextcloud is a cloud service like Dropbox but runs on your own server with potentially much larger storage. If you have a Linux machine with internet access and large storage, it might be a good idea to setup Nextcloud to synchronize your files. In this post, we will build Nextcloud step by step.
This section is following this post with slight modification. First, install the LAMP server and stuff:
sudo apt-get install lamp-server sudo apt-get install libxml2-dev php-zip php-dom php-xmlwriter php-xmlreader php-gd php-curl php-mbstring a2enmod rewrite sudo apt-get install mariadb-server
/etc/apache2/sites-available as following:
Alias /nextcloud "/var/www/html/nextcloud/" <Directory /var/www/html/nextcloud/> Options +FollowSymlinks AllowOverride All <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/html/nextcloud SetEnv HTTP_HOME /var/www/html/nextcloud </Directory>
and then create a symlink
ln -s /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-enabled/nextcloud.conf
After that, configure Apache modules
sudo a2enmod headers sudo a2enmod env sudo a2enmod dir sudo a2enmod mime sudo service apache2 reload
Now configure MariaDB, first login MySQL as root
sudo mysql -u root -p
CREATE DATABASE nextcloud; CREATE USER nextclouduser@localhost IDENTIFIED BY ‘PASSWORD’; (Where PASSWORD is a password you want to use for the nextcloud database users) GRANT ALL PRIVILEGES ON nextcloud.* TO nextclouduser@localhost; EXIT
Now the database is ready, let’s configure Nextcloud.
First, let’s download the zip file to your sever and unzip it to the right place
wget https://download.nextcloud.com/server/releases/nextcloud-13.0.4.zip unzip nextcloud-13.0.4.zip -d /var/www/html/
Then one can access Nextcloud by the localhost IP, something like 192.168.1.xxx, and one will see a webpage of Nextcloud, in which an acount can be created, and the information of the database we just set should be typed in.
After that, one can download the macOS/Windows/iOS client and start using Nextcloud as a localhost service, but a true cloud service should be accessed externally.
To access your own server externally/remotely, we need a DDNS service. I used No-IP. Just type in the DDNS information in your router. Then we need to configure Port Forwarding. For
ssh, we need to forward the internal port
22, and for
http we need port
Nextcloud needs also
After that, one need to modify
/var/www/html/nextcloud/config/config.php and add a line about your DDNS domain information, something like
array ( 0 => '192.168.1.144', 1 => 'xxx.ddns.net', ),
With those steps, Nextcloud is ready for external access.