Install Nextcloud in Ubuntu

Nextcloud – cloud platform for storing files, a branch of the project OwnCloud.

On the test, I will install the latest version of Nextcloud in Ubuntu Server 16.04 LTS (at the time of this writing was 12).
First of all, we will install the necessary components:

sudo apt-get update
sudo apt-get install apache2 mysql-server php libapache2-mod-php php-json php-mcrypt php-mysql php-bz2 php-curl php-gd php-imagick php-intl php-mbstring php-xml php-zip php-memcache

Activate the necessary apache2 modules:

sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime
sudo a2enmod setenvif
sudo a2enmod ssl

And restart it to apply the changes:

sudo service apache2 restart

Download Nextcloud:

cd ~
wget --no-check-certificate https://download.nextcloud.com/server/releases/latest.tar.bz2

You can verify the checksums MD5 or SHA256 to make sure that the archive is not damaged:

wget --no-check-certificate https://download.nextcloud.com/server/releases/latest.tar.bz2.md5
wget --no-check-certificate https://download.nextcloud.com/server/releases/latest.tar.bz2.sha256
md5sum -c latest.tar.bz2.md5 < latest.tar.bz2
sha256sum -c latest.tar.bz2.sha256 < latest.tar.bz2

Unzip the archive into the web server directory, set permissions and delete it:

sudo tar -C /var/www -xvjf ~/latest.tar.bz2
sudo chown -R www-data:www-data /var/www/nextcloud/
rm ~/latest.tar.bz2
rm ~/latest.tar.bz2.md5
rm ~/latest.tar.bz2.sha256

Create a web configuration file (in the nano editor, press Ctrl+X to exit, y/n to save or cancel changes):

sudo nano /etc/apache2/sites-available/nextcloud.conf

And add to it:

Alias /nextcloud "/var/www/nextcloud/"
<Directory /var/www/nextcloud/>
  Options +FollowSymlinks
  AllowOverride All

 <IfModule mod_dav.c>
  Dav off
 </IfModule>

 SetEnv HOME /var/www/nextcloud
 SetEnv HTTP_HOME /var/www/nextcloud
</Directory>

We activate the configuration as follows:

sudo a2ensite nextcloud

or so:

sudo ln -s /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-enabled/nextcloud.conf

Restart apache2:

sudo service apache2 restart

Create mysql user and database:

mysqladmin -u root -p create nextcloud
mysql -u root -p -e "GRANT ALL PRIVILEGES ON nextcloud.* TO nextcloud@localhost IDENTIFIED BY 'PASSWORD';"
mysql -u root -p -e "flush privileges;"

Open in browser http://HOST/nextcloud/ specify the data and click “Finish installation”.
Standard directory for storing user files /var/www/nextcloud/data.

In the PHP configuration /etc/php5/apache2/php.ini specify date.timezone, other parameters are already specified in the file /var/www/nextcloud/.htaccess
Also, for secure transmission of data, I recommend that you configure SSL.
In the settings nextcloud, in the “Administration” menu you can see additional recommendations for customization.

Nextcloud installation completed.

See my articles:
Installing Certbot in Ubuntu
Solution “Internal Server Error” when opening Nextcloud

Подписаться на IT Blog (RU) по Email
Subscribe to IT Blog (EN) by Email

Did my article help you? How about buying me a cup of coffee as an encouragement? Buy me a coffe.

Leave a Reply