Install on Ubuntu 2204 2210 » History » Version 32
Gareth Eaton, 06/06/2023 11:31 AM
1 | 1 | Gareth Eaton | h1. Install on Ubuntu 2204 |
---|---|---|---|
2 | |||
3 | 26 | Gareth Eaton | h1. Install on Ubuntu 20.04 / 22.10 |
4 | 1 | Gareth Eaton | h2. Requirements |
5 | |||
6 | 26 | Gareth Eaton | * A server running Ubuntu 20.04. |
7 | 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 |
8 | 1 | Gareth Eaton | * A root password is configured on your server. |
9 | |||
10 | Before starting, LAMP stack must be installed on your server. If not installed, you can install it with the following command: |
||
11 | 13 | Gareth Eaton | |
12 | 28 | Gareth Eaton | *NOTE: We have two LAMP stack, depending on which Nextcloud & Ubuntu you are going to install |
13 | This 1st one will work on Nexcloud 26+ & Ubuntu 22.10* |
||
14 | 13 | Gareth Eaton | |
15 | 1 | Gareth Eaton | <pre> |
16 | 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 |
||
17 | </pre> |
||
18 | 10 | Gareth Eaton | |
19 | 28 | Gareth Eaton | NOTE: If you are installing Nextcloud 26 + on Ubuntu 20.04, you will need php8, this so use this LAMP stack |
20 | 13 | Gareth Eaton | <pre> |
21 | 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 |
||
22 | </pre> |
||
23 | |||
24 | 1 | Gareth Eaton | After installing all packages, edit the PHP configuration file and change some default settings: |
25 | |||
26 | 14 | Gareth Eaton | Use php -v to check which php is installed, and change the #.# with the right numbers |
27 | in my case it say, *PHP 8.0.28*, so I would use 8.0 |
||
28 | 13 | Gareth Eaton | |
29 | 1 | Gareth Eaton | <pre> |
30 | 13 | Gareth Eaton | nano /etc/php/#.#/apache2/php.ini |
31 | 1 | Gareth Eaton | </pre> |
32 | |||
33 | Change the following lines: |
||
34 | |||
35 | <pre> |
||
36 | 14 | Gareth Eaton | date.timezone = UTC or what ever time zone you are in |
37 | 1 | Gareth Eaton | memory_limit = 512M |
38 | upload_max_filesize = 500M |
||
39 | post_max_size = 500M |
||
40 | max_execution_time = 300 |
||
41 | </pre> |
||
42 | |||
43 | 32 | Gareth Eaton | *NOTE: You might want to see [["Fixing PHP OPcache Configuration Issue in Nextcloud"]], and [["Enabling Required PHP Modules "gmp" and "bcmath" for WebAuthn Passwordless Authentication."]], make thous changes as well.* |
44 | 31 | Gareth Eaton | |
45 | 29 | Gareth Eaton | |
46 | 1 | Gareth Eaton | Save and close the file then restart the Apache service to apply the changes: |
47 | |||
48 | <pre> |
||
49 | systemctl restart apache2 |
||
50 | </pre> |
||
51 | |||
52 | |
||
53 | |||
54 | h2. Create a Database for Nextcloud |
||
55 | |||
56 | |||
57 | --- |
||
58 | |||
59 | Nextcloud uses a MariaDB database as a database backend so you will need to create a database and user in MariaDB. |
||
60 | |||
61 | First, connect to the MariaDB shell with the following command: |
||
62 | |||
63 | <pre> |
||
64 | mysql |
||
65 | </pre> |
||
66 | |||
67 | Once you are connected to the MariaDB, create a database and user with the following command: |
||
68 | |||
69 | 20 | Gareth Eaton | *NOTE: Change the 'password' to the password you would like to use.* |
70 | |||
71 | 1 | Gareth Eaton | <pre> |
72 | CREATE DATABASE nextcloud; |
||
73 | CREATE USER 'nextcloud'@'localhost' identified by 'password'; |
||
74 | </pre> |
||
75 | |||
76 | Next, grant all the privileges to the Nextcloud database with the following command: |
||
77 | |||
78 | <pre> |
||
79 | GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost'; |
||
80 | </pre> |
||
81 | Next, flush the privileges and exit from the MariaDB with the following command: |
||
82 | <pre> |
||
83 | FLUSH PRIVILEGES; |
||
84 | QUIT; |
||
85 | </pre> |
||
86 | |||
87 | |
||
88 | |||
89 | h2. Download Nextcloud |
||
90 | |||
91 | --- |
||
92 | |||
93 | 15 | Gareth Eaton | 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: |
94 | *NOTE: you can go to https://download.nextcloud.com/server/releases/ to check which is the latest version* |
||
95 | 1 | Gareth Eaton | |
96 | <pre> |
||
97 | 12 | Gareth Eaton | wget https://download.nextcloud.com/server/releases/nextcloud-26.0.2.zip |
98 | 1 | Gareth Eaton | </pre> |
99 | |||
100 | Once the download is completed, unzip the downloaded file with the following command: |
||
101 | |||
102 | <pre> |
||
103 | 11 | Gareth Eaton | unzip nextcloud-26.0.2.zip |
104 | 1 | Gareth Eaton | </pre> |
105 | |||
106 | |||
107 | Next, move the extracted directory to the Apache web root with the following command: |
||
108 | |||
109 | <pre> |
||
110 | mv nextcloud /var/www/html/ |
||
111 | </pre> |
||
112 | |||
113 | Next, change the ownership and permission of the Nextcloud directory using the following command: |
||
114 | |||
115 | <pre> |
||
116 | chown -R www-data:www-data /var/www/html/nextcloud |
||
117 | chmod -R 775 /var/www/html/nextcloud |
||
118 | </pre> |
||
119 | |||
120 | |
||
121 | |||
122 | h2. Create an Apache Virtual Host for Nextcloud |
||
123 | |||
124 | --- |
||
125 | |||
126 | Next, you will need to create an Apache virtual host configuration file for Nextcloud. You can create it with the following command: |
||
127 | <pre> |
||
128 | nano /etc/apache2/sites-available/next.conf |
||
129 | </pre> |
||
130 | |||
131 | Add the following lines: |
||
132 | |||
133 | 17 | Gareth Eaton | *NOTE: Change the admin@example.com and next.example.com, to the right one for you* |
134 | 16 | Gareth Eaton | |
135 | 1 | Gareth Eaton | <pre> |
136 | <VirtualHost *:80> |
||
137 | ServerAdmin admin@example.com |
||
138 | DocumentRoot /var/www/html/nextcloud |
||
139 | ServerName next.example.com |
||
140 | ErrorLog /var/log/apache2/nextcloud-error.log |
||
141 | CustomLog /var/log/apache2/nextcloud-access.log combined |
||
142 | |||
143 | <Directory /var/www/html/nextcloud> |
||
144 | Options +FollowSymlinks |
||
145 | AllowOverride All |
||
146 | Require all granted |
||
147 | SetEnv HOME /var/www/html/nextcloud |
||
148 | SetEnv HTTP_HOME /var/www/html/nextcloud |
||
149 | <IfModule mod_dav.c> |
||
150 | Dav off |
||
151 | </IfModule> |
||
152 | </Directory> |
||
153 | </VirtualHost> |
||
154 | </pre> |
||
155 | |||
156 | Save and close the file then activate the Apache virtual host and other required Apache modules with the following command: |
||
157 | |||
158 | <pre> |
||
159 | a2ensite next |
||
160 | a2enmod rewrite dir mime env headers |
||
161 | </pre> |
||
162 | |||
163 | Next, restart the Apache service to apply the changes: |
||
164 | |||
165 | <pre> |
||
166 | systemctl restart apache2 |
||
167 | </pre> |
||
168 | |||
169 | 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. |
170 | |||
171 | <pre> |
||
172 | sudo a2dissite 000-default.conf |
||
173 | service apache2 reload |
||
174 | </pre> |
||
175 | |||
176 | 1 | Gareth Eaton | |
177 | 3 | Gareth Eaton | |
178 | --- |
||
179 | 22 | Gareth Eaton | |
180 | 19 | Gareth Eaton | Now in a web-browser go to your nextcloud address(http://next.example.com) and finish the install, |
181 | 1 | Gareth Eaton | |
182 | 19 | Gareth Eaton | Set up an admin user account, and for the database it should be, |
183 | |||
184 | 18 | Gareth Eaton | <pre> |
185 | Database user: nextcloud |
||
186 | Database password: what ever you used |
||
187 | Database name: nextcloud |
||
188 | Database hose:localhost |
||
189 | </pre> |
||
190 | 22 | Gareth Eaton | |
191 | 18 | Gareth Eaton | --- |
192 | 3 | Gareth Eaton | |
193 | 23 | Gareth Eaton | The install should now be complete. |
194 | |||
195 | 21 | Gareth Eaton | --- |
196 | 1 | Gareth Eaton | |
197 | 24 | Gareth Eaton | Depending on how you setup your network and server you might have to install a SSL more information on how to do that below. |
198 | 1 | Gareth Eaton | |
199 | 24 | Gareth Eaton | You should also go to "Administration Settings" and in the Overview tab, see the Security & setup warning, see https://lightningcr.com/projects/nextcloud/wiki to help you with each warning you get. |
200 | 23 | Gareth Eaton | |
201 | 24 | Gareth Eaton | also setup your Email Server, this is found in Basic setting, again see https://lightningcr.com/projects/nextcloud/wiki to help you with this. |
202 | 21 | Gareth Eaton | |
203 | --- |
||
204 | |||
205 | 3 | Gareth Eaton | h3. [[Installing SSL with Let's Encrypt SSL]] |
206 | 4 | Gareth Eaton | [[Installing on with a Nginx with a reverse proxy using a Nginx Proxy Manager]] |