If you haven't given Nextcloud a try now's the perfect time since version 15 has arrived and offers a host of incredible features.
It goes without saying that Nextcloud has become one of the most successful on-premise cloud servers available. With each iteration, the software improves by leaps and bounds, making it a must-use for everything from homes to enterprise-grade businesses.
If you haven't given Nextcloud a try now's the perfect time to do so as version 15 has arrived and offers a host of incredible features. I want to walk you through the process of installing Nextcloud on Ubuntu Server 18.04.
SEE: Vendor comparison: Microsoft Azure, Amazon AWS, and Google Cloud (Tech Pro Research)
What you need
In order to successfully install Nextcloud 15, you need the following:
- A Ubuntu 18.04 server running with a static IP address (or Fully Qualified Domain Name - FQDN).
- A user account with sudo privileges.
I'll demonstrate on a server with a static IP address. If you plan on accessing your Nextcloud server from outside your LAN, you'll not only want to configure it with your FQDN but also with HTTPS.
With those things in hand, let's work.
Before we install Nextcloud, make sure that your server is updated and upgraded. Do note, should your kernel be upgraded, you'll need to reboot the server. Because of this, make sure to run the update/upgrade at a time when a reboot is possible (unless you have live patching installed, at which point you can run the task any time). To update and upgrade, log into the server to host Nextcloud and issue the following commands:
sudo apt-get update sudo apt-get upgrade -y
Once that process completes, reboot the server (if necessary). You're now ready to install.
The first thing we must do is install the LAMP (Linux Apache MariaDB PHP) server stack. This can be done with the following command:
sudo apt-get install apache2 mariadb-server apt-transport-https -y
Start and enable the web and database servers with the following commands:
sudo systemctl start apache2 sudo systemctl enable apache2 sudo systemctl start mariadb sudo systemctl enable mariadb
Next, we need to add a repository in order to install the proper PHP versions. Do this with the following commands:
sudo wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add - sudo echo "deb https://packages.sury.org/php/ bionic main" | tee /etc/apt/sources.list.d/ondrej.list apt-get update
Install the PHP packages (and other dependencies) with the command:
sudo apt-get install libapache2-mod-php php7.2 php7.2-xml php7.2-curl php7.2-gd php7.2 php7.2-cgi php7.2-cli php7.2-zip php7.2-mysql php7.2-mbstring wget unzip -y
PHP must be configured. This is done in the php.ini file. Open the file for editing with the command:
sudo nano /etc/php/7.2/apache2/php.ini
Make sure to locate and edit the following lines as such:
memory_limit = 512M upload_max_filesize = 200M max_execution_time = 360 post_max_size = 200M date.timezone = TIME/ZONE
where TIME/ZONE is your current time zone (such as America/Kentucky/Louisville).
Save and close that file.
Configure MariaDB and create the database
The MariaDB installation needs to be secured with a password. To do this, issue the command:
You will be asked to set a new password. Once you do that, answer yes to the remaining questions.
To create the necessary database, enter the MariaDB prompt with the command:
mysql -u root -p
Once in the prompt, issue the following commands:
CREATE DATABASE nextclouddb; CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'PASSWORD'; GRANT ALL PRIVILEGES ON nextclouddb.* TO 'nextcloud'@'localhost'; FLUSH PRIVILEGES; exit
where PASSWORD is a strong/unique password.
Let's create an Apache configuration file for Nextcloud. Create the new file with the command:
sudo nano /etc/apache2/sites-available/nextcloud.conf
Paste the following contents into that file:
<VirtualHost *:80> ServerAdmin email@example.com DocumentRoot "/var/www/html/nextcloud" ServerName example.com <Directory "/var/www/html/nextcloud/"> Options MultiViews FollowSymlinks AllowOverride All Order allow,deny Allow from all </Directory> TransferLog /var/log/apache2/nextcloud_access.log ErrorLog /var/log/apache2/nextcloud_error.log </VirtualHost>
where example.com is your FQDN (if applicable).
Disable the default site and enable the Nextcloud site with the following commands:
sudo a2dissite 000-default sudo a2ensite nextcloud
Restart Apache with the command:
sudo systemctl restart apache2
And now we can install the Nextcloud server. Before we do, let's create a new directory (and give it the proper permissions) with the following commands:
sudo mkdir /var/www/html/nextcloud sudo chown www-data:www-data /var/www/html/nextcloud sudo chmod 750 /var/www/html/nextcloud sudo mkdir -p /var/nextcloud/data sudo chown www-data:www-data /var/nextcloud/data sudo chmod 750 /var/nextcloud/data
Download and unpack the Nextcloud installer file with the following commands:
cd /var/www/html/nextcloud sudo wget https://download.nextcloud.com/server/installer/setup-nextcloud.php sudo chown www-data:www-data setup-nextcloud.php
Point a browser to http://SERVER_IP/setup-nextcloud.php (where SERVER_IP is the IP address of the hosting server) and walk through the installation wizard (Figure A).
Make sure, in the directory step (Figure B), to enter the proper directory that will house Nextcloud. If you want Nextcloud to be installed in the document root of the Apache server, type a ., otherwise type nextcloud (to install the server in a sub-directory named nextcloud).
When this portion of the wizard completes, you will be asked to create an admin user and define the database (Figure C).
Once this completes, you can point your browser to http://SERVER_IP/nextcloud (where SERVER_IP is the IP address of your hosting machine) and log into your newly installed Nextcloud 15 server. Congratulations, you're ready to get your on-premises cloud on.
- How to authenticate Nextcloud to an OpenLDAP server (TechRepublic)
- How to create a Kanban Board in Nextcloud (TechRepublic)
- How to install and connect the new Nextcloud desktop client (TechRepublic)
- How to configure SMTP for Nextcloud (TechRepublic)
- Rackspace, Pure Storage offer joint solution for hybrid cloud customers (ZDNet)
- What is cloud computing? Everything you need to know about the cloud, explained (ZDNet)
- Best cloud services for small businesses (CNET)
- Microsoft Office vs Google Docs Suite vs LibreOffice (Download.com)
- Cloud computing: More must-read coverage (TechRepublic on Flipboard)