NextCloud is one of the most popular resident sync and application sharing software, free and open source. You can use it to store personal files, contacts, photos, music and more, and this allows you to access or share them with your friends at any time. It is a popular alternative to another widely used file hosting application called OwnCloud.
In this article, we will show you how to install NextCloud 13 on Ubuntu 16.04 VPS. If you are an OwnCloud user and want to switch to NextCloud, make sure you also read our article on how to switch from OwnCloud to NextCloud.
Before starting the installation, there are several requirements:
- SSH access to the server. You should be able to connect to the server via SSH.
- LAMP stack consisting of Linux, Apache web server, MySQL or MariaDB database server and PHP 7.0, 7.1 or 7.2.
In addition, it is recommended to secure NextCloud with an SSL certificate. You can purchase a trusted SSL certificate.
1. Login with SSH and update the system
First, you need to log into the server via SSH with superuser rights:
ssh [email protected]_ADDRESS -p PORT_NUMBER
Make sure you replace “IP_ADDRESS” and “PORT_NUMBER” with the actual server IP address and SSH port number.
After you log in, let’s make sure your Ubuntu 16.04 server is up to date by running the following commands:
apt-get update apt-get upgrade
2. Installing Apache
Run the following command to install Apache on the server:
apt-get install apache2
After the installation is complete, you can enable the service to start automatically at system boot:
systemctl enable apache2
You can check if the Apache server is working with the following command:
systemctl status apache2
3. Install PHP 7.0
To install PHP 7 along with all additional modules required by NextCloud, run the following command:
apt-get install php7.0 libapache2-mod-php7.0 php7.0-common php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip
4. Installing the MySQL database server and creating the database
Next, we need to install the MySQL database server. To do this, you need to run the following command:
apt-get install mysql-server
You can now start the database server and enable it to start automatically at boot using the following commands:
systemctl start mysql systemctl enable mysql
You can also run the script mysql_secure_installation to secure the MySQL database server:
After you’ve answered all the questions, you can now go ahead and log into MySQL as root using your root password with the following command:
mysql -u root -p
In order to create a new database for the NextCloud installation, run the following commands:
CREATE DATABASE nextcloud_db; GRANT ALL PRIVILEGES ON nextcloud_db.* TO 'nextcloud_user'@'localhost' IDENTIFIED BY 'PASSWORD'; FLUSH PRIVILEGES; exit;
Make sure to replace “PASSWORD” with a real, strong password.
5. Installing NextClould
Our hosting environment is ready and we have also created a new database. We can now proceed with the actual installation of NextClould.
Run the following commands to download and extract the latest NextCloud 13 installation files:
cd /var/www wget https://download.nextcloud.com/server/releases/latest-13.zip unzip latest-13.zip chown -R www-data:www-data nextcloud rm latest-13.zip
6. Configuring Apache Shared Hosting
In order to access your NextCloud domain installation, you will need to create an Apache virtual host configuration file. You can create it with the nano text editor:
Now enter the following information into the file:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/nextcloud ServerName yourdomain.ru ServerAlias www.yourdomain.ru Alias /nextcloud "/var/www/nextcloud/" <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 </Directory> ErrorLog /var/log/apache2/nextcloud-error_log CustomLog /var/log/apache2/nextcloud-access_log common </VirtualHost>
Then we need to enable the virtual host file using the following command:
ln -s /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-enabled/nextcloud.conf
Also, we need to make sure the following apache mod is enabled as well:
a2enmod rewrite headers env dir mime
Finally, restart the Apache web server:
systemctl restart apache2
7. Completing the NextClould installation via a web browser
Now you can visit the page https://yourdomain.ru (or HTTP: // YOUR_IP_ADDRESS ) and follow the onscreen instructions to complete the NextCloud installation.
You will need to create a user account with administrator privileges by choosing your own username and password. In the “Storage & Database” section, enter the information about the previously created database, and then click on the “Finish Setup” button.
That’s all. You have successfully installed NextCloud and you can log in with your admin login credentials.
Please disable your ad blocker or whitelist this site!