{"id":7,"date":"2025-10-01T02:59:55","date_gmt":"2025-10-01T02:59:55","guid":{"rendered":"https:\/\/mydata.collection.my.id\/?page_id=7"},"modified":"2025-10-01T02:59:55","modified_gmt":"2025-10-01T02:59:55","slug":"nextcloud-ubuntu-22","status":"publish","type":"page","link":"https:\/\/mydata.collection.my.id\/index.php\/nextcloud-ubuntu-22\/","title":{"rendered":"Nextcloud ubuntu 22"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Posted on<a href=\"https:\/\/catatan.collection.my.id\/2025\/06\/14\/nextcloud-ubuntu-22\/\">14\/06\/2025<\/a>by<a href=\"https:\/\/catatan.collection.my.id\/author\/roni\/\">roni<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step1: Install Required Packages<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Update and Upgrade the Ubuntu Packages<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update &amp;&amp; apt upgrade -y<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. install Apache and MySQL Server<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">apt install apache2 mariadb-server<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install apache2 mariadb-server<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Install PHP and other Dependencies and Restart Apache<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">apt install libapache2-mod-php php-bz2 php-gd php-mysql php-curl php-zip \\ php-mbstring php-imagick php-ctype php-curl php-dom php-json php-posix \\ php-bcmath php-xml php-intl php-gmp zip unzip wget<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install libapache2-mod-php php-bz2 php-gd php-mysql php-curl php-zip \\\nphp-mbstring php-imagick php-ctype php-curl php-dom php-json php-posix \\\nphp-bcmath php-xml php-intl php-gmp zip unzip wget<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4. Enable required Apache modules and restart Apache:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">a2enmod rewrite dir mime env headers systemctl restart apache2<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2enmod rewrite dir mime env headers\nsystemctl restart apache2<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step2. Configure MySQL Server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Login to MySQL Prompt, Just type<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">mysql<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Create MySQL Database and User for Nextcloud and Provide Permissions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">CREATE USER \u2018nextcloud\u2019@\u2019localhost\u2019 IDENTIFIED BY \u2018passw@rd\u2019; CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; GRANT ALL PRIVILEGES ON nextcloud.* TO \u2018nextcloud\u2019@\u2019localhost\u2019; FLUSH PRIVILEGES; quit;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'passw@rd';\nCREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;\nGRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';\nFLUSH PRIVILEGES;\nquit;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step3. Download, Extract, and Apply Permissions.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now download the latest Nextcloud archive file, Go to the&nbsp;<a href=\"https:\/\/nextcloud.com\/install\" target=\"_blank\" rel=\"noreferrer noopener\">Nextcloud Download Page<\/a>. Or you can download from direct link: <a href=\"https:\/\/download.nextcloud.com\/server\/releases\/latest.zip\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/download.nextcloud.com\/server\/releases\/latest.zip<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Download and unzip in the \/var\/www folder<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">cd \/var\/www\/ wget https:\/\/download.nextcloud.com\/server\/releases\/latest.zip unzip latest.zip<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/var\/www\/\nwget https:\/\/download.nextcloud.com\/server\/releases\/latest.zip\nunzip latest.zip<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Remove the zip file, which is not necessary now.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">rm -rf latest.zip<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm -rf latest.zip<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Change the ownership of the nextcloud content directory to the HTTP user.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">chown -R www-data:www-data \/var\/www\/nextcloud\/<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chown -R www-data:www-data \/var\/www\/nextcloud\/<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step4. Install NextCloud From the Command Line<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We are going to install Nextcloud on Ubuntu 22.04 from the command line, it will save us time as we are providing all the database and admin credentials for installation. It will install Nextcloud silently, we don\u2019t have to go through web setup. For detailed Nextcloud Command line installation, visit <a href=\"http:\/\/www.mailserverguru.com\/install-nextcloud-from-command-line\/\">this page<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Run the CLI Command<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">cd \/var\/www\/nextcloud sudo -u www-data php occ maintenance:install \u2013database \\ \u201cmysql\u201d \u2013database-name \u201cnextcloud\u201d \u2013database-user \u201cnextcloud\u201d \u2013database-pass \\ \u201cpassw@rd\u201d \u2013admin-user \u201cadmin\u201d \u2013admin-pass \u201cadmin123\u201d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/var\/www\/nextcloud\nsudo -u www-data php occ  maintenance:install --database \\\n\"mysql\" --database-name \"nextcloud\"  --database-user \"nextcloud\" --database-pass \\\n\"passw@rd\" --admin-user \"admin\" --admin-pass \"admin123\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If everything goes well the command will output&nbsp;<strong><em><mark>\u201cNextcloud was successfully installed\u201d<\/mark><\/em><\/strong>. We provided a very simple user\/password, during production setup, this must be a complex password.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. nextcloud allows access only from localhost, it could through error&nbsp;<strong><em><mark>\u201cAccess through untrusted domain\u201d<\/mark><\/em><\/strong>. we need to allow accessing nextcloud by using ip or domain name.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">vi \/var\/www\/nextcloud\/config\/config.php \u2018trusted_domains\u2019 =&gt; array ( 0 =&gt; \u2018localhost\u2019, 1 =&gt; \u2018nc.mailserverguru.com\u2019, \/\/ we Included the Sub Domain ), \u2026.. <img decoding=\"async\" alt=\"\ud83d\ude21\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/16.0.1\/svg\/1f621.svg\"> \/\/ saving the file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/var\/www\/nextcloud\/config\/config.php\n\n  'trusted_domains' =&gt;\n  array (\n    0 =&gt; 'localhost',\n    1 =&gt; 'nc.mailserverguru.com',   \/\/ we Included the Sub Domain\n  ),\n  .....\n:x    \/\/ saving the file<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Configure Apache to load Nextcloud from the <strong>\/var\/www\/nextcloud<\/strong> folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">vi \/etc\/apache2\/sites-enabled\/000-default.conf &lt;VirtualHost *:80&gt; ServerAdmin webmaster@localhost DocumentRoot \/var\/www\/nextcloud ErrorLog ${APACHE_LOG_DIR}\/error.log CustomLog ${APACHE_LOG_DIR}\/access.log combined &lt;\/VirtualHost&gt; <img decoding=\"async\" alt=\"\ud83d\ude21\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/16.0.1\/svg\/1f621.svg\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/etc\/apache2\/sites-enabled\/000-default.conf\n\n&lt;VirtualHost *:80&gt;\n        ServerAdmin webmaster@localhost\n        DocumentRoot \/var\/www\/nextcloud\n        ErrorLog ${APACHE_LOG_DIR}\/error.log\n        CustomLog ${APACHE_LOG_DIR}\/access.log combined\n&lt;\/VirtualHost&gt;\n\n:x<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Now, Restart Apache Server<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">systemctl restart apache2<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart apache2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, Go to the Browser and type <strong><em>http:\/\/ [ ip or fqdn ]<\/em><\/strong> of the server, The below Nextcloud login page will appear.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fmailserverguru.com%3Fsis_share%3D1%26img%3Dhttp%253A%252F%252Fmailserverguru.com%252Fwp-content%252Fuploads%252F2023%252F06%252Fnextcloud-admin-login.png%26post%3D3920\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"http:\/\/mailserverguru.com\/wp-content\/uploads\/2023\/06\/nextcloud-admin-login.png\" alt=\"nextcloud admin login\" class=\"wp-image-3918\"\/><\/a><figcaption class=\"wp-element-caption\">Nextcloud Admin Login<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The Basic NextCloud Installation on Ubuntu 22.04 is completed, Now we are going to Work on the Performance and Security.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Posted on14\/06\/2025byroni Step1: Install Required Packages 1. Update and Upgrade the Ubuntu Packages 2. install Apache and MySQL Server apt install apache2 mariadb-server 3. Install PHP and other Dependencies and Restart Apache apt install libapache2-mod-php php-bz2 php-gd php-mysql php-curl php-zip &hellip; <a href=\"https:\/\/mydata.collection.my.id\/index.php\/nextcloud-ubuntu-22\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-7","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/mydata.collection.my.id\/index.php\/wp-json\/wp\/v2\/pages\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mydata.collection.my.id\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mydata.collection.my.id\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mydata.collection.my.id\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mydata.collection.my.id\/index.php\/wp-json\/wp\/v2\/comments?post=7"}],"version-history":[{"count":1,"href":"https:\/\/mydata.collection.my.id\/index.php\/wp-json\/wp\/v2\/pages\/7\/revisions"}],"predecessor-version":[{"id":8,"href":"https:\/\/mydata.collection.my.id\/index.php\/wp-json\/wp\/v2\/pages\/7\/revisions\/8"}],"wp:attachment":[{"href":"https:\/\/mydata.collection.my.id\/index.php\/wp-json\/wp\/v2\/media?parent=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}