|
#!/bin/bash |
|
|
|
|
|
sudo apt update |
|
sudo apt upgrade -y |
|
|
|
|
|
sudo apt install -y apache2 mariadb-server libapache2-mod-php7.4 php7.4-gd php7.4-json php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl php7.4-xml php7.4-zip php7.4-bz2 php7.4-common php7.4-cli php7.4-ldap php7.4-gmp |
|
|
|
|
|
sudo a2enmod rewrite |
|
sudo a2enmod headers |
|
sudo a2enmod env |
|
sudo a2enmod dir |
|
sudo a2enmod mime |
|
|
|
|
|
sudo mysql -u root -p <<EOF |
|
CREATE DATABASE nextcloud; |
|
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'your_password_here'; |
|
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost'; |
|
FLUSH PRIVILEGES; |
|
EXIT; |
|
EOF |
|
|
|
|
|
wget https://download.nextcloud.com/server/releases/latest.tar.bz2 |
|
tar -xjf latest.tar.bz2 |
|
sudo mv nextcloud /var/www/ |
|
sudo chown -R www-data:www-data /var/www/nextcloud |
|
|
|
|
|
sudo tee /etc/apache2/sites-available/nextcloud.conf <<EOF |
|
<VirtualHost *:80> |
|
ServerAdmin webmaster@localhost |
|
DocumentRoot /var/www/nextcloud |
|
ServerName your_domain_or_ip_here |
|
ErrorLog ${APACHE_LOG_DIR}/error.log |
|
CustomLog ${APACHE_LOG_DIR}/access.log combined |
|
<Directory /var/www/nextcloud/> |
|
Options +FollowSymlinks |
|
AllowOverride All |
|
Require all granted |
|
<IfModule mod_dav.c> |
|
Dav off |
|
</IfModule> |
|
SetEnv HOME /var/www/nextcloud |
|
SetEnv HTTP_HOME /var/www/nextcloud |
|
</Directory> |
|
</VirtualHost> |
|
EOF |
|
|
|
|
|
sudo a2ensite nextcloud.conf |
|
|
|
|
|
sudo systemctl restart apache2 |
|
|
|
|
|
sudo -u www-data php /var/www/nextcloud/cron.php |
|
|
|
|
|
rm latest.tar.bz2 |
|
|
|
echo "Nextcloud installation is complete. Access your Nextcloud instance by visiting http://your_domain_or_ip_here in your web browser." |
|
|