Project

General

Profile

Install on Ubuntu 2204 2210 » History » Revision 19

Revision 18 (Gareth Eaton, 06/04/2023 01:00 PM) → Revision 19/57 (Gareth Eaton, 06/04/2023 01:01 PM)

h1. Install on Ubuntu 2204 

 h2. Requirements 

 * A server running Ubuntu 22.04. 
 * A valid domain name pointed to the server or Nginx Proxy Manager IP.    See "A Record":https://lightningcr.com/projects/dns/wiki/A_record 
 * A root password is configured on your server. 

 Before starting, LAMP stack must be installed on your server. If not installed, you can install it with the following command: 

 *NOTE: We have two LAMP stack, depending on wich Next cloud you are going to install* 

 <pre> 
 apt install apache2 mariadb-server php php-cli php-fpm php-json php-intl php-imagick php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath apache2 libapache2-mod-php -y 
 </pre> 

 NOTE: If you are installing next cloud 26 + you will need php8, this so use this LAMP stack  
 <pre> 
 sudo apt install apache2 mariadb-server php8.0 php8.0-cli php8.0-fpm php8.0-intl php8.0-imagick php8.0-pdo php8.0-mysql php8.0-zip php8.0-gd php8.0-mbstring php8.0-curl php8.0-xml php8.0-bcmath libapache2-mod-php8.0 -y 
 </pre> 

 After installing all packages, edit the PHP configuration file and change some default settings: 

 Use php -v to check which php is installed, and change the #.# with the right numbers 
 in my case it say, *PHP 8.0.28*, so I would use 8.0 

 <pre> 
 nano /etc/php/#.#/apache2/php.ini 
 </pre> 

 Change the following lines: 

 <pre> 
 date.timezone = UTC or what ever time zone you are in 
 memory_limit = 512M 
 upload_max_filesize = 500M 
 post_max_size = 500M 
 max_execution_time = 300 
 </pre> 

 Save and close the file then restart the Apache service to apply the changes: 

 <pre> 
 systemctl restart apache2 
 </pre> 

 &nbsp; 

 h2. Create a Database for Nextcloud 


 --- 

 Nextcloud uses a MariaDB database as a database backend so you will need to create a database and user in MariaDB. 

 First, connect to the MariaDB shell with the following command: 

 <pre> 
 mysql 
 </pre> 

 Once you are connected to the MariaDB, create a database and user with the following command: 

 <pre> 
 CREATE DATABASE nextcloud; 
 CREATE USER 'nextcloud'@'localhost' identified by 'password'; 
 </pre> 

 Next, grant all the privileges to the Nextcloud database with the following command: 

 <pre> 
 GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost'; 
 </pre> 
 Next, flush the privileges and exit from the MariaDB with the following command: 
 <pre> 
 FLUSH PRIVILEGES; 
 QUIT; 
 </pre> 

 &nbsp; 

 h2. Download Nextcloud 

 --- 

 At the time of of updateing this article, the latest version of Nextcloud is 26.0.2. You can download it with the following command: 
 *NOTE: you can go to    https://download.nextcloud.com/server/releases/ to check which is the latest version* 

 <pre> 
 wget https://download.nextcloud.com/server/releases/nextcloud-26.0.2.zip 
 </pre> 

 Once the download is completed, unzip the downloaded file with the following command: 

 <pre> 
 unzip nextcloud-26.0.2.zip 
 </pre> 


 Next, move the extracted directory to the Apache web root with the following command: 

 <pre> 
 mv nextcloud /var/www/html/ 
 </pre> 

 Next, change the ownership and permission of the Nextcloud directory using the following command: 

 <pre> 
 chown -R www-data:www-data /var/www/html/nextcloud 
 chmod -R 775 /var/www/html/nextcloud 
 </pre> 

 &nbsp; 

 h2. Create an Apache Virtual Host for Nextcloud 

 --- 

 Next, you will need to create an Apache virtual host configuration file for Nextcloud. You can create it with the following command: 
 <pre> 
 nano /etc/apache2/sites-available/next.conf 
 </pre> 

 Add the following lines: 

 *NOTE: Change the [email protected] and next.example.com, to the right one for you* 

 <pre> 
 <VirtualHost *:80> 
      ServerAdmin [email protected] 
      DocumentRoot /var/www/html/nextcloud 
      ServerName next.example.com 
      ErrorLog /var/log/apache2/nextcloud-error.log 
      CustomLog /var/log/apache2/nextcloud-access.log combined 
 
     <Directory /var/www/html/nextcloud> 
	 Options +FollowSymlinks 
	 AllowOverride All 
         Require all granted 
 	 SetEnv HOME /var/www/html/nextcloud 
 	 SetEnv HTTP_HOME /var/www/html/nextcloud 
 	 <IfModule mod_dav.c> 
  	   Dav off 
         </IfModule> 
     </Directory> 
 </VirtualHost> 
 </pre> 

 Save and close the file then activate the Apache virtual host and other required Apache modules with the following command: 

 <pre> 
 a2ensite next 
 a2enmod rewrite dir mime env headers 
 </pre> 

 Next, restart the Apache service to apply the changes: 

 <pre> 
 systemctl restart apache2 
 </pre> 

 NOTE: we have had it where the default site configuration was overriding my vhost configuration, if this happens to you you can disable the default configuration. 

 <pre> 
 sudo a2dissite 000-default.conf 
 service apache2 reload 
 </pre> 

 &nbsp; 

 --- 
 Now in a web-browser go to your nextcloud address(http://next.example.com) and finish the install, to install   

 Set up an admin user account, user, and    for the database it should shoud be, 

 
 <pre> 
 Database user: nextcloud 
 Database password: what ever you used 
 Database name: nextcloud 
 Database hose:localhost 
 </pre> 
 --- 

 h3. [[Installing SSL with Let's Encrypt SSL]] 
 [[Installing on with a Nginx with a reverse proxy using a Nginx Proxy Manager]]