Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Help about MediaWiki
FUTO
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Introduction to a Self Managed Life: a 13 hour & 28 minute presentation by FUTO software
(section)
Main Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Installing Nextcloud for notes == Nextcloud notes we install via docker. We will install ONLY the notes component when we enter the web interface so the least amount of nextcloud is on our system as is necessary. <span id="step-1-ssh-into-the-androidstuff-virtual-machine-computer"></span> === Step 1: SSH into the androidstuff virtual machine computer === <pre>ssh louis@192.168.5.5</pre> OR <pre>ssh louis@androidstuff.home.arpa</pre> <span id="step-2-install-docker"></span> === Step 2: Install docker === <span id="verify-docker-installation-1"></span> ==== 2.1 Verify Docker installation: ==== <span id="if-you-elected-to-install-immich-or-onlyoffice-on-this-virtual-machine-this-part-is-already-done-you-can-skip-to-step-3"></span> ===== IF YOU ELECTED TO INSTALL IMMICH OR ONLYOFFICE ON THIS VIRTUAL MACHINE, THIS PART IS ALREADY DONE & YOU CAN SKIP TO STEP 3! ===== **If you installed onlyoffice or immich on the androidstuff virtual machine, & followed the instructions for it, you already installed docker properly on this virtual machine, and have no need to do this again. Skip to step 3 if that is the case. Run <code>docker --version</code> and make sure the version is 24.0.0 or later. If not, remove the old version: <pre>sudo apt remove docker docker-engine docker.io containerd runc</pre> <span id="install-docker-using-official-docker-script-4"></span> ==== 2.3 Install Docker using official Docker script: ==== <pre>curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh</pre> <blockquote>'''Note:''' It’s very important to use the official Docker installation and not the Snap version. The Snap version can cause issues due to its sandboxed nature, making it a mess for <code>mailcow</code>’s requirements. It is bad for our purposes, don’t use it. </blockquote> <span id="install-docker-compose-prerequisites-1"></span> ==== 2.4 Install Docker Compose & prerequisites: ==== <pre>sudo apt install docker-compose-plugin -y sudo systemctl enable --now docker</pre> <span id="make-sure-it-worked-1"></span> ==== 2.5 Make sure it worked ==== Run <code>docker compose version</code> and make sure the version is 2.0 or higher. <span id="step-3-install-nextcloud-using-docker"></span> === Step 3: Install nextcloud using docker === <span id="create-directory-to-store-docker-compose-file-volumes"></span> ==== 3.1 Create directory to store Docker Compose file & volumes: ==== <pre>mkdir -p ~/nextcloud && cd ~/nextcloud</pre> <span id="copy-your-docker-compose.yml-file-into-this-directory-or-create-it"></span> ==== 3.2 Copy your <code>docker-compose.yml</code> file into this directory or create it: ==== <pre>nano docker-compose.yml</pre> '''Paste the content below:''' <pre>services: db: image: mariadb:10.11 restart: always command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW volumes: - db:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=rootpasswd - MYSQL_PASSWORD=dbpasswd - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud redis: image: redis:alpine restart: always app: image: nextcloud restart: always ports: - 8089:80 depends_on: - redis - db volumes: - nextcloud:/var/www/html environment: - MYSQL_PASSWORD=dbpasswd - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - MYSQL_HOST=db - NEXTCLOUD_TRUSTED_DOMAINS=192.168.5.5 192.168.5.0/24 192.168.6.0/24 volumes: nextcloud: db:</pre> '''Save and exit the file.''' I’ll help reformat this markdown to ensure each line starts with “>” and remove the horizontal rules (“—”) while preserving all the original text exactly. Here’s the reformatted version: <blockquote>'''DOCKER CHEAT SHEET: going over the <code>docker-compose.yml</code> for nextcloud''' This file sets up three services (containers): one for the Nextcloud app, one for the database (MariaDB), & one for caching (Redis). Let’s go through it line by line so you understand what’s going on. '''1. <code>services:</code>''' This section lists the containers (services) that make up the Nextcloud deployment. Each container plays a specific role in the overall application. '''Database (<code>db</code>)''' '''2. <code>db:</code>''' This is the MariaDB database container. MariaDB is a database similar to mysql database. It’s where nextcloud stores info on users, settings, files, etc. '''3. <code>image: mariadb:10.11</code>''' This tells Docker to use the MariaDB 10.11 image. It’s a specific version of MariaDB that ensures compatibility with the version of Nextcloud you’re running. This is why docker is awesome; this just pulls the right version of the right program. You don’t have to worry about this. The maintainers of the software provide template <code>docker-compose.yml</code> files that rarely need more than minimal adjustment to work for your needs. No dependency rabbit hole to hell. '''4. <code>restart: always</code>''' Makes the database container restart automatically if it crashes or when the system reboots, and has it start up when you turn on the virtual machine(or computer, if you are installing directly onto the host machine) '''5. <code>command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW</code>''' Customizes how MariaDB runs: - <code>--transaction-isolation=READ-COMMITTED</code>: Prevents dirty reads, ensuring reliable database transactions. - <code>--log-bin=binlog</code>: Enables binary logging for replication (useful for backups or scaling). - <code>--binlog-format=ROW</code>: Logs changes at the row level for better replication accuracy. '''6. <code>volumes:</code>''' * <code>db:/var/lib/mysql</code>: Maps the container’s <code>/var/lib/mysql</code> directory (where the database stores its files) to the <code>db</code> volume. This makes data persist even if the container is removed or restarted as it is stored to a volume(remember containers are like linux livecds, nothing is saved when you reboot them) '''7. <code>environment:</code>''' These environment variables configure MariaDB: - <code>MYSQL_ROOT_PASSWORD=rootpasswd</code>: Sets the root password for MariaDB. - <code>MYSQL_PASSWORD=dbpasswd</code>: Password for the <code>nextcloud</code> user, who will access the database. - <code>MYSQL_DATABASE=nextcloud</code>: Creates a database named <code>nextcloud</code> during container setup. - <code>MYSQL_USER=nextcloud</code>: Creates a database user named <code>nextcloud</code>. '''Redis (<code>redis</code>)''' '''8. <code>redis:</code>''' This is the Redis container which is a caching system that speeds up Nextcloud by temporarily storing frequently used data. “Speeds up” in the theoretical sense. Nothing speeds up nextcloud. '''9. <code>image: redis:alpine</code>''' Specifies the Redis image to use. The <code>alpine</code> tag uses a lightweight version of Redis for minimal resource usage. '''10. <code>restart: always</code>''' Automatically restarts the Redis container if it crashes or when the system reboots. '''Nextcloud Application (<code>app</code>)''' '''11. <code>app:</code>''' This is the main container for the Nextcloud application. It provides the web interface and handles user requests. '''12. <code>image: nextcloud</code>''' Tells Docker to use the official Nextcloud image. '''13. <code>restart: always</code>''' Ensures the Nextcloud container restarts if it crashes or when the system reboots. '''14. <code>ports:</code>''' * <code>8089:80</code>: Maps port 80 in the container (Nextcloud’s default web server port) to port 8089 on the host. You’ll access Nextcloud in your browser at <code>http://192.168.5.5:8089</code> since this is being set up on the <code>androidstuff</code> virtual machine. '''15. <code>depends_on:</code>''' Ensures that <code>redis</code> and <code>db</code> containers start before the Nextcloud container. Without this, Nextcloud would crash while waiting for its database and caching system. '''16. <code>volumes:</code>''' * <code>nextcloud:/var/www/html</code>: Links the container’s <code>/var/www/html</code> directory (where Nextcloud’s files live) to the <code>nextcloud</code> volume. This ensures Nextcloud’s data persists even if the container is recreated. '''17. <code>environment:</code>''' Configures the Nextcloud container with the following environment variables: - <code>MYSQL_PASSWORD=dbpasswd</code>: Matches the database user’s password set in the <code>db</code> service. - <code>MYSQL_DATABASE=nextcloud</code>: Specifies the name of the database created in the <code>db</code> service. - <code>MYSQL_USER=nextcloud</code>: Specifies the database user created in the <code>db</code> service. - <code>MYSQL_HOST=db</code>: Tells Nextcloud where to find the database (the <code>db</code> service within this <code>docker-compose.yml</code>). - <code>NEXTCLOUD_TRUSTED_DOMAINS=192.168.5.5 192.168.5.0/24 192.168.6.0/24</code>: Lists IP addresses or subnets that are allowed to access the Nextcloud instance. I want nextcloud to be accessible when I am on my LAN which is the same network as nextcloud, and I also want it to be accessible when I am connecting to my home server using my VPN, so I have put my LAN of <code>192.168.5.0/24</code> & my VPN network of <code>192.168.6.0/24</code> '''Volumes''' '''18. <code>volumes:</code>''' Defines persistent storage for Nextcloud and MariaDB: - <code>nextcloud</code>: Stores Nextcloud’s files. - <code>db</code>: Stores MariaDB’s database files. '''FINAL NOTE:''' This <code>docker-compose.yml</code> file sets up a fully functional Nextcloud deployment with three containers working together: - '''MariaDB (db):''' Handles data storage for Nextcloud. - '''Redis (redis):''' Speeds up Nextcloud by caching frequently used data. - '''Nextcloud (app):''' Provides the web interface and file management. The volumes ensure your data persists, and the environment variables make configuration easy. By using this file, you avoid dependency hell and can back up your Nextcloud setup easily by saving the volumes and <code>docker-compose.yml</code> file. </blockquote> <span id="deploy-the-containers"></span> ==== 3.4 Deploy the Containers ==== Run Docker Compose to start nextcloud: <pre>docker-compose up -d</pre> <div class="figure"> <gallery mode="packed-hover" heights=250 widths=400 perrow=2> File:image-20241202040521824.png </gallery> </div> <div class="figure"> <gallery mode="packed-hover" heights=250 widths=400 perrow=2> File:image-20241202040603166.png </gallery> </div> <div class="figure"> <gallery mode="packed-hover" heights=250 widths=400 perrow=2> File:image-20241202040734008.png </gallery> </div> <div class="figure"> <gallery mode="packed-hover" heights=250 widths=400 perrow=2> File:image-20241202040816607.png </gallery> </div> <span id="access-nextcloud-for-first-time"></span>
Summary:
Please note that all contributions to FUTO may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
FUTO:Copyrights
for details).
Do not submit copyrighted work without permission!
To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:
Cancel
Editing help
(opens in new window)