How Do I Speed Up Uploading Files to Esxi
This tutorial will be showing you how to install NextCloud on Ubuntu twenty.04 LTS with Apache spider web server.
What'southward NextCloud?
NextCloud is a free open-source self-hosted cloud storage solution. It'southward functionally similar to Dropbox. Proprietary deject storage solutions (Dropbox, Google Bulldoze, etc) are convenient, but at a price: they tin be used to collect personal data because your files are stored on their computers. If you lot worry virtually privacy, you can switch to NextCloud, which you can install on your private domicile server or on a virtual private server (VPS). Y'all can upload your files to your server via NextCloud and so sync those files to your desktop estimator, laptop or smartphone. This fashion you have full control of your information.
NextCloud Features
- Free and open up-source
- Terminate-to-end encryption, pregnant files tin can exist encrypted on client devices earlier uploaded to the server, then fifty-fifty if someone steals your server, they tin can non read your files.
- Tin can be integrated with an online office suite (Collobora Online, OnlyOffice) so you can create and edit your doc, ppt, xls files direct from NextCloud.
- The app store contains hundreds of apps to extend functionality (like agenda app, contacts app, note-taking app, video conferencing app, etc).
- The sync client is available on Linux, macOS, Windows, iOS and android.
Prerequisites
NextCloud is written in PHP programing language. To follow this tutorial, you showtime need to install LAMP stack on Ubuntu 20.04. If you oasis't already done so, delight check out the following tutorial.
- How to Install LAMP Stack (Apache, MariaDB, PHP7.4-FPM) on Ubuntu xx.04
Y'all tin install NextCloud on your dwelling house server or a VPS (virtual private server). You also need a domain name, and then afterwards on your will be able to enable HTTPS to encrypt the HTTP traffic. I registered my domain name from NameCheap because the price is depression and they give whois privacy protection free for life. Nextcloud can exist installed without a domain name, but it actually doesn't brand sense if yous don't encrypt the HTTP connection to forbid snooping. I recommend buying a domain proper noun, if you actually want to tinker with server software and use them to the fullest potential.
At present let's install NextCloud.
Step 1: Download NextCloud on Ubuntu 20.04
Log into your Ubuntu 20.04 server. So download the NextCloud zip archive onto your server. The latest stable version is 21.0.one at time of this writing. You may need to modify the version number. Go to https://nextcloud.com/install and click the download for server button to see the latest version.
Yous tin run the post-obit command to download it on your server.
wget https://download.nextcloud.com/server/releases/nextcloud-21.0.one.zip You lot can always use the above URL format to download NextCloud. If a new version comes out, simply replace 21.0.i with the new version number.
Once downloaded, extract the annal with unzip.
sudo apt install unzip sudo unzip nextcloud-21.0.1.zip -d /var/world wide web/ The -d selection specifies the target directory. NextCloud web files will exist extracted to /var/www/nextcloud/. And so we need to change the owner of this directory to www-data then that the web server (Apache) can write to this directory.
sudo chown www-data:www-data /var/www/nextcloud/ -R
Stride ii: Create a Database and User for Nextcloud in MariaDB Database Server
Log into MariaDB database server with the following command. Since MariaDB is now using unix_socket plugin to hallmark user login, at that place'southward no need to enter MariaDB root countersign. We just need to prefix the mysql control with sudo.
sudo mysql
And so create a database for Nextcloud. This tutorial proper name the database nextcloud. You tin apply whatever name you similar.
create database nextcloud; Create the database user. Over again, you tin use your preferred name for this user. Replace your-password with your preferred countersign.
create user nextclouduser@localhost identified by 'your-password';
Grant this user all privileges on the nextcloud database.
grant all privileges on nextcloud.* to nextclouduser@localhost identified by 'your-password';
Flush privileges and exit.
affluent privileges; exit;
Step three: Create an Apache Virtual Host for Nextcloud
Create a nextcloud.conf file in /etc/apache2/sites-available/ directory, with a command-line text editor like Nano.
sudo nano /etc/apache2/sites-available/nextcloud.conf
Re-create and paste the following text into the file. Supervene upon nextcloud.example.com with your own preferred sub-domain. Don't forget to create DNS A record for this sub-domain in your DNS zone editor. If yous don't have a real domain proper noun, I recommend going to NameCheap to buy one. The price is depression and they give whois privacy protection free for life.
<VirtualHost *:80> DocumentRoot "/var/www/nextcloud" ServerName nextcloud.example.com ErrorLog ${APACHE_LOG_DIR}/nextcloud.error CustomLog ${APACHE_LOG_DIR}/nextcloud.access combined <Directory /var/www/nextcloud/> Require all granted Options FollowSymlinks MultiViews AllowOverride All <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/nextcloud SetEnv HTTP_HOME /var/www/nextcloud Satisfy Any </Directory> </VirtualHost> Save and close the file. (To relieve a file in Nano text editor, printing Ctrl+O, then press Enter to ostend. To leave, printing Ctrl+X.)
Then enable this virtual host.
sudo a2ensite nextcloud.conf
Run the following command to enable required Apache modules.
sudo a2enmod rewrite headers env dir mime setenvif ssl
Then exam Apache configuration.
sudo apache2ctl -t
If the syntax is OK, reload Apache for the changes to take event.
sudo systemctl restart apache2
Step 4: Install and Enable PHP Modules
Run the following commands to install PHP modules required or recommended past NextCloud.
sudo apt install imagemagick php-imagick libapache2-mod-php7.iv php7.4-mutual php7.four-mysql php7.4-fpm php7.4-gd php7.four-json php7.iv-coil php7.4-zip php7.iv-xml php7.4-mbstring php7.4-bz2 php7.four-intl php7.4-bcmath php7.4-gmp
Reload Apache to use these modules.
sudo systemctl reload apache2
Step 5: Enable HTTPS
Now you tin admission the Nextcloud web install wizard in your spider web browser by entering the domain name for your Nextcloud installation.
nextcloud.example.com
If the spider web page tin can't load, you probably need to open port lxxx in firewall.
sudo iptables -I INPUT -p tcp --dport eighty -j ACCEPT
And port 443 every bit well.
sudo iptables -I INPUT -p tcp --dport 443 -j ACCEPT
Earlier entering any sensitive information, we should enable secure HTTPS connexion on Nextcloud. We can obtain a free TLS certificate from Let's Encrypt. Install Allow'south Encrypt customer (certbot) from Ubuntu 20.04 repository.
sudo apt install certbot python3-certbot-apache
Python3-certbot-apache is the Apache plugin. Side by side, run the post-obit command to obtain a free TLS certificate using the Apache plugin.
sudo certbot --apache --agree-tos --redirect --staple-ocsp --email [electronic mail protected] -d nextcloud.example.com
Where:
- –apache2: Use the Apache authenticator and installer
- –agree-tos: Agree to Permit's Encrypt terms of service
- –redirect: Enforce HTTPS by adding 301 redirect.
- –staple-ocsp: Enable OCSP Stapling.
- –email: Email used for registration and recovery contact.
- -d flag is followed by a list of domain names, separated by comma. Yous tin add upwardly to 100 domain names.
Y'all will be asked if y'all desire to receive emails from EFF(Electronic Frontier Foundation). Afterwards choosing Y or North, your TLS certificate volition be automatically obtained and configured for yous, which is indicated past the message below.
I establish that Certbot can't automatically add HSTS header in the Apache config file for Nextcloud. If you would like to enable HSTS (HTTP Strict Transport Security), then edit the file.
sudo nano /etc/apache2/sites-enabled/nextcloud-le-ssl.conf
We can and so add the following line in the SSL server cake to enable HSTS header.
Header ever set Strict-Transport-Security "max-age=31536000"
Similar below.
Save and close the file. Then text Apache configurations.
sudo apache2ctl -t
If the exam is successful, reload Apache for the change to take effect.
sudo systemctl reload apache2
The in a higher place configuration volition get A+ score on SSL test.
Step 6: Finish the Installation in your Web Browser
Now you tin can access the Nextcloud web install wizard using HTTPS connectedness.
https://nextcloud.example.com
To complete the installation, you lot demand to create an admin account, enter the path of Nextcloud data folder, enter database details yous created in step two. Yous tin can use the default localhost equally host address, or you can enter localhost:3306, as MariaDB listens on port 3306.
The data folder is where users' files are stored. For security, information technology'south best to identify the data directory outside of Nextcloud webroot directory. So instead of storing users' files nether /var/www/nextcloud/data/, we can change it to /var/www/nextcloud-information. which tin be created with the post-obit command:
sudo mkdir /var/www/nextcloud-data
Then make certain Apache user (world wide web-data) has write permission to the data directory.
sudo chown www-information:www-data /var/world wide web/nextcloud-data -R
Click the Finish Setup push button, you volition see the Web interface of Nextcloud. Congrats! You lot can start using it every bit your private deject storage.
How to Set up NextCloud E-mail Notification
If your NextCloud instance will be used by more one person, it'south of import that your NextCloud server tin send transactional emails, such every bit password-resetting electronic mail. First, you should set an electronic mail address for your ain account. Become to Settings -> Personal Info and gear up an email accost for your account.
And so get to Settings -> Basic settings. You will discover the email server settings. In that location are two send modes: sendmail and smtp. Yous can choose the sendmail mode if your NextCloud host has an SMTP server running.
If you lot would like to employ an SMTP server running on some other host, then choose smtp style and enter the SMTP server accost and login credentials like below. Choose STARTTLS for encryption.
For how to set upwards an email server, please check out the following tutorial. Notation that I highly recommend running iRedMail mail service server on a fresh clean Os. Installing iRedMail on an Os that has other web applications can neglect, and probable break existing applications.
- How to hands set up a full-featured mail server on Ubuntu 20.04 with iRedMail
How to Reset Nextcloud User Countersign From Command Line
If you lost your admin account countersign, and you didn't gear up up electronic mail delivery in Nextcloud, so you need to reset the password past running the following command on your server. Replace nextcloud_username with your real username.
sudo -u www-data php /var/www/nextcloud/occ user:resetpassword nextcloud_username There are also other commands you might find useful. List available commands with:
sudo -u www-data php /var/www/nextcloud/occ
or
sudo -u www-data php /var/www/nextcloud/console.php
How to Motion the Data Directory
In case you need to motility the NextCloud data directory, there are 4 steps to accomplish this. Outset, you need to utilise the cp command to copy the data directory to the new directory. For example, the mountain bespeak of my external hard bulldoze is /media/linuxbabe/b43e4eea-9796-4ac6-9c48-2bcaa46353731. I create the new data directory on the external hard drive.
sudo mkdir /media/linuxbabe/b43e4eea-9796-4ac6-9c48-2bcaa46353731/nextcloud-information/
And then I copy the original information directory to the new data directory. -R flag means the re-create operation is recursive.
sudo cp /var/www/nextcloud-data/* /media/linuxbabe/b43e4eea-9796-4ac6-9c48-2bcaa46353731/nextcloud-information/ -R
You also need to copy the .ocdata file.
sudo cp /var/www/nextcloud-data/.ocdata /media/linuxbabe/b43e4eea-9796-4ac6-9c48-2bcaa46353731/nextcloud-data/
Side by side, you need to prepare world wide web-data (Apache user) every bit the possessor.
sudo chown www-data:www-information /media/linuxbabe/b43e4eea-9796-4ac6-9c48-2bcaa46353731/nextcloud-information/ -R
Lastly, you lot need to edit the config.php file.
sudo nano /var/world wide web/nextcloud/config/config.php
Find the following line and change the value of datadirectory.
'datadirectory' => '/var/world wide web/nextcloud-data',
Save and close the file. Reload NextCloud web page and you are done.
Stride 7: Increase PHP Memory Limit
The default PHP retention limit is 128MB. NextCloud recommends 512MB for better performance. To change PHP memory limit, edit the php.ini file.
sudo nano /etc/php/7.4/apache2/php.ini
Find the following line. (line 409)
memory_limit = 128M
Change the value.
memory_limit = 512M
Save and close the file. Alternatively, you tin can run the following command to change the value without manually opening the file.
sudo sed -i 's/memory_limit = 128M/memory_limit = 512M/one thousand' /etc/php/7.iv/apache2/php.ini
Then reload Apache for the changes to take effect.
sudo systemctl reload apache2
If your server has the /etc/php7.4/fpm/php.ini file, that ways your server also runs PHP-FPM. I recommend changing the memory_limit in PHP-FPM as well.
sudo nano /etc/php/7.four/fpm/php.ini
Find the memory_limit parameter and change the value. After saving the file, reload PHP-FPM for the change to take upshot.
sudo systemctl reload php7.4-fpm
Footstep 8: Configure Redis Cache for NextCloud
If you go to your NextCloud settings -> overview folio, you might encounter the following warning:
No memory cache has been configured. To enhance your performance please configure a memcache if bachelor.
We will enable memory caching for nextCloud by using Redis. Run the following command to install Redis server from Ubuntu repository.
sudo apt install redis-server
You tin can check the version with:
redis-server -v
Sample output:
Redis server v=5.0.seven sha=00000000:0 malloc=jemalloc-5.ii.1 bits=64 build=636cde3b5c7a3923
Now we tin bank check if redis server is running.
systemctl condition redis
Hint: If the above control didn't quit immediately, you can press the Q key to gain back control of the last.
From the in a higher place screenshot, nosotros can see that it's running and car-start is enabled. If for any reason it'southward non running, execute the following command:
sudo systemctl get-go redis-server
And if auto-showtime at boot time is not enabled, y'all tin can use the post-obit command to enable it:
sudo systemctl enable redis-server
In order to configure Redis as a cache for nextCloud, nosotros demand to install the PHP extension for interfacing with Redis.
sudo apt install php-redis
Cheque if the extension is enabled.
php --ri redis
We can see that Redis extension is enabled. If it's not enabled, run the following command:
sudo phpenmod redis
You may as well need to reload Apache if the redis extension is notwithstanding not enabled.
sudo systemctl reload apache2
Side by side, edit nextCloud configuration file.
sudo nano /var/www/nextcloud/config/config.php
Add the post-obit lines in a higher place the catastrophe ); line.
'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.local' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( 'host' => 'localhost', 'port' => 6379, ),
Save and close the file. Then restart Apache and PHP-FPM.
sudo systemctl restart apache2 php7.4-fpm
At present become to NextCloud settings -> overview page again and refresh the spider web page, the alarm about memory caching should exist gone.
Adding Missing Indexes
If you lot see the following message in the NextCloud Settings -> Overview page,
The database is missing some indexes. Due to the fact that adding indexes on big tables could have some time they were non added automatically.
Then you need to manually add those indexes. Alter to the Nextcloud webroot directory.
cd /var/world wide web/nextcloud/
Run the following command to add indexes to the Nextcloud database.
sudo -u www-data php occ db:add-missing-indices
At present if yous refresh the NextCloud Settings -> Overview page, the alert about missing indexes should exist gone.
Conversion to Big Int
If yous run across the following bulletin in the NextCloud Settings -> Overview folio,
Some columns in the database are missing a conversion to big int. Due to the fact that changing column types on large tables could take some fourth dimension they were not changed automatically.
So y'all need to manually change the column blazon. Alter to the Nextcloud webroot directory.
cd /var/www/nextcloud/
Change your Nextcloud into maintenance mode to prevent users from logging in and making changes.
sudo - u world wide web - data php occ maintenance : mode -- on
Then run the following command to change the column type.
sudo -u world wide web-data php occ db:convert-filecache-bigint
In one case it'due south done, switch off the maintenance mode.
sudo - u www - information php occ maintenance : fashion -- off
Now if y'all refresh the NextCloud Settings -> Overview page, the warning about big int should be gone.
How to Install NextCloud Customer on Ubuntu 20.04 Desktop
Run the post-obit commands on Ubuntu xx.04 desktop to install the client from the default repository.
sudo apt install nextcloud-client
NextCloud Client on Ubuntu 20.04
Client software for macOS, Windows, Android and iOS can be constitute on the Nextcloud download page.
How to Enable OnlyOffice/Collabora Online
By default, Nextcloud ships with support for OnlyOffice, which an online office suite that allows you lot to edit your doc, ppt, xls files straight from NextCloud. We merely need to install an app to use this feature. Go to Nextcloud Apps -> Role & Text. Notice and enable the customs document server app.
Now when you click the add together button (+) in Nextcloud, you volition be able to create Word, spreadsheet and presentation documents correct from your Nextcloud server.
Yet, I found this app isn't very reliable. And the community edition allows only twenty users at most. You lot need to buy an enterprise edition if you have more than than 20 users. There's another open-source LibreOffice-based online office suite called Collabora Online that has the aforementioned functionality, but without the limitation on the number of users. You can read the following article to integrate it with Nextcloud.
- Integrate Collabora Online with Nextcloud on Ubuntu with Docker
Increment Upload File Size Limit
If you apply the Apache PHP module to run PHP script, so at that place'southward no upload file size limit. If you use PHP-FPM to run PHP script, you need to alter the file size limit. The default maximum file size for uploading in PHP-FPM is 2MB. To increase the upload size limit, edit the PHP configuration file.
sudo nano /etc/php/7.4/fpm/php.ini
Find the following line (line 846).
upload_max_filesize = 2M
Change the value similar beneath:
upload_max_filesize = 1024M
Save and shut the file. Alternatively, yous can run the following command to change the value without manually opening the file.
sudo sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 1024M/g' /etc/php/7.4/fpm/php.ini
Then restart PHP-FPM.
sudo systemctl restart php7.4-fpm
Enabling HTTP/2 Protocol
HTTP/2 protocol can profoundly amend folio loading speed. You can read the following guide to enable HTTP/ii protocol on Apache.
- How to Enable HTTP/ii Protocol with Apache on Ubuntu twenty.04
Adding Local DNS Entry
It'south recommended to edit the /etc/hosts file on your Nextcloud server and add together the following entry, and so that Nextcloud itself won't have to query the public DNS, which can improve the overall stability. If your Nextcloud server can't resolve the nextcloud.example.com hostname, then you lot may encounter a 504 gateway time out mistake.
127.0.0.1 localhost nextcloud.example.com An IP address in the /etc/hosts file can have multiple hostnames, so if you take other applications installed on the same box, you can also add other hostnames or sub-domains on the same line like this:
127.0.0.1 localhost focal ubuntu nextcloud.instance.com collabora.case.com Using Cron to Run Background Jobs
By default, Nextcloud uses AJAX to execute 1 task with each page load. You can use the more efficient arrangement cron service to run background jobs. Go to Nextcloud Settings -> Basic Settings and select Cron.
Next, edit the www-information user's crontab file.
sudo -u www-data crontab -e
Add together the following line in this file, then the cron job will run every v minutes.
*/v * * * * php7.four -f /var/www/nextcloud/cron.php
Relieve and close the file.
Troubleshooting Tips
If you run across errors, you tin can check i of the following log files to discover out what's wrong.
- Apache error log:
/var/log/apache2/error.log - Apache error log for the Nextcloud virtual host:
/var/log/apache2/nextcloud.error - Nextcloud awarding log:
/var/www/nextcloud/data/nextcloud.log
For example, I once had an "Internal Server Mistake" on my Nextcloud instance and the /var/log/nginx/nextcloud.error file told me that
FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught OC\HintException: [0]: Memcache \OC\Memcache\Redis non bachelor for local cache (Is the matching PHP module installed and enabled?)
Information technology turned out that considering I used the ppa:ondrej/php PPA on my Ubuntu server, I likewise need to install php7.4-redis in add-on to the php-redis package.
If you meet the following error message in the nextcloud.log file, you can ignore it.
Could not detect any host in https:///data/htaccesstest.txt
Upgrading Nextcloud
It's important to keep your Nextcloud server up to date with the latest security and problems fixes. Read the tutorial below to learn how to upgrade Nextcloud.
- 2 Ways to Upgrade Nextcloud [Command-Line & GUI]
Wrapping Upward
I promise this tutorial helped you install NextCloud on Ubuntu xx.04 server with Apache. Every bit always, if you constitute this mail service useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂
Source: https://www.linuxbabe.com/ubuntu/install-nextcloud-ubuntu-20-04-apache-lamp-stack
0 Response to "How Do I Speed Up Uploading Files to Esxi"
Post a Comment