There are many tutorials on how to install Nextcloud on Ubuntu, but I will summarize the main steps for you based on the web search results. You can also follow the links for more details.
- First, you need to install PHP and Apache web server, which are required to run Nextcloud. You can do this by running the following command in a terminal:
sudo apt install apache2 libapache2-mod-php php-gd php-mysql php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-imagick php-zip
This will install the packages for the Nextcloud core system and some recommended modules.
- Next, you need to install and configure MariaDB database server, which will store the Nextcloud data. You can do this by running the following command in a terminal:
sudo apt install mariadb-server
Then, you need to create a database user and a database for Nextcloud by using the MySQL command line interface. You can do this by running the following commands in a terminal, replacing username
and password
with your own values:
sudo mysql
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'username'@'localhost';
FLUSH PRIVILEGES;
quit;
- After that, you need to download and install Nextcloud from its official website. You can do this by running the following commands in a terminal, replacing
x.y.z
with the latest version number:
wget [6](https://download.nextcloud.com/server/releases/nextcloud-x.y.z.tar.bz2.asc)
unzip nextcloud-x.y.z.zip
sudo cp -r nextcloud /var/www
This will download and extract the Nextcloud archive file and copy it to the Apache document root directory.
- Then, you need to configure Apache to serve Nextcloud by creating a virtual host file for it. You can do this by running the following command in a terminal:
sudo nano /etc/apache2/sites-available/nextcloud.conf
This will open a text editor where you can paste the following configuration, replacing example.com
with your own domain name:
<VirtualHost *:80> ServerName example.com DocumentRoot /var/www/nextcloud
<Directory /var/www/nextcloud> Require all granted AllowOverride All Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
</VirtualHost>
Then, save and close the file by pressing CTRL+X, Y, and ENTER.
- Finally, you need to enable the virtual host file, the rewrite module, and restart Apache for the changes to take effect. You can do this by running the following commands in a terminal:
sudo a2ensite nextcloud.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Now you can access Nextcloud web interface by visiting your domain name in a web browser. You will need to complete the installation by creating an admin account and entering the database details that you created earlier.
I hope this helps you to install Nextcloud on Ubuntu. If you have any questions or problems, please refer to the official documentation6 or ask for help on the Nextcloud forum.