{"id":516,"date":"2018-12-23T22:33:09","date_gmt":"2018-12-23T22:33:09","guid":{"rendered":"http:\/\/www.tinone71.com\/?p=516"},"modified":"2022-03-19T13:58:38","modified_gmt":"2022-03-19T12:58:38","slug":"setup-nextcloud-on-ubuntu-18-04-lts","status":"publish","type":"post","link":"https:\/\/www.tinone71.com\/wp\/?p=516","title":{"rendered":"Setup NextCloud On Ubuntu 18.04 LTS"},"content":{"rendered":"<div style=\"\" class=\"ssag-opads-main     \" ><\/div><p>Since Ubuntu 18.04 LTS was released\u2026 I have been testing it in my lab environment\u2026 and the steps below is how I got NextCloud installed with Apaches, MariaDB and PHP 7.1 Support\u2026<\/p>\n<p>NextCloud is a true open source, self-hosted cloud storage service and a fork of OwnCloud. Like DropBox and other cloud storage services, NextCloud provides similar functions and unlike the other proprietary storage services, NextCloud is free to use\u2026<\/p>\n<p>NextCloud enables private cloud services on users\u2019 own servers. It\u2019s a self-hosted file sync and share app platforms and with it you can access &amp; sync your files, contacts and data across your devices.<\/p>\n<p>This brief tutorial shows students and new users steps to install and configure NextCloud on Ubuntu 18.04 LTS Servers in your own environment.<\/p>\n<p><span id=\"more-17780\"><\/span>To get started with installing NextCloud, follow the steps below:<\/p>\n<h4>Step 1: Install Apache2 HTTP Server<\/h4>\n<p>NextCloud needs a web server and the most popular webserver in use today is Apache2. So, go and install Apache2 on Ubuntu by running the commands below:<\/p>\n<p><code>sudo apt install apache2<\/code><\/p>\n<p>After installing Apache2, run the commands below to disable directory listing.<\/p>\n<p><code>sudo sed -i \"s\/Options Indexes FollowSymLinks\/Options FollowSymLinks\/\" \/etc\/apache2\/apache2.conf<\/code><\/p>\n<p>After installing the commands below can be used to stop, start and enable Apache2 service to always start up with the server boots.<\/p>\n<pre>sudo systemctl stop apache2.service\nsudo systemctl start apache2.service\nsudo systemctl enable apache2.service\n<\/pre>\n<h4>Step 2: Install MariaDB<\/h4>\n<p>NextCloud also needs a database server\u2026 and MariaDB database server is a great place to start. To install it run the commands below.<\/p>\n<p><code>sudo apt install mariadb-server mariadb-client<\/code><\/p>\n<p>After installing, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots.<\/p>\n<pre>sudo systemctl stop mariadb.service\nsudo systemctl start mariadb.service\nsudo systemctl enable mariadb.service\n<\/pre>\n<p>After that, run the commands below to secure MariaDB server.<\/p>\n<p><code>sudo mysql_secure_installation<\/code><\/p>\n<p>When prompted, answer the questions below by following the guide.<\/p>\n<ul>\n<li>Enter current password for root (enter for none): Just press the&nbsp;Enter<\/li>\n<li>Set root password? [Y\/n]:&nbsp;Y<\/li>\n<li>New password:&nbsp;Enter password<\/li>\n<li>Re-enter new password:&nbsp;Repeat password<\/li>\n<li>Remove anonymous users? [Y\/n]:&nbsp;Y<\/li>\n<li>Disallow root login remotely? [Y\/n]:&nbsp;Y<\/li>\n<li>Remove test database and access to it? [Y\/n]: &nbsp;Y<\/li>\n<li>Reload privilege tables now? [Y\/n]: &nbsp;Y<\/li>\n<\/ul>\n<p>Restart MariaDB server<\/p>\n<p><code>sudo systemctl restart mariadb.service<\/code><\/p>\n<h4>Step 3: Install PHP and Related Modules<\/h4>\n<p>PHP 7.1 may not be available in Ubuntu default repositories\u2026 in order to install it, you will have to get it from third-party repositories.<\/p>\n<p>Run the commands below to add the below third party repository to upgrade to PHP 7.1<\/p>\n<pre>sudo apt-get install software-properties-common\nsudo add-apt-repository ppa:ondrej\/php\n<\/pre>\n<p>Then update and upgrade to PHP 7.1<\/p>\n<p><code>sudo apt update<\/code><\/p>\n<p>Finally, run the commands below to install PHP 7.1 and related modules..<\/p>\n<p><code>sudo apt install php7.1 libapache2-mod-php7.1 php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-apcu php7.1-smbclient php7.1-ldap php7.1-redis php7.1-gd php7.1-xml php7.1-intl php7.1-json php7.1-imagick php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl<\/code><\/p>\n<p>After install PHP, run the commands below to open FPM PHP default file.<\/p>\n<p><code>sudo nano \/etc\/php\/7.1\/apache2\/php.ini<\/code><\/p>\n<p>Then make the change the following lines below in the file and save.<\/p>\n<pre>file_uploads = On\nallow_url_fopen = On\nmemory_limit = 256M\nupload_max_filesize = 100M\ndisplay_errors = Off\ndate.timezone = America\/Chicago<\/pre>\n<h4>Step 4: Create NextCloud Database<\/h4>\n<p>Now that you\u2019ve install all the packages that are required, continue below to start configuring the servers. First run the commands below to create a blank NextCloud database.<\/p>\n<p>To logon to MariaDB server, run the commands below<\/p>\n<p><code>sudo mysql -u root -p<\/code><\/p>\n<p>Then create a database called&nbsp;<b>nextcloud<\/b><\/p>\n<p><code>CREATE DATABASE&nbsp;nextcloud;<\/code><\/p>\n<p>Create a database user called&nbsp;<strong>nextclouduser<\/strong>&nbsp;with new password<\/p>\n<p><code>CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'new_password_here';<\/code><\/p>\n<p>Then grant the user full access to the database.<\/p>\n<p><code>GRANT ALL ON&nbsp;nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;<\/code><\/p>\n<p>Finally, save your changes and exit.<\/p>\n<pre>FLUSH PRIVILEGES;\nEXIT;\n<\/pre>\n<h4>Step 5: Download NextCloud Latest Release<\/h4>\n<p>Next, visit NextCloud site to download your free copy. The community edition is what you\u2019ll want to download.<\/p>\n<p>After downloading, run the commands below to extract the download file into Apache2 root directory.<\/p>\n<pre>cd \/tmp &amp;&amp; wget https:\/\/download.nextcloud.com\/server\/releases\/nextcloud-11.0.1.zip\nunzip nextcloud-11.0.1.zip\nsudo mv nextcloud \/var\/www\/html\/nextcloud\/\n<\/pre>\n<p>Then run the commands below to set the correct permissions for NextCloud to function.<\/p>\n<pre>sudo chown -R www-data:www-data \/var\/www\/html\/nextcloud\/\nsudo chmod -R 755 \/var\/www\/html\/nextcloud\/\n<\/pre>\n<h4>Step 6: Configure Apache2<\/h4>\n<p>Finally, configure Apahce2 site configuration file for NextCloud. This file will control how users access NextCloud content. Run the commands below to create a new configuration file called&nbsp;<strong>nextcloud.conf<\/strong><\/p>\n<p><code>sudo nano \/etc\/apache2\/sites-available\/nextcloud.conf<\/code><\/p>\n<p>Then copy and paste the content below into the file and save it. Replace the highlighted line with your own domain name and directory root location.<\/p>\n<pre>&lt;VirtualHost *:80&gt;\n     ServerAdmin admin@example.com\n     DocumentRoot \/var\/www\/html\/nextcloud\/\n     ServerName example.com\n     ServerAlias www.example.com\n  \n     Alias \/nextcloud \"\/var\/www\/html\/nextcloud\/\"\n\n     &lt;Directory \/var\/www\/html\/nextcloud\/&gt;\n        Options +FollowSymlinks\n        AllowOverride All\n        Require all granted\n          &lt;IfModule mod_dav.c&gt;\n            Dav off\n          &lt;\/IfModule&gt;\n        SetEnv HOME \/var\/www\/html\/nextcloud\n        SetEnv HTTP_HOME \/var\/www\/html\/nextcloud\n     &lt;\/Directory&gt;\n\n     ErrorLog ${APACHE_LOG_DIR}\/error.log\n     CustomLog ${APACHE_LOG_DIR}\/access.log combined\n\n&lt;\/VirtualHost&gt;\n<\/pre>\n<p>Save the file and exit.<\/p>\n<h4>Step 7: Enable the NextCloud and Rewrite Module<\/h4>\n<p>After configuring the VirtualHost above, enable it by running the commands below<\/p>\n<pre>sudo a2ensite nextcloud.conf\nsudo a2enmod rewrite\nsudo a2enmod headers\nsudo a2enmod env\nsudo a2enmod dir\nsudo a2enmod mime\n<\/pre>\n<h4>Step 8 : Restart Apache2<\/h4>\n<p>To load all the settings above, restart Apache2 by running the commands below.<\/p>\n<p><code>sudo systemctl restart apache2.service<\/code><\/p>\n<p>Then open your browser and browse to the server domain name followed by install. You should see OwnCloud setup wizard to complete. Please follow the wizard carefully.<\/p>\n<h4>http:\/\/example.com<\/h4>\n<p>You should then see NextCloud setup page.. Connect to the database using the information you created and continue. Select the database server installed on your systems by clicking it as shown in the image below<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-16024 jetpack-lazy-image jetpack-lazy-image--handled\" src=\"https:\/\/i1.wp.com\/websiteforstudents.com\/wp-content\/uploads\/2017\/01\/nextcloud_ubuntu_install.png?resize=562%2C789&amp;ssl=1\" sizes=\"(max-width: 562px) 100vw, 562px\" srcset=\"https:\/\/i1.wp.com\/websiteforstudents.com\/wp-content\/uploads\/2017\/01\/nextcloud_ubuntu_install.png?w=562&amp;ssl=1 562w, https:\/\/i1.wp.com\/websiteforstudents.com\/wp-content\/uploads\/2017\/01\/nextcloud_ubuntu_install.png?resize=214%2C300&amp;ssl=1 214w\" alt=\"nextcloud ubuntu installation\" width=\"562\" height=\"789\" data-recalc-dims=\"1\" data-lazy-loaded=\"1\"><\/p>\n<p>&nbsp;<\/p>\n<p>Click Finish setup and you\u2019re done.<\/p>\n<p>Enjoy!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-16025 jetpack-lazy-image jetpack-lazy-image--handled\" src=\"https:\/\/i0.wp.com\/websiteforstudents.com\/wp-content\/uploads\/2017\/01\/nextcloud_ubuntu_install_1.png?resize=651%2C425&amp;ssl=1\" sizes=\"(max-width: 651px) 100vw, 651px\" srcset=\"https:\/\/i0.wp.com\/websiteforstudents.com\/wp-content\/uploads\/2017\/01\/nextcloud_ubuntu_install_1.png?w=651&amp;ssl=1 651w, https:\/\/i0.wp.com\/websiteforstudents.com\/wp-content\/uploads\/2017\/01\/nextcloud_ubuntu_install_1.png?resize=300%2C196&amp;ssl=1 300w\" alt=\"nextcloud ubuntu setup\" width=\"651\" height=\"425\" data-recalc-dims=\"1\" data-lazy-loaded=\"1\"><\/p>\n<p>&nbsp;<\/p>\n<p>Congratulations! You have successfully installed<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since Ubuntu 18.04 LTS was released\u2026 I have been testing it in my lab environment\u2026 and the steps<\/p>\n","protected":false},"author":1,"featured_media":1007,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[8,11],"tags":[25,24],"_links":{"self":[{"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/516"}],"collection":[{"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=516"}],"version-history":[{"count":3,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/516\/revisions"}],"predecessor-version":[{"id":1008,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/516\/revisions\/1008"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=\/wp\/v2\/media\/1007"}],"wp:attachment":[{"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tinone71.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}