Install on Ubuntu 2204 2210 » History » Version 13
Gareth Eaton, 06/04/2023 12:41 PM
1 | 1 | Gareth Eaton | h1. Install on Ubuntu 2204 |
---|---|---|---|
2 | |||
3 | h2. Requirements |
||
4 | |||
5 | * A server running Ubuntu 22.04. |
||
6 | 7 | Gareth Eaton | * A valid domain name pointed to the server or Nginx Proxy Manager IP. See "A Record":https://lightningcr.com/projects/dns/wiki/A_record |
7 | 1 | Gareth Eaton | * A root password is configured on your server. |
8 | |||
9 | Before starting, LAMP stack must be installed on your server. If not installed, you can install it with the following command: |
||
10 | 13 | Gareth Eaton | |
11 | *NOTE: We have two LAMP stack, depending on wich Next cloud you are going to install* |
||
12 | |||
13 | 1 | Gareth Eaton | <pre> |
14 | 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 |
||
15 | </pre> |
||
16 | 10 | Gareth Eaton | |
17 | 13 | Gareth Eaton | NOTE: If you are installing next cloud 26 + you will need php8, this so use this LAMP stack |
18 | <pre> |
||
19 | 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 |
||
20 | </pre> |
||
21 | |||
22 | 1 | Gareth Eaton | After installing all packages, edit the PHP configuration file and change some default settings: |
23 | |||
24 | 13 | Gareth Eaton | use php -v to check which php is installed, and change the #.# with the right numbers |
25 | |||
26 | 1 | Gareth Eaton | <pre> |
27 | 13 | Gareth Eaton | nano /etc/php/#.#/apache2/php.ini |
28 | 1 | Gareth Eaton | </pre> |
29 | |||
30 | Change the following lines: |
||
31 | |||
32 | <pre> |
||
33 | date.timezone = UTC |
||
34 | memory_limit = 512M |
||
35 | upload_max_filesize = 500M |
||
36 | post_max_size = 500M |
||
37 | max_execution_time = 300 |
||
38 | </pre> |
||
39 | |||
40 | Save and close the file then restart the Apache service to apply the changes: |
||
41 | |||
42 | <pre> |
||
43 | systemctl restart apache2 |
||
44 | </pre> |
||
45 | |||
46 | |
||
47 | |||
48 | h2. Create a Database for Nextcloud |
||
49 | |||
50 | |||
51 | --- |
||
52 | |||
53 | Nextcloud uses a MariaDB database as a database backend so you will need to create a database and user in MariaDB. |
||
54 | |||
55 | First, connect to the MariaDB shell with the following command: |
||
56 | |||
57 | <pre> |
||
58 | mysql |
||
59 | </pre> |
||
60 | |||
61 | Once you are connected to the MariaDB, create a database and user with the following command: |
||
62 | |||
63 | <pre> |
||
64 | CREATE DATABASE nextcloud; |
||
65 | CREATE USER 'nextcloud'@'localhost' identified by 'password'; |
||
66 | </pre> |
||
67 | |||
68 | Next, grant all the privileges to the Nextcloud database with the following command: |
||
69 | |||
70 | <pre> |
||
71 | GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost'; |
||
72 | </pre> |
||
73 | Next, flush the privileges and exit from the MariaDB with the following command: |
||
74 | <pre> |
||
75 | FLUSH PRIVILEGES; |
||
76 | QUIT; |
||
77 | </pre> |
||
78 | |||
79 | |
||
80 | |||
81 | h2. Download Nextcloud |
||
82 | |||
83 | --- |
||
84 | |||
85 | 12 | Gareth Eaton | At the time of writing the article, the latest version of Nextcloud is 26.0.2. You can download it with the following command: |
86 | 1 | Gareth Eaton | |
87 | <pre> |
||
88 | 12 | Gareth Eaton | wget https://download.nextcloud.com/server/releases/nextcloud-26.0.2.zip |
89 | 1 | Gareth Eaton | </pre> |
90 | |||
91 | Once the download is completed, unzip the downloaded file with the following command: |
||
92 | |||
93 | <pre> |
||
94 | 11 | Gareth Eaton | unzip nextcloud-26.0.2.zip |
95 | 1 | Gareth Eaton | </pre> |
96 | |||
97 | |||
98 | Next, move the extracted directory to the Apache web root with the following command: |
||
99 | |||
100 | <pre> |
||
101 | mv nextcloud /var/www/html/ |
||
102 | </pre> |
||
103 | |||
104 | Next, change the ownership and permission of the Nextcloud directory using the following command: |
||
105 | |||
106 | <pre> |
||
107 | chown -R www-data:www-data /var/www/html/nextcloud |
||
108 | chmod -R 775 /var/www/html/nextcloud |
||
109 | </pre> |
||
110 | |||
111 | |
||
112 | |||
113 | h2. Create an Apache Virtual Host for Nextcloud |
||
114 | |||
115 | --- |
||
116 | |||
117 | Next, you will need to create an Apache virtual host configuration file for Nextcloud. You can create it with the following command: |
||
118 | <pre> |
||
119 | nano /etc/apache2/sites-available/next.conf |
||
120 | </pre> |
||
121 | |||
122 | Add the following lines: |
||
123 | |||
124 | <pre> |
||
125 | <VirtualHost *:80> |
||
126 | ServerAdmin admin@example.com |
||
127 | DocumentRoot /var/www/html/nextcloud |
||
128 | ServerName next.example.com |
||
129 | ErrorLog /var/log/apache2/nextcloud-error.log |
||
130 | CustomLog /var/log/apache2/nextcloud-access.log combined |
||
131 | |||
132 | <Directory /var/www/html/nextcloud> |
||
133 | Options +FollowSymlinks |
||
134 | AllowOverride All |
||
135 | Require all granted |
||
136 | SetEnv HOME /var/www/html/nextcloud |
||
137 | SetEnv HTTP_HOME /var/www/html/nextcloud |
||
138 | <IfModule mod_dav.c> |
||
139 | Dav off |
||
140 | </IfModule> |
||
141 | </Directory> |
||
142 | </VirtualHost> |
||
143 | </pre> |
||
144 | |||
145 | Save and close the file then activate the Apache virtual host and other required Apache modules with the following command: |
||
146 | |||
147 | <pre> |
||
148 | a2ensite next |
||
149 | a2enmod rewrite dir mime env headers |
||
150 | </pre> |
||
151 | |||
152 | Next, restart the Apache service to apply the changes: |
||
153 | |||
154 | <pre> |
||
155 | systemctl restart apache2 |
||
156 | </pre> |
||
157 | |||
158 | 5 | Gareth Eaton | 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. |
159 | |||
160 | <pre> |
||
161 | sudo a2dissite 000-default.conf |
||
162 | service apache2 reload |
||
163 | </pre> |
||
164 | |||
165 | 1 | Gareth Eaton | |
166 | 3 | Gareth Eaton | |
167 | --- |
||
168 | |||
169 | h3. [[Installing SSL with Let's Encrypt SSL]] |
||
170 | 4 | Gareth Eaton | [[Installing on with a Nginx with a reverse proxy using a Nginx Proxy Manager]] |