Instructions to install NextCloud on your computer

NextCloud is software that helps you create your own private cloud storage service. That is, the data will be stored on your own computer/Server. You will install, authorize, create a user and have an App to install on your phone. NextCloud is great if you want to access your data remotely or a company wants to create Cloud Storage for employees to use.

Today, I will show everyone how to install NextCloud on Raspberry Pi. Of course, you can also install NextCloud on your personal computer.

What is NextCloud?

NextCloud is a form of Client-Server-Software for creating cloud storage services. This is one of the open software that allows users to change the Sourcecode and allows users to create their own Server

NextCloud has an easy to use interface for everyone, friendly with many types of devices, and they have provided additional client versions for Window, Android or even IOS.


  • A computer or VPS or Raspberry Pi has pre-installed operating system (I use Raspberry Pi 4GB Ram – 32GB microSD card and run Ubuntu Server 20.04 LTS)
  • Network (opened port 443 and port 80)
  • Logged in user root (You can see instructions here)
  • It is recommended to use SSH to connect

Things we will install:

  • Apache
  • PHP 7.4.1
  • MySQL
  • NextCloud

Instructions for installing Apache

Step 1: Install Apache

sudo apt install apache2 -y

Step 2: Start and Enable Apache

sudo systemctl start apache2
sudo systemctl enable apache2

Step 3: Check Firewall with ufw . command

sudo ufw app list

ufw list is running

It’s ok now

Step 4: Allow traffic on port 80 and 443

sudo ufw app info "Apache Full"

Let traffic flow through ports 80 and 443

It’s okay now

Please check if the server is up

Since my raspberry pi’s IPv4 address is, I’ll try it out

Apache HTML

If it does, it means Apache is up and running

Install and configure MySQL

Step 1: Install MySQL

sudo apt install mysql-server -y

Step 2: Set root password for MySQL

sudo mysql_secure_installation

By default mysql root password will be blank. This step may or may not be present depending on the needs of the Administrators

Step 3: Configure settings for NextCloud

mysql -u root

Create database and user

GRANT ALL PRIVILEGES ON nextcloud.* TO 'nc_user'@'localhost';

User settings for Database

Note: change YOUR_PASSWORD_HERE to your pass!

Install PHP

sudo apt install -y php libapache2-mod-php php-ldap php-mysql php-cli php-bz2 php-curl php-gd php-imagick php-intl php-mbstring php-xml php-zip

Install NextCloud

Step 1: Install NextCloud

wget -O /opt/

Note: at the time of this post, NextCloud’s latest version is 22.1.0! For those of you watching after 8/8/2021, check the new version here

Step 2: Extract that file

apt-get install unzip -y
unzip /opt/ -d /var/www/
rm -f /opt/

Step 3: Enter Virtual Host configuration

cat << EOF >> /etc/apache2/sites-available/nextcloud.conf

<VirtualHost *:80>
ServerAdmin admin@localhost.local
DocumentRoot /var/www/nextcloud/

Alias /nextcloud "/var/www/nextcloud/"

<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined


Enter Virtual Host configuration

Step 4: Decentralize NextCloud

chmod 755 -R /var/www/nextcloud/
chown www-data. -R /var/www/nextcloud/

Step 5: Re-enable NextCloud supported modes

sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime

Step 6: Enable NextCloud’s Config and Restart Apache

sudo a2ensite nextcloud.conf
sudo systemctl reload apache2

Step 7: Access the page based on the ip address of the raspberry pi. Mine is

Create NextCloud admin account

  • user : nc_admin
  • pass : password you set yourself

Connect to the database you created earlier.

  • nc_user
  • The database password that you set up in step 3 of creating mySQL
  • nextcloud
  • localhost

And then click finish Set Up

Wait a while for the installation to complete.

The interface after installation is as follows:




Instructions to open network modem port

Step 1: Go to the following address:

Step 2: Please login. This is usually provided by the carrier. For VNPT modems, they usually leave the username and password as follows:

  • Username: admin
  • Password: Passwd2@

VNPT network port

Step 3: On the top bar, select Advance Setup -> NAT. Once done, select Interface as wan1 and then select Virtual Server

Guide to NAT port

Step 4: Please fill in the following Local IP of Raspberry PIsettings for virtual server


  • Index: ordinal number (when you open different ports, you need to change the index for each port)
  • Application: Name for you to easily identify
  • Protocol: Protocol. This one, you just leave it all to yourself
  • Start Port and End Port: you put two: 80 and 443
  • The Local ip adress section, you can find it via status -> DHCP Client

Step 5: Please click Apply

Apply button

You can check the port here

Check port

Next you need to point the Domain to the IP of your home Internet Modem, do the same with the instructions to point the domain from freenom to cloudflare.

So I just finished guiding you to install NextCloud on Raspberry Pi. How do you feel? Leave a comment to let me know

Leave a Reply