Automatic Nextcloud Installation on Raspberry Pi

Nextcloud is an open source software package providing remote file sharing services. It is similar to Dropbox. But with Nextcloud, you retain ownership, security and control of the shared data. This procedure describes how to build a working Nextcloud service using just 3 commands.  It was tested successfully on a Raspberry Pi 4 running Raspberry Pi OS 10 (Buster) and Raspberry Pi OS 11 (Bullseye).  Article updated 26/3/22.

Note: If you would rather do the installation manually, step-by-step, without the help of a script, please see my previous article Simple Nextcloud Installation on Raspberry Pi. It explains how to do the installation in detail, and provides more background information on Nextcloud. Both procedures achieve the same overall result, however.

My Raspberry Pi 4 was installed with Raspberry Pi OS 11 “Bullseye” by applying the image “”, downloaded from the downloads page.

It is recommended to carry out this procedure on a fresh installation of Raspberry Pi OS.

Note: If, having completed the procedure below, you wish to convert your Nextcloud installation from HTTP to HTTPS, please see my article How to Convert a Website from HTTP to HTTPS.

Download Ansible

Ansible” is an automation system for IT infrastructures. We will use it to set up Nextcloud. Install Ansible now.

$ sudo apt-get -y install ansible

Download the build_nextcloud script from Github:

$ wget

Install Nextcloud

Now, install and configure Nextcloud. As it runs, the following command will print various informational messages to the terminal, some of which are shown below. It should complete in about 5 or 10 minutes, so be patient.

Note that Nextcloud can use 2 type of databases: SQLite and MySQL (also called “MariaDB”). I would recommend SQLite, especially if your Nextcloud installation is to have only one or two users. SQLite is more lightweight than MySQL and uses fewer resources.  On the other hand, if you are planning a larger installation, with an appreciable number of users, and particularly if you are using a Pi 4, then MySQL would be an appropriate choice.

To install Nextcloud with SQLite, use this command.  Skip to the command below it if you want to use MySQL instead.

$ sudo date ; ansible-playbook --become -c local -i "localhost," build_nextcloud.yml
Sat 18 Nov 15:48:07 UTC 2017
PLAY [] ***************************************************************
TASK [setup] *******************************************************************
ok: []

If you want to use MySQL, use the command below. It will install Nextcloud together with the MySQL database.

$ date ; ansible-playbook --become -c local -i "localhost," --extra-vars "DATABASE=mysql MYSQL_ROOT_PASSWORD=qwerty NCUSER_PASSWORD=raindrop" build_nextcloud.yml
Sat 18 Nov 15:48:07 UTC 2017
PLAY [] ***************************************************************
TASK [setup] *******************************************************************
ok: []

Note that I have chosen “querty” as the MySQL root password, and for the ncuser password, “raindrop”. You should choose your own passwords instead, and keep a note of them, as they are needed below.

Once the command completes (either command above), you will have a basic Nextcloud installation running on your Pi. Proceed as follows to create an admin user and complete the configuration.

Create a User for Nextcloud

In a browser, surf to your new Nextcloud web page. Use the URL:
http://your Pis IP address/nextcloud

For example, the address of my Pi is So I go the the URL:

You should see a mostly blue login page. In the middle is a “Performance Warning” about SQLite. Ignore that. Near the top it says “Create an admin account”. Think of a user name and password and type them into the boxes provided. Then click on the “Storage and Database” drop-down. In the “data folder” box which appears, delete what is already there and replace it with “/var/nextcloud/data”.

If you want to use SQLite as the database, then click on the “Install” button near the bottom of the page. Wait for a couple of minutes while Nextcloud completes the installation. During this time, Nextcloud creates more files and directories in our data directory, and it puts a SQLite database in there too.

If you want to use MySQL as the database, then where it says “Configure the database”, click on the button marked “MySQL/MariaDB”. Four new fields appear. Complete them as follows.

– for the database user, enter “ncuser”.
– for the database password, enter the NCUSER_PASSWORD that you chose above (“raindrop” in the example).
– for the database name, enter “nextcloud
– leave “localhost” as “localhost”.

– then click on the “Finish Setup” button near the bottom of the page. Wait for a couple of minutes while Nextcloud completes the installation. During this time, Nextcloud creates more files and directories in our data directory, and it populates the MySQL database.

Completing the Configuration

While the installation runs, a dark blue “Recommended apps” box will appear.  Click the large button labelled “Install Recommended Apps”, and a few Nextcloud add-ons are installed.

A few minutes later,  you should see the Nextcloud intro page with the legend “Nextcloud Hub II”.  Click the right arrow to read more, or click the cross at the top right of the dialogue to dismiss it. You should now be looking at the main Nextcloud page. There you can see a few widgets, such as “Recommended files” and “Talk mentions”.

Congratulations!  You have successfully installed Nextcloud!

Storing Nextcloud Data on a Separate Disk (Optional)

If you have a USB disk or thumb drive, you can use it to store the Nextcloud Data. In doing so, you might obtain more capacity for your data and/or improved performance.

First, mount your disk at a suitable location on the pi. Then proceed as follows. In this example, a thumb drive is mounted at “/disk1”. Move the Nextcloud data folder onto the drive as follows.

$ sudo mv /var/nextcloud/data /disk1/data
$ sudo ln -s /disk1/data /var/nextcloud/data

The first command moves the data. The second creates a link from the original data location to the new one. Finally, if you have Nextcloud open in a browser, refresh the page. It should reappear after a few moments. Your data has now been moved onto the disk/thumb drive. Try dragging a large file into Nextcloud – you should see the disk access light flash as the data is written.


You now have a running Nextcloud installation. I hope this article has been helpful.

80 thoughts on “Automatic Nextcloud Installation on Raspberry Pi

  1. Pingback: Simple Nextcloud Installation on Raspberry Pi | Unix etc.

  2. So i figured out what I had to do.

    sudo a2enmod rewrite headers env dir mime

    I had to run that command, at least a portion of it, to allow for php to read the index.php file correctly.

    • Forgive my noobness.

      I moved the files running the mv and ln commands given above, now I am getting a 500 error when I try to go to the nextcloud section of pi.

      How did I mess up?

      Also, now that I have this quasi running, what do you I need to do to have the pi react to a domain that I have purchased and have that domain point to my external IP?

      Again, I am a noob at some of the principles of web applications.

      Thanks for all the help already.

      • Hi Ginger, without knowing the exact state of your Pi, it is difficult to suggest why things might not be working. I would recommend re-imaging your Pi with the latest Raspbian, the doing the procedure above on the fresh Pi. It should all work.

        Your question about domain names is beyond the scope of this procedure, but my other article might be helpful. Check it out: Using a Domain Name with a Raspberry Pi Web Server


        • So I started over. I moved the data and now I am getting the error that states

          “can’t create or write data into the data directory /var/www/html/nextcloud/data”

          Any suggestions?

          • Hi Ginger, is this on a freshly re-imaged Pi ? The procedure is intended to run on newly installed Pi. Also, please post the whole output of the script, as well as the output of this command:

            cat /etc/os-release

          • Jim,

            The error comes when i try to go to the page and create my admin for the first time.

            Also, here is the output of the /etc/os-release

            PRETTY_NAME=”Raspbian GNU/Linux 9 (stretch)”
            NAME=”Raspbian GNU/Linux”
            VERSION=”9 (stretch)”

          • Hi Ginger, is this on a freshly re-imaged Pi ? The procedure is intended to run on newly installed Pi.

            You moved the data, and then got the error “can’t create or write data into the data directory /var/www/html/nextcloud/data” when you tried to create the user. However, in the procedure above, the user is created before the data is moved, not after. I am therefore not sure what you have done on the Pi, and it is difficult to advise. I would recommend that you re-image the Pi, then run the procedure above in exactly the order given on the newly installed Pi.

  3. I got a nice message that is quite weird imho.

    TASK [Restart Apache] **********************************************************
    fatal: [localhost]: FAILED! => {“changed”: false, “failed”: true, “msg”: “Unable to start service apache2: Job for apache 2.service failed because the control process exited with error code.\nSee \”systemctl status apache2.service\” and \”jour nalctl -xe\” for details.\n”}
    to retry, use: –limit @/home/pi/build_nextcloud.retry

    When I do it manually with the usual
    $ sudo service apache2 restart

    I got this error as well:
    Job for apache2.service failed because the control process exited with error code.
    See “systemctl status apache2.service” and “journalctl -xe” for details.

    What’s going on?
    And now the script failed I’m a bit worried on the mess it already installed and that I will not be able to clean properly :s

    • Hi Jeremy, that is strange. Is this a fresh installation of Raspbian, or a Pi that has been running for some time?

      Please post the output of the following 2 commands:

      tail /var/log/apache/error.log
      journalctl -xe


  4. I have a new Pi 3. I successfully installed:
    – pihole
    – openvpn
    – Plex Server

    “journalctl -xe” is returning:

    nov. 30 20:30:45 raspberrypi apachectl[23560]: AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using S
    nov. 30 20:30:45 raspberrypi apachectl[23560]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
    nov. 30 20:30:45 raspberrypi apachectl[23560]: (98)Address already in use: AH00072: make_sock: could not bind to address
    nov. 30 20:30:45 raspberrypi apachectl[23560]: no listening sockets available, shutting down
    nov. 30 20:30:45 raspberrypi apachectl[23560]: AH00015: Unable to open logs
    nov. 30 20:30:45 raspberrypi apachectl[23560]: Action ‘start’ failed.
    nov. 30 20:30:45 raspberrypi apachectl[23560]: The Apache error log may have more information.
    nov. 30 20:30:45 raspberrypi systemd[1]: apache2.service: Control process exited, code=exited status=1

    My other services seem to overlap with Apache :s

    That makes me realize I have some VNC errors as well, strange.

    “tail /var/log/apache/error.log” is returning an error saying it’s impossible to open it because no such file or folder exist.

    Thanks for the debug Jim!

    • This is what a “netstat -tulpn” return:

      Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name

      tcp 0 0* LISTEN 595/lighttpd

      So a service named “lighttpd” is using it apparently. No idea what it is.

      • FYI, the problem was coming from PiHole which is using the port 80 by default.
        The thing was the make it use an other port, and then the problem got resolved.
        (Port is to be changer in /etc/lighttpd/lighttpd.conf )

        • Hi Jeremy, as your Pi is already running Pihole, Plex Server and a VPN, it isn’t too surprising that the above procedure will interfere with their configurations in some way. For example, as you say, Apache2 is competing with lighttpd for access to port 80. (Lighttpd is a web server, probably installed as part of Pihole). I recommend the above procedure for use only on a fresh Raspbian installation, ie. a Pi that isn’t doing anything else. I hope your Plex, VPN and Pihole functionality has not been damaged.

          Perhaps you could install Raspbian on a second SD card, put that in the Pi and do the above procedure? Meanwhile keeping VPN, Pihole and Plex intact on their own card.


          • I ran some tests.

            So if anyone read those comments they can know that Pihole, Plex, OpenVPN, and NextCloud can coexist perfectly well on a Pi 3.
            You just have to be careful to move the default PiHole webserver from the port 80 to an other one of your choice (through the /etc/lighttpd/lighttpd.conf file, I chose 8080 personally, and then restart the lighttpd service).
            No functionalities where damaged, and everything run smoothly now.
            Thanks for your work Jim.

            Now it’s time for me to put in place the https mode, and make a little raid1 system in place.


  5. (you should delete my 2 other comments with the 2 long outputs from the journalctl -xe as they were mistake of my part, thinking your website was not accepting them, as well as this one 😉 ).

    • Hi Jeremy, I deleted the two long comments and removed some long output from another. Hopefully it will make sense to future readers. The ansible script (build_nextcloud.yml) failed at the step where it restarts Apache. As you say, the error happened becuase port 80 was already in use by lighttpd, another web server that the Pi already happened to be running. Thanks for coming back, Jim.

  6. Hi,
    Thank you Jim for this procedure.

    I tried to install nextcloud automatically on the latest version of OSMC but something might went wrong. The install seems to have been done successfully but when I use the URL http://my Pis IP address/nextcloud the content of index.php opens. Nothing else happens. No login page.
    Did I miss something ?
    Thanks for your help !

    • Hi Arnaud. You won’t be able to run the above procedure on OSMC. It is intended to be run only on Raspbian. OSMC is a heavily customized operating system and differs from Raspbian in many ways. Please try the procedure again on Raspbian.

      Incidentally, this procedure will be modified later this morning (11th Jan 2018) to include support for MySQL.

      • Ok Jim, thank you.
        Would it be ok with the “Simple Nextcloud Installation on Raspberry Pi“ procedure ?
        I’d like to store my media files on a USB HDD and share them with NextCloud and then run OSMC as a media center. Can’t see how to do it if it’s not possible to install Nextcloud on OSMC…

        • Hi Arnaud, no I don’t think that is possible unfortunately. OSMC is a heavily customized environment. Nextcloud, the Nextcloud install procedure and OSMC are highly likely to interfere with each other and not function properly. OSMC is meant for running Kodi only and is not suitable as a general operating system.

  7. Thanks. On my third attempt, with the advice from other websites, I’ve managed to install Nextcloud using your advice, but did hit a problem or two, so thought I would comment here.
    My installation was on a Pi2 with a new install of Raspbian Lite using Berryboot to make sure that I was using the external drive. (i’d already hit a problem with a previous install that I couldn’t use the external drive.) Unfortunately Berryboot uses Jessie instead of Stretch and update, upgrade, dist-upgrade still left me with Jessie.
    I used your automatic script an all seemed fine. I logged in using another computer which told me that there was no data directory, so using your manual setup guidelines.
    I was on the verge of a clean install of Stretch, but, with the thought of three failed attempts to install nextcloud behind me, instead went to:
    and created the data directory, following your “simple nextcloud installation”.
    I then followed your manual msql Lite instructions to create a user and password. I didn’t get the friendly
    Query OK, 0 rows affected (0.00 sec)
    message nor did MariaDB talk to me, whoever she is. However, I restarted the computer, logged in to Nextcloud and have successfully transferred one data file.
    So thanks again. Now to learn how to use nextcloud properly!

    • Hi Greg, glad you got Nextcloud working in the end. Personally, I don’t use Berryboot, but it should not have affected the above procedure.

      I am not sure what happened on your system or why the data directory was not created. When the script ran, it would have printed a message as it created the directory, something like this:

      TASK [Create data directory /var/nextcloud/data] ************
      changed: []

      Did you see the above message, including the “changed” part ?

  8. Hi I am not sure you are offering help here but in case you do.

    sudo date ; ansible-playbook -s -c local -i “localhost,” build_nextcloud.yml

    my output shows
    PLAY = [local host]
    TASK [setup]
    ok [local host]

    whereas yours shows a number instead of local host.
    Is that a significant issue?

    • Hi Daniel, it indicates a possible difference between your /etc/hosts file and mine. But it shouldn’t really matter. Did the procedure work, overall ?

  9. Thank you for this awesome tutorial. I have successfully installed Nextcloud on my new Pi 3. But I tried to mount my hard drive and it didn’t work (unfortunately, Nextcloud is not working anymore…) Do you by any change have advice on how to mount a hard drive on Raspbian, and how to restore parameters ? (for this last point, I guess the best is to fully delete Nextcloud, and to start the tuto again from the top ?)
    Many thanks.

      • Hi Jim. Noob that I am, I just plugged my hard drive via USB and tried to use a mount command. Tutorials indicating how to do this properly were not easy though. I think that when I used your 2 commands to move my nextcloud data from the sd card to the hard drive, something went wrong because of this badly made mounting phase. And now connecting to Nextcloud is impossible.
        I am planning on uninstalling Nextcloud and Ansible and start it all over but I am afraid I might do something wrong again at the same point…

        • I may have found a solution on your website, on your “Simple owncloud installation on RPi2” article. Thanks again for all your tutorials.

        • Hi Sam, before trying the procedure again (automatic or manual), I would recommend you become familiar with mounting and unmounting drives on the Pi. It is quite simple and there are loads of tutorials on the net. Cheers, Jim.

  10. I followed these instructions using the 2017-11-29-raspbian-stretch image, and I chose to do the MySQL install. I did not change the default ncuser & raindrop password. I successfully logged in once using those credentials, but after logging out, I now cannot log in. I get a “Wrong password” error. How can I fix this? Thanks!

  11. Hi,

    first of all: Thank you!

    I had a little problem with the data directory. Configuration was BananaPi, Debian 9.3, Linux Kernel 4.4. I used the script with SQLlite.

    When i tried to complete the installation (http://myip/nextcloud) there was an error message that the data directory is missing an not writable. The solution was

    mkdir /var/www/html/nextcloud/data
    chown www-data:www-data /var/www/html/nectcloud/data


    • Hi Frank, glad you got it working. The above procedure was written for Raspbian, rather than Debian. It hasn’t been tested on Debian and is therefore unlikely to work without modification. Interesting that you got it to work by just creating the data directory. Cheers, Jim.

  12. Hi Jim!
    Thanks for your tutorial. I will install my own Nextcloud setup eventually and I think this tutorial will help a lot. Quick question: what disk format do you recommend with Nextcloup on a Pi for the external usb drive?
    Thanks a lot!

    • Hi Frank and sorry about the delay in replying. The recommendation would be to use ext4, the default file system type for Raspbian. Cheers, Jim.

  13. Hi Jim,
    I’ve been able to set up my nextcloud correctly on PI 3 with raspbian Stretch using your automatic procedure. Nice one, very usefull!!!
    I’d like to set the https security and also able to connect to my nexcloud from the internet. Is there any simple procedure to follow?
    Thanks for your help.

    • Hi Massimo, glad to hear the automatic procedure worked for you. In order to make your site https, you will need to create a certificate and place it into your apache configuration. Unfortunately there is no article in this blog explaining the process. However many procedures are available on the Internet. Cheers, Jim.

  14. Thanks very much for this tutorial. I’ve built nextcloud several times by hand and this was far easier. Everything worked great until I got to the point of moving files onto an USB drive. Here are a few configuration items and the problems that occurred when trying to mv files onto the USB drive.

    started with a clean 2018-03-13-raspbian-stretch.img
    changed the default username/pw and enabled ssh
    followed your recipe exactly
    created a mount location at /mnt/FLASH64
    mounted the drive
    // everything is good so far … and then
    sudo mv /var/nextcloud/data /mnt/FLASH64

    I received messages for every file of the form
    mv: failed to preserve ownership for ‘/mnt/FLASH64/data/nextcloud.log’: Operation not permitted

    Any thoughts on where things went wrong?

    thanks again

    • Hi Rick. Sorry about the late reply. I somehow overlooked your comment when you made it back in March. The “failed to preserve ownership” message usually occurs when you are copying data from one type of file system to another. In this case, it likely happened because your mv command was trying to move data from the Pi’s SD card, which is of file system type EXT4, onto a flash drive, which was likely of type FAT (maybe ExFAT, vfat or FAT16). These file system types do not have the kinds of data permissions as EXT4 does (the Linux permissions pertaining to group and user ownership), so they can’t be copied.

      Your data move might have worked anyway. If not, the best course of action is to reformat your flash drive to file system type EXT (which incidentally will delete all data on the flash drive) then try again.

  15. Error while trying to create admin user: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1698] Access denied for user ‘ncuser ‘@’localhost’

    • Hi Thiago. It is difficult to provide help without a little more information first. Please provide the whole transcript of the script run.


      • Thanks for the quick response. But I managed to solve it through a tutorial on the internet running a command for the terminal that I do not remember now.

  16. Many thanks for this tutorial Jim. I have a problem when I change the storage location of the data, the last part. Everything works perfectly until I execute the two commands
    $ sudo mv / var / nextcloud / data / disk1 / data
    $ sudo ln -s / disk1 / data / var / nextcloud / data

    In the browser when I type the nextcloud address gives me this message
    “Internal Server Error
    The server encountered an internal error and was unable to complete your request.
    Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
    More details can be found in the server log. ”

    Would you help me?

    • Jim, you can leave. I got it, I repeated the command this afternoon and now the database is on the external hard drive. I do not know why it did not work when I first ran. Thank you very much for this tutorial.

      • Hello Jim,
        The problem returned this morning. When I went to access the server it was with the same error. One thing I noticed differently was that my router rebooted and raspberry also.

        • Hi Reuber. Regarding updating, this procedure is only for installing Nextcloud, not updating it. Rather than attempting to update Nextcloud, I would simply install the latest version from scratch. If you re-run the procedure above it will automatically download and install the latest version (15.0.4 at the time of writing). NOTE: if you re-install, carefully backup up your own files first, and put them back afterwards.

          The Nextcloud internal updater fails because it tries to write to directories to which the Apache user (www-data) has no write permission. (However, it is an issue for Nextcloud developers, not me).

          Regarding your backup question, I am not sure what is being asked. Can you re-phrase it?

          Regarding the “internal server error” problem, it is difficult to know what caused this without further information. The same applies to your point about the reboot of your router. The commands in your comment contain spaces where they shouldn’t, and will not work.

          Overall, I would recommend repeating the procedure from scratch if anything goes wrong. It is fully automated, so this is probably the easiest solution.

          Thanks for persevering,

  17. One question Jim would have to put another HD into the raspberry and set it to work as a back up of the HD that is as a database.

  18. Another question, Jim, I can not update Nextcloud. The last message is:
    Check for write permissions
    The following places can not be written to:

    What should I do to solve this problem.

  19. Great tutorial! Has anybody tried to compile and run OnlyOffice on the Pi 4? I wonder if the 2GB version is fast enough.

    • Hi Nick, the purpose of this forum is to enable discussion of the above article and related matters. Please refrain from spam commenting in future.

      On the other hand, if you would like to read the article and/or try the procedure, I will be happy to answer any relevant questions, to discuss system building in general and to recommend / link to other sites. Jim

  20. Hi,
    Il followed the instructions but I’ve got an error :
    TASK [Unzip Nextcloud] *********************************************************
    fatal: [localhost]: FAILED! => {“changed”: false, “failed”: true, “msg”: “Source ‘/tmp/’ does not exist”}
    to retry, use: –limit @/home/osmc/build_nextcloud.retry
    Do you know what can be wrong ?

    • Hi Kirjava. From the error message, it looks like the previous step failed. The Ansible script failed to download Nextcloud, for some reason, and so could not unzip it. Were there any other error messages before the one above? Does /tmp/ (the download destination) exist on your system ?

      I just tested the download instructions in the script and they seem to work okay.


      • I had similar results as Kirjava when I tried using the latest bullseye version of Raspberry Pi OS. It worked when I tried again using buster.

        • Hi Rick, as stated the article supports Raspbian Buster, not Bullseye which was just recently released. However the changes should not be too great and I will update the procedure in due course. Cheers, Jim.

  21. Hi there I installed nextcloud using the automatic procedure.
    It works but when I go to the users window I only see the existing user and no “create line”.
    I can create new users with the occ command but no option to create in the GUI even when I login as admin. Please advise

    • Hi Dave, you see no “New user” button. Are you logged in as an admin user? You have to be a member of “admin” group to be able to create users.

      I just checked, and I can see a “New user” button on the left in the Users page, just above the “Add Group” button.

      Cheers, Jim.

      • Hi Jim, I am indeed member of admin but I can see no user button at all nor can I see an add group button on he user screen which only shows the current users…
        I can only create using the occ command!

        • Hi Dave. Something isn’t right. What kind of Pi are you using, and what version of Raspbian?

          And are you using SQLite for the database, or MySQL ?


  22. Hello! Got my installation up and running, but, I was not able to access my files out of my home network, i.e, through the mobile app or another computer. Also I was not able to access my hard drive connected to Pi 4, nor able to move the stuff into it using the commands you have provided. I request you to please provide a solution to this.

    • Problem No. 2: I switched off and booted up my Pi 4, and today, I tried to login by hitting myip/nextcloud and got this:

      Internal Server Error

      The server encountered an internal error and was unable to complete your request.
      Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
      More details can be found in the server log.
      What does this mean? And how can I correct it? Please help me out. Thanks.

    • HI Dhyaneshwar,

      One problem at time. The first issue you report is not being able to access Nextcloud from other devices on your home network. In what way were you unable to access Nextcloud? What error did you see?


    • Hi Lewis. There is no obvious and simple way to remove Nextcloud. However, if you rm the nextcloud and data directories, that should do it. Not recommended for a production server, but these are the commands I have used in the past:

      $ sudo rm /var/www/html/nextcloud
      $ sudo rm /var/nextcloud


  23. Hi.
    I can’t create an admin user.
    When I try fincish installation over http://myip/nextcloud I get this error:

    Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user ‘oc_pablo’@’localhost’ (using password: YES)

    But I’m setting up with this data (I don’t know why say “for the user oc_pablo”):
    Admin account: pablo and new password
    Mysql data: ncuser, password created before (throught mysql shell), nexcloud database and localhost.

    I’ve trying with a lot of variations., 3306 and 3307 port and create oc_pablo user in mysql too.
    Can you help me with this error?

    • Hi Pablo

      It sounds like you might be entering the wrong password. I suggest repeating the procedure from the start, and make a very careful note of the chosen password. Then enter the same password at the end.


      • Jim, many thanks for this great script that made it installing nextcloud on my new rpi4 a breeze. Except that I too am stuck with the same error as Pablo user above. I am using mysql option.


        Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user ‘oc_parag’@’localhost’ (using password: YES)

        • Hi Parag and Pablo

          The error occurred because of a bug in Nextcloud 17.0.2. As a workaround, the build_nextcloud.yml script has been modified to download version 17.0.1 instead, which does not have the bug. I have tested it on Raspbian Buster.

          Please start the procedure again from the start. It should work without a problem.


          • Hi Jim, thank you so much for looking into this.
            I noticed that updating dbuser and dbpassword /var/www/html/nextcloud/config/config.php moves past this error. But it is taking a lot of time to create those tables in nextcloud db. I may just end up following your suggestion to reinstall using version 17.0.1.

            Thank you,

  24. How do I mount a NTFS USB HDD. I am a total noob and followed your instructions through and got Nextcloud working, but I can’t figure out how to mount my hard drive to work with your code. Any help would be appreciated.

    • Hi William,
      USB disks will often mount themselves as soon as they are connected (check with “df”). If not, commands like the following can be used to mount disks.

      sudo mkdir /mnt/disk1
      sudo mount /dev/sdb1 /mnt/disk1

      … to mount a disk identified as /dev/sdb1 onto the directory /mnt/disk1 (which must exist, hence the mkdir). I would recommend looking at more examples online and becoming familiar with the mount command. Cheers, Jim.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.