0xbaha / env-setup

This repository contains a script that can be used to set up an environment for web development and mail server.
https://gh.baha.my.id/env-setup
1 stars 0 forks source link

Install Nextcloud on Ubuntu 20.04 #27

Open 0xbaha opened 3 years ago

0xbaha commented 3 years ago
sudo apt update
sudo apt install apache2 mariadb-server libapache2-mod-php7.4 -y
sudo apt install php7.4-gd php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl -y
sudo apt install php7.4-gmp php7.4-bcmath php-imagick php7.4-xml php7.4-zip -y
sudo /etc/init.d/mysql start
sudo mysql -uroot -p
CREATE USER 'dev'@'localhost' IDENTIFIED BY 'dev';
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'dev'@'localhost';
FLUSH PRIVILEGES;
quit;
# Verify the SHA256 sum
wget https://download.nextcloud.com/server/releases/nextcloud-22.2.0.zip
wget https://download.nextcloud.com/server/releases/nextcloud-22.2.0.zip.sha256
sha256sum -c nextcloud-22.2.0.zip.sha256 < nextcloud-22.2.0.zip

# Verify the PGP signature
wget https://download.nextcloud.com/server/releases/nextcloud-22.2.0.zip.asc
wget https://nextcloud.com/nextcloud.asc
gpg --import nextcloud.asc
gpg --verify nextcloud-22.2.0.zip.asc nextcloud-22.2.0.zip

# Extract
sudo apt install unzip
unzip nextcloud-22.2.0.zip

# Copy to its final destination
sudo cp -r nextcloud /var/www

# Clean
rm -rf nextcloud*

Open file /etc/apache2/sites-available/nextcloud.conf

sudo vi /etc/apache2/sites-available/nextcloud.conf
Alias / "/var/www/nextcloud/"

<Directory /var/www/nextcloud/>
  Require all granted
  AllowOverride All
  Options FollowSymLinks MultiViews

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

<VirtualHost *:80>
  DocumentRoot /var/www/nextcloud/
  ServerName  YOUR.SERVER.COM

  <Directory /var/www/nextcloud/>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews

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

Continue with

sudo a2ensite nextcloud.conf

Additional

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

Restart Apache

sudo service apache2 restart
# change the ownership on your Nextcloud directories to your HTTP user
sudo chown -R www-data:www-data /var/www/nextcloud/
0xbaha commented 2 years ago

https://docs.nextcloud.com/server/latest/admin_manual/installation/source_installation.html#installation-via-install-script