I didn't find any installation script

Hi guys, thanks for accepting me into the community.

I’m new here.

Do you have any installation script for Nexcloud?

I saw several, but almost all outdated.


Check out the installation steps in the Adminstrator Guide to get an idea which installation options are available.


I use this script if you are interested


# Update the system
sudo apt update
sudo apt upgrade -y

# Install apache
sudo apt install apache2 apache2-utils -y

# Install MariaDB
sudo apt install mariadb-server mariadb-client -y

# Install PHP 8.2 and required extensions
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install imagemagick php8.2 php8.2-{cli,curl,gd,mbstring,xml,zip,bz2,intl,bcmath,gmp,imagick,mysql} -y

# Install PHP-FPM
sudo apt install php8.2-fpm -y

# Install Redis
sudo apt install redis-server php-redis -y

# Configure MariaDB
sudo mysql_secure_installation

# Create the database for Nextcloud
sudo mysql -u root -p -e "CREATE DATABASE nextcloud;"
sudo mysql -u root -p -e "CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'password';"
sudo mysql -u root -p -e "GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';"
sudo mysql -u root -p -e "FLUSH PRIVILEGES;"

# Download and install Nextcloud
wget https://download.nextcloud.com/server/releases/nextcloud-27.0.0.tar.bz2
tar -xvf nextcloud-27.0.0.tar.bz2
sudo mv nextcloud /var/www/
sudo chown -R www-data:www-data /var/www/nextcloud
sudo chmod -R 755 /var/www/nextcloud

# Configure PHP-FPM
sudo sed -i 's/memory_limit = .*/memory_limit = 512M/' /etc/php/8.2/fpm/php.ini
sudo sed -i 's/upload_max_filesize = .*/upload_max_filesize = 10240M/' /etc/php/8.2/fpm/php.ini
sudo sed -i 's/post_max_size = .*/post_max_size = 10240M/' /etc/php/8.2/fpm/php.ini
sudo sed -i 's/;date.timezone.*/date.timezone = America\/\Sao_Paulo/'
sudo a2dismod php8.2
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.2-fpm
sudo systemctl restart php8.2-fpm
sudo systemctl restart apache2

# Configure Redis for Nextcloud
#sudo sed -i 's/;session.save_path = .*/session.save_path = "tcp:\/\/localhost:6379?auth=redis_password"/' /etc/php/8.2/fpm/php.ini
#sudo systemctl restart php8.2-fpm
sudo phpenmod redis
sudo systemctl reload apache2

# Create VirtualHost for Nextcloud
sudo cat <<EOF >>/etc/apache2/sites-available/nextcloud.conf
<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot "/var/www/nextcloud"
    ServerName nextcloud
  <Directory "/var/www/nextcloud/">
    Options MultiViews FollowSymlinks
    AllowOverride All
    Order allow, deny
    allow from all
    TransferLog /var/log/apache2/nextcloud_access.log
    ErrorLog /var/log/apache2/nextcloud_error.log

# Enable VirtualHost and restart Apache
sudo a2ensite nextcloud.conf
sudo a2enmod rewrite headers env dir mime setenvif ssl
sudo systemctl restart apache2

echo "Nextcloud installation complete. Access Nextcloud in your browser to continue the configuration."
1 Like

Thank you for sharing.
In your script, you could replace nextcloud-27.0.0.tar.bz2 (and in https://download.nextcloud.com/server/releases/nextcloud-27.0.0.tar.bz2) by latest.tar.bz2

1 Like