{"id":26349,"date":"2018-04-26T02:17:16","date_gmt":"2018-04-26T07:17:16","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=26349"},"modified":"2022-06-03T03:35:05","modified_gmt":"2022-06-03T08:35:05","slug":"how-to-install-nextcloud-13-on-debian-9","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-nextcloud-13-on-debian-9\/","title":{"rendered":"How to install NextCloud 13 on Debian 9"},"content":{"rendered":"
<\/p>\n
We’ll show you, how to install NextCloud 13 on Debian 9. Nextcloud is an open-source software suite that allows users to store their data such as files, contacts, calendars, news feed, TODO lists and much more, on their personal servers. It is using standard protocols such as webdavm, carddav and caldav. It also provides client applications so users can easily manage and synchronize their data among Linux, MacOS, Windows platforms and smart phones, which makes Nextcloud a great free alternative to proprietary cloud services such as Dropbox, Google Drive, iCloud, etc…<\/p>\n
In this tutorial we will install and configure Nextcloud 13 on a Debian 9 VPS, with Apache web server, PHP and MariaDB.<\/p>\n
Before we start with the installation there are several requirements:<\/p>\n
Login to your Debian 9 VPS via SSH as user root<\/p>\n
ssh root@IP_Address -p Port_Number<\/pre>\nand make sure that all installed packages are up to date by running the following command<\/p>\n
apt update && apt upgrade<\/pre>\nInstall Apache web server<\/strong><\/h3>\n
As mentioned in the requirements, a web server is required to run Nextcloud. Run the following command to install Apache on your VPS<\/p>\n
apt install apache2<\/pre>\nOnce installed, start Apache and enable it to start at server boot<\/p>\n
systemctl start apache2\r\nsystemctl enable apache2<\/pre>\nInstall PHP<\/strong><\/h3>\n
Install PHP and some PHP modules required by NextCloud<\/p>\n
apt 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 php7.0-imagick php7.0-xml php7.0-zip<\/pre>\nInstall MariaDB and create a database<\/strong><\/h3>\n
Next, we will install MariaDB server using the following command<\/p>\n
apt -y install mariadb-server<\/pre>\nStart the database server and enable it to start upon server boot<\/p>\n
systemctl enable mariadb\r\nsystemctl start mariadb<\/pre>\nRun the mysql_secure_installation<\/strong> post-installation script to harden the security of your MariaDB server and set a ‘root’ password. You can use the following options<\/p>\n
mysql_secure_installation\r\n\r\nSet root password? [Y\/n] Y\r\nRemove anonymous users? [Y\/n] Y\r\nDisallow root login remotely? [Y\/n] Y\r\nRemove test database and access to it? [Y\/n] Y\r\nReload privilege tables now? [Y\/n] Y<\/pre>\nNow, login to the MariaDB server as user root and create a new user and database for Nextcloud<\/p>\n
mysql -u root -p\r\n\r\nMariaDB [(none)]> CREATE DATABASE nextcloud;\r\nMariaDB [(none)]> GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud_user'@'localhost' IDENTIFIED BY 'PASSWORD';\r\nMariaDB [(none)]> FLUSH PRIVILEGES;\r\nMariaDB [(none)]> exit;<\/pre>\nDon’t forget to replace ‘PASSWORD’ with an actual strong password. Combination of letters and numbers and minimum 10 characters long is recommended.<\/p>\n
Download and install Nextcloud
\nGo go Nextcloud’s official website and download Nextcloud 13 to your Debian 9 VPS. Currently latest stable version is 13.0.1<\/p>\nwget https:\/\/download.nextcloud.com\/server\/releases\/nextcloud-13.0.1.zip<\/pre>\nExtract the downloaded ZIP archive in a directory Apache has access to, and change the ownership of the nextcloud directory to the web server user<\/p>\n
unzip nextcloud-13.0.1.zip -d \/var\/www\/html\/\r\nchown -R www-data:www-data \/var\/www\/html\/nextcloud\/<\/pre>\nOnce all Nextcloud prerequisites are fulfilled, we can complete installation using the on-screen installation wizard or through the command line. We will complete the installation through the command line. Change the current working directory<\/p>\n
cd \/var\/www\/html\/nextcloud<\/pre>\nand execute the following command as the web server user<\/p>\n
sudo -u www-data php occ maintenance:install --database \"mysql\" --database-name \"nextcloud\" --database-user \"nextcloud_user\" --database-pass \"PASSWORD\" --admin-user \"admin\" --admin-pass \"PASSWORD\"<\/pre>\nUse the database information we created above and set a strong password for the Nextcloud ‘admin’ user.<\/p>\n
If the installation is successfull you will get the following output<\/p>\n
Nextcloud was successfully installed<\/pre>\nEdit the config\/config.php file and add domain.com as a trusted domain<\/p>\n
nano config\/config.php\r\n\r\n 'trusted_domains' =>\r\n array (\r\n 0 => 'localhost',\r\n 1 => 'domain.com',\r\n ),<\/pre>\nCreate Apache Virtual Host<\/strong><\/h3>\n
If you want to be able to access Nextcloud with a domain name, you will have to create a new virtual host. Create the following file<\/p>\n
nano \/etc\/apache2\/sites-available\/domain.com.conf\r\n<\/pre>\n<VirtualHost *:80><\/p>\n
ServerAdmin admin@domain.com
\nDocumentRoot \/var\/www\/html\/nextcloud
\nServerName domain.com
\nServerAlias www.domain.com<\/p>\nAlias \/nextcloud “\/var\/www\/html\/nextcloud\/”<\/p>\n
<Directory \/var\/www\/html\/nextcloud>
\nOptions +FollowSymlinks
\nAllowOverride All<\/p>\n<IfModule mod_dav.c>
\nDav off
\n<\/IfModule><\/p>\nSetEnv HOME \/var\/www\/html\/nextcloud
\nSetEnv HTTP_HOME \/var\/www\/html\/nextcloud
\n<\/Directory><\/p>\nErrorLog \/var\/log\/apache2\/nextcloud-error_log
\nCustomLog \/var\/log\/apache2\/nextcloud-access_log common<\/p>\n<\/VirtualHost><\/p>\n
Save the file and enable the newly created virtual host<\/p>\n
a2ensite domain.com.conf<\/pre>\nIt is also recommended to enable the mod_headers, mod_env, mod_dir and mod_mime Apache modules<\/p>\n
a2enmod headers\r\na2enmod env\r\na2enmod dir\r\na2enmod mime<\/pre>\nTo activate the new configuration, you need to run the following command<\/p>\n
systemctl reload apache2<\/pre>\nWith this step the Nextcloud 13 installation is completed. You can now visit http:\/\/domain.com and login to your Nextcloud instance using the credentials used in the insallation command above.<\/p>\n
\nOf course, you don\u2019t have to Install NextCloud 13 on Debian 9, if you use one of our NextClould Hosting services,<\/a> in which case you can simply ask our expert Linux admins to setup this for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n
PS.<\/strong><\/span> If you liked this post, on How To Install NextCloud 13 on Debian 9, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"
We’ll show you, how to install NextCloud 13 on Debian 9. Nextcloud is an open-source software suite that allows users … <\/p>\n