Despite my affection for various cloud services and their cheap storage, there’s something to be said for making your own “cloud server” with NextCloud. The biggest advantage with NextCloud is also a practical one – user control. Anything I load onto my NextCloud instance is as secure or insecure as I choose to make it. Plus, if I keep my NextCloud instance local to my LAN only, I greatly reduce the opportunity for my data being hacked. Today’s various cloud services simply can’t make that promise.
This article will show you how to setup your own NextCloud server on Ubuntu 16.04. You can set it up at your home, office or even make it available over the Internet.
This first step might seem pretty obvious, however choosing the install location of your NextCloud server is an important step. Before you decide, let’s examine the benefits and disadvantages of each choice.
The advantage to using a VPS (Virtual Private Server) is that you’re then free to access the server from anywhere with an Internet connection. Added bonus points go to keeping this from being associated with your home network. The disadvantage here is that it will cost you money. Also, you’re exposing the contents of this server to the Internet. Even with server hardening and promptly applied patches as they’re available, you’re putting a lot of trust in NextCloud and your server’s configuration.
The first big advantage here is obviously price. Short of potentially expanding the storage capacity of the old PC in question, running NextCloud on it will translate into a huge savings in comparison to buying a new server. The biggest advantage in my mind however is that you can make your NextCloud instance available for your LAN only. This means no exposure to the Internet and a malicious person must first penetrate your LAN’s defenses before even touching your NextCloud install. Unfortunately you might find that using an older PC for NextCloud means extra power consumption added to your electric bill. If it’s a really old PC like a Pentium 4 box, the costs could be quite noticeable.
Right off the bat, with a Pi you’re running NextCloud on a low power consumption device. Also great is the fact that the hardware is decent enough to power NextCloud despite the Pi’s low power footprint. The only downside I see to using a Pi is that your storage is running through USB ports to a secondary device. In some cases this can bottleneck a bit when sharing resources to other USB devices. For most people this is a moot issue, however I’d suggest that you’d want to limit your Pi to images and documents only.
What about NAS (Network Attached Storage) or exposing a PC to the Internet? As a standalone type of thing, I think that running a NAS is overkill. That said, it would be doable to do so with the NAS running other tasks like Plex, etc.
As for exposing an old PC to the Internet, well, that’s fine if you want to get into VLANs, really strip down what the PC has access to and are comfortable advertising your network to co-workers and others accessing your NextCloud. From my perspective, I would rather keep it on LAN only.
By now, I assume you’ve settled on the destination for your NextCloud instance. The next step is to begin the installation process.
Before we do anything, we need to make sure you’re ready to run what’s called a LAMP stack. This is Linux, Apache, MariaDB and PHP.
sudo apt-get update && sudo apt-get upgrade
Then install the LAMP stack:
sudo apt-get install apache2 apache2-utils
Now let’s enable Apache.
sudo systemctl restart apache2
If for some reason this gives you an error, try this after checking the journalctl for errors…
sudo systemctl restart apache2.service
I prefer to use restart vs start as it saves us the extra hassle of checking for its status first. But, that’s just my preferred approach to handling services. Now let’s make sure Apache runs on each reboot.
sudo systemctl enable apache2.service
Now browse to your PC’s LAN address and make sure you see the Apache welcome default page. This is how you know things are working.
Now that we have Apache setup, we need to make sure the directory where you’ll house your NextCloud configuration has the right permissions.
sudo chown www-data /var/www/html/ -R
Okay, Apache is all set. Now it's time to install MariaDB so we can setup and manage the NextCloud database.
sudo apt-get install mariadb-server mariadb-client
With MariaDB installed, let's make sure it's enabled and running.
sudo systemctl restart mysql.service
Then make sure its enabled so it starts after a reboot.
sudo systemctl enable mysql.service
The final step of setting up MariaDB is to run the secure installation script. This will enable your root password and complete the overall MariaDB configuration.
sudo mysql_secure_installation
From this point forward, the script is going to prompt you along. You’ll be asked to setup a root password unique to MariaDB(MySQL), disallow remote root access, remove the test database and so on. Once you’ve hit enter for each option, you’ll see “Thanks for using MariaDB!”
With our database software installed, we need to install the last component – PHP. So let’s start off by installing PHP7.
sudo apt-get install php7.0-fpm php7.0-mysql php7.0-common php7.0-gd php7.0-json php7.0-cli php7.0-curl libapache2-mod-php7.0
Once installed, we need to make sure Apache’s PHP is enabled.
sudo a2enmod php7.0 && sudo service apache2 restart
The next step with PHP is to test it. There are a number of ways to do this, however most of those "in the know" agree that using this method is the most reliable way.
sudo touch /var/www/html/test.php
And then…
sudo echo "" >> /var/www/html/demo.php
Using the echo command, we’re able to append the code to the demo file without needing to mess with any extra editing. Once the code is added, you can verify your Apache PHP settings are working by now browsing to your server’s http://IP/demo.php
If you’re looking at a neatly formatted page containing your PHP configuration, you’re all set.
At this stage, you’re ready to download the latest release of NextCloud. I recommend manually getting the latest release link from this link. For those of you doing this on a “headless server”, you could do the following (making sure your link is up to date first).
wget https://download.nextcloud.com/server/releases/nextcloud-11.0.2.zip
With the zipped folder containing NextCloud downloaded, you’re free to unzip its contents. Pro tip: make sure you have unzip installed first via your package manager.
unzip nextcloud-11.0.2.zip
With NextCloud's contents extracted, you're now ready to move the extracted files into the correct Apache enable directory.
sudo chown www-data:www-data /var/www/nextcloud/ -R
This is the point where you’re actually moving past initial server setup and into actually configuring your NextBox installation itself.
Now it’s time to set up your NextBox database in MariaDB.
First login to your MariaDB root password:
mysql -u root -p
Once logged into the MySQL prompt, you’ll want to create your NextCloud database (remember you can choose the database name):
create database YourCreatedDatabaseName;
Next, we want to create a non-root user for this database (You can create any username you wish):
create user UserNameForDatabase@localhost identified by 'YourPassword';
Now we’re ready to setup the proper database permissions for this NextCloud installation:
grant all privileges on YourCreatedDatabaseName.* to UserNameForDatabase@localhost identified by 'YourPassword';
With your database created and configured, we’re ready to flush the privileges:
flush privileges;
And finally, we exit the MySQL prompt:
exit;
Still with me? Great! We're almost ready to finish this up. The next step is a tricky one where we setup the VirtualHost file for NextCloud.
sudo nano /etc/apache2/sites-available/nextcloud.conf
The contents of the conf file will be as follows:
virtualhost :80="" DocumentRoot "/var/www/nextcloud" ServerName YourSelectedDomain.Whatever ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined directory var="" www="" nextcloud="" Options +FollowSymlinks AllowOverride All ifmodule mod_dav="" c="" Dav off /ifmodule SetEnv HOME /var/www/nextcloud SetEnv HTTP_HOME /var/www/nextcloud Satisfy Any directory /virtualhost
If you’re unsure about the domain for the servername for a LAN installation, you can use the IP address. If this is for a server on a VPS or similar, the same applies.
With the VirtualHost set up and ready to go, we need to move it from available to enabled status.
sudo ln -s /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-enabled/nextcloud.conf
Next, let's enable the needed modules to make sure NextCloud has everything it needs and restart Apache.
sudo a2enmod rewrite headers env dir mime setenvif
And then:
sudo systemctl restart apache2
If these steps seem a bit overwhelming for you, I would suggest the following – use VirtualBox. By setting up a VirtualBox VM with a bridged network adapter, you’re able to test out a local configuration without needing to worry about messing up a server configuration. Once you feel comfortable with your skills in VirtualBox, you’re then ready to try out NextCloud on an actual PC, Pi or server.
Do you use use NextCloud alternatives like Dropbox? Perhaps you’re looking to try something new? Hit the comments, I’d be happy to listen to your NextCloud experiences.
Huawei’s AI Update: Things Are Moving Faster Than We Think
FEATURE | By Rob Enderle,
December 04, 2020
Keeping Machine Learning Algorithms Honest in the ‘Ethics-First’ Era
ARTIFICIAL INTELLIGENCE | By Guest Author,
November 18, 2020
Key Trends in Chatbots and RPA
FEATURE | By Guest Author,
November 10, 2020
FEATURE | By Samuel Greengard,
November 05, 2020
ARTIFICIAL INTELLIGENCE | By Guest Author,
November 02, 2020
How Intel’s Work With Autonomous Cars Could Redefine General Purpose AI
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
October 29, 2020
Dell Technologies World: Weaving Together Human And Machine Interaction For AI And Robotics
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
October 23, 2020
The Super Moderator, or How IBM Project Debater Could Save Social Media
FEATURE | By Rob Enderle,
October 16, 2020
FEATURE | By Cynthia Harvey,
October 07, 2020
ARTIFICIAL INTELLIGENCE | By Guest Author,
October 05, 2020
CIOs Discuss the Promise of AI and Data Science
FEATURE | By Guest Author,
September 25, 2020
Microsoft Is Building An AI Product That Could Predict The Future
FEATURE | By Rob Enderle,
September 25, 2020
Top 10 Machine Learning Companies 2020
FEATURE | By Cynthia Harvey,
September 22, 2020
NVIDIA and ARM: Massively Changing The AI Landscape
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
September 18, 2020
Continuous Intelligence: Expert Discussion [Video and Podcast]
ARTIFICIAL INTELLIGENCE | By James Maguire,
September 14, 2020
Artificial Intelligence: Governance and Ethics [Video]
ARTIFICIAL INTELLIGENCE | By James Maguire,
September 13, 2020
IBM Watson At The US Open: Showcasing The Power Of A Mature Enterprise-Class AI
FEATURE | By Rob Enderle,
September 11, 2020
Artificial Intelligence: Perception vs. Reality
FEATURE | By James Maguire,
September 09, 2020
Anticipating The Coming Wave Of AI Enhanced PCs
FEATURE | By Rob Enderle,
September 05, 2020
The Critical Nature Of IBM’s NLP (Natural Language Processing) Effort
ARTIFICIAL INTELLIGENCE | By Rob Enderle,
August 14, 2020
Datamation is the leading industry resource for B2B data professionals and technology buyers. Datamation's focus is on providing insight into the latest trends and innovation in AI, data security, big data, and more, along with in-depth product recommendations and comparisons. More than 1.7M users gain insight and guidance from Datamation every year.
Advertise with TechnologyAdvice on Datamation and our other data and technology-focused platforms.
Advertise with Us
Property of TechnologyAdvice.
© 2025 TechnologyAdvice. All Rights Reserved
Advertiser Disclosure: Some of the products that appear on this
site are from companies from which TechnologyAdvice receives
compensation. This compensation may impact how and where products
appear on this site including, for example, the order in which
they appear. TechnologyAdvice does not include all companies
or all types of products available in the marketplace.