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