How to install Nextcloud in Debian 10. Access your files from anywhere, freely self hosted!
This tutorial is designed to act as a companion to the below YouTube video on how to accomplish this, these are the commands so that you can easily copy and paste them into your terminal.
Firstly, you need to create the directories that you will store your Nextcloud data in:
$ cd / $ sudo mkdir cloud $ sudo chown -R www-data:www-data /cloud
Firstly, make sure your repos are up to date:
$ sudo apt update
Then, use the below command to install the prerequisites for Docker:
$ sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
We can now use the following command to add the GPG key:
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
Now use these commands to add and update the repositories:
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" $ sudo apt update
Use the following command to install Docker:
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Now use this command to make your current user able to manage Docker:
$ sudo usermod -aG docker $USER
Now, reboot the system:
$ sudo reboot
Once the system has rebooted, run this command to test your installation, you should get a message saying your setup is working as it should.
$ sudo docker run hello-world
Install Docker Compose
You now need to install Docker Compose so that Nextcloud will install correctly, run the following command to download it:
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Now, run these two commands to configure it correctly:
$ sudo chmod +x /usr/local/bin/docker-compose $ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
To test Docker Compose, run the following command. You should get a screen telling you the version number of Docker Compose:
$ docker-compose --version
We now need to install Portainer in its own container. To start doing this, navigate to the ~/ folder:
$ cd ~/
Now, run these two commands in order to install Portainer in its own container:
$ docker volume create portainer_data $ docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
Configure MariaDB and Nextcloud
Watch the following video so that you know how to do this, then you’re done!