Install Nextcloud in Ubuntu 20.04, 18.04 and 16.04 using Docker and Portainer

How to install Nextcloud in Ubuntu 20.04, 18.04, and 16.04. Access your files from anywhere!

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.

Create Directories

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

Install Docker

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 commands to add the GPG key:

$ curl -fsSL | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88

Now use these commands to add and update the repositories:

$ sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
$ sudo apt update

Use the following command to install Docker:

$ sudo apt-get install docker-ce docker-ce-cli

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 "$(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

Install Portainer

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!

Give Ubuntu a startup beep using the PC Speaker.

Want conformation when your computer’s booted? Find out how and always know when it’s on.

What happened to startup sounds? Both Ubuntu and Windows used to have one, but they seem to have gone out of fashion, and I don’t see why. They’re quite a useful indicator as to what your computer is doing especially when you can’t see it. Macs are the only computers that have kept their startup sound but it isn’t the most useful as it happens the second you press the power button, not when the system has actually booted.

In this tutorial, I’ll show you how to get a startup beep through the PC Speaker on Ubuntu, which is useful for all computers, but especially useful for servers that have no proper speaker and no monitor attached.

Install Beep

$ sudo apt update
$ sudo apt install beep

Configure Beep and Ubuntu

You’ll want to get the machine to produce a rising tone on startup and a descending tone on shutdown. Follow these instructions to create a short script to handle this behaviour.

$ sudo nano /etc/init.d/beep

To make things easier, the script below is configured to do exactly what you’ll need, so just copy the following into the /etc/init.d/beep file.

#! /bin/sh -e
# Provides:          beep
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: beep
# Description:

# Carry out specific functions (start, stop, restart etc)
case "$1" in
    beep -l 75 -f 500 -n -l 75 -f 1000 -n -l 75 -f 2000 -n -l 75 -f 3000
    beep -l 75 -f 3000 -n -l 75 -f 2000 -n -l 75 -f 1000 -n -l 75 -f 500
    echo "Usage: /etc/init.d/beep {start|stop}"
    exit 1

exit 0

In order to make Ubuntu sound the startup sound on startup and shutdown, you’ll need to run the following in your terminal.

$ sudo chmod a+x /etc/init.d/beep
$ sudo update-rc.d beep defaults 01

Now, on Ubuntu, there is a blacklist for the PC Speaker that is enabled by default, so we’ll need to run these commands in order to remove that.

$ sudo modprobe pcspkr

This will temporarily allow the PC Speaker to work, but we’ll want to make this permanent. So, open the following file in your favourite editor.

$ sudo nano /etc/modprobe.d/blacklist.conf

You’ll get the following screen:

You now need to comment out the PC Speaker, so find it and comment it out with a #

To start with, it’ll look like this.
It should look like this when you’re done.

Now, save that file and exit your editor.

That’s it! Your PC will now produce startup and shutdown tones when you start it or shut it down.

Disabling the startup sound

If, for whatever reason, you’d like to disable the startup sound, just run the following command.

$ sudo update-rc.d beep remove

How to setup a Minecraft Server (PaperSpigot) on Ubuntu

How to easily setup a Minecraft environment for you and your friends to play on.

Setting up Ubuntu

Run everything as ‘sudo’ or be root.

First, ensure the server is up to date.

sudo apt update
sudo apt upgrade

Now, you need to install Java 11.

sudo apt install default-jre

Install PaperSpigot

I install my minecraft servers in the ‘/’ directory, so that’s what I’ll be doing here. I will use ‘MC’ as the name of the directory that my server will sit in.

First, make the necessary directory.

cd /
mkdir MC
cd MC

Now you need to download PaperSpigot.

Use a web browser to navigate to and then right click on the latest build and choose ‘Copy Link Address’.

Then, use wget to download the file.

wget -O paperclip.jar

Now you need to create a script so that you can start your minecraft server.


Here’s what you’ll need in the script


java -Xms512M -Xmx1024M -jar paperclip.jar

Replace the ‘1024M’ with the maximum amount of RAM you want the MC Server to have.

You now need to make the script executable.

chmod +x

Start the server


You’ll get an error saying the EULA needs to be accepted. To accept the EULA, run

sudo nano eula.txt

and change eula=false to eula=true and save.

Start the server again, after a few seconds, if you see an info message in the terminal with ‘Done!’, then the server is setup.

To stop your server, simply type ‘stop’

Run your server in the background

If you are hosting your server on a VPS, or a linux box with no GUI, you’ll probably want to run PaperSpigot in the background.

To do this, install screen

sudo apt install screen

Now, you’ll need to open an instance of screen, call it MC for Minecraft. Screen is essentially like different windows for your terminal, so you can multitask within one terminal.

screen -S "MC"

Then start your server script.

cd /MC

To return to your standard terminal, simply hold down CTRL+A+D

To return back to the MC Console, run

screen -ls

This will return your screen ID

There is a screen on:

Then run

screen -rd 73470.MC

And you’ll reattach to the minecraft log.

That’s it! You have successfully setup your Minecraft PaperSpigot server on Ubuntu, please share this tutorial if you found it useful.