How to install Nextcloud 19 on Ubuntu Server 20.04
The latest iteration of Nextcloud is out and Jack Wallen walks you through installing this on-premises cloud platform on Ubuntu Server 20.04.
With more and more people having to work from home, there’s a growing need for cloud technology deployed on home local area networks (LANs) and, of course, on small to large business networks. For that, you need a platform that’s not only free to use, but easy to work with. That’s where Nextcloud comes into play.
The developers of Nextcloud continue to up the ante for on-premises cloud server technology. Already, this open source cloud option is one of the best on the market, but with the release of version 19, it gets even better.
New features include:
Automatic logout (optional)
Password reuse limitations
Automatic account lock after X number of failed logins
Password expiration options
Ability to play video before download completes
SMB storage enhanced with better Access Control List support
Collabora Online ready to use out of the box
Edit office documents during video calls from within a chat room
FTP is up to 500% faster
File scan is 2.5x faster
Add all of those new features in with the usual bug fixes and performance enhancements, and Nextcloud 19 is a must have.
I want to walk you through the process of installing Nextcloud 19. This time, however, we’re going to install the software on Ubuntu Server 20.04.
SEE: Serverless computing: A guide for IT leaders (TechRepublic Premium)
What you’ll need
How to install the dependencies
The first thing we must do is take care of the necessary dependencies. If you don’t already have the LAMP stack up and running, log in to your Ubuntu 20.04 server and install Apache and MySQL with the command:
sudo apt-get install apache2 mysql-server -y
Once that installation completes, install the remaining dependencies with the command:
sudo apt-get install php zip libapache2-mod-php php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip php-mysql php-bcmath php-gmp -y
How to take care of the database
Next, we’ll take care of the MySQL database. Before we can create the new database, we must secure the installation with the command:
Answer the questions and create a MySQL admin password.
Log in to the MySQL prompt with the command:
sudo mysql -u root -p
At the prompt, create the database with the command:
CREATE DATABASE nextcloud;
Now we’re going to create a new user and give that user the proper permissions with the following commands:
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'PASSWORD'; GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
Where PASSWORD is a strong, unique password.
Finish up the database with the following commands:
FLUSH PRIVILEGES; exit
How to download and unpack Nextcloud
To download the latest version of Nextloud, change into the /tmp directory (with cd /tmp) and issue the following command:
Once that download completes, unzip the file with the command:
Move the newly created directory into the Apache document root with the command:
sudo mv nextcloud /var/www/html/
Give the newly-moved directory the proper permissions with the command:
sudo chown -R www-data:www-data /var/www/html/nextcloud
How to configure Apache
It’s time to let Apache know about the Nextcloud instance. Create a new configuration file with the command:
sudo nano /etc/apache2/sites-available/nextcloud.conf
In that file, paste the following:
Alias /nextcloud "/var/www/html/nextcloud/"
Options +FollowSymlinks AllowOverride All Dav offSetEnv HOME /var/www/html/nextcloud SetEnv HTTP_HOME /var/www/html/nextcloud
Save and close the file.
Enable the new site with the command:
sudo a2ensite nextcloud
Next, enable the necessary Apache modules with the command:
sudo a2enmod rewrite headers env dir mime
The php.ini file can be edited for Nextcloud with a single command:
sudo sed -i '/^memory_limit =/s/=.*/= 512M/' /etc/php/7.4/apache2/php.ini
Finally, restart Apache with the command:
sudo systemctl restart apache2
How to complete the installation
Open a browser on a machine connected to your LAN and point it to http://SERVER_IP/nextcloud (where SERVER_IP is the IP address of the server hosting Nextcloud). In the resulting window, fill out the necessary information for both the new admin user and the database (Figure A).
The database information will be:
Leave everything else as is.
Once you’ve filled out the necessary information, click Finish Setup and, once the installation completes, you’ll find yourself on the Nextcloud main page, logged in as your newly-created admin user (Figure B).
And that’s all there is to installing Nextcloud 19 on Ubuntu Server 20.04. You can now start customizing your cloud server to perfectly meet your needs.