Install on Ubuntu 2204 2210 » History » Version 55
Gareth Eaton, 12/23/2023 01:16 PM
1 | 1 | Gareth Eaton | h1. Install on Ubuntu 2204 |
---|---|---|---|
2 | |||
3 | 43 | Gareth Eaton | <pre> |
4 | 26 | Gareth Eaton | h1. Install on Ubuntu 20.04 / 22.10 |
5 | 43 | Gareth Eaton | </pre> |
6 | 1 | Gareth Eaton | h2. Requirements |
7 | |||
8 | 26 | Gareth Eaton | * A server running Ubuntu 20.04. |
9 | 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 |
10 | 1 | Gareth Eaton | * A root password is configured on your server. |
11 | 43 | Gareth Eaton | |
12 | * install software-properties-common |
||
13 | |||
14 | <pre> |
||
15 | sudo apt update |
||
16 | sudo apt install software-properties-common |
||
17 | </pre> |
||
18 | |||
19 | After successfully installing software-properties-common, you can add the PHP PPA as follows: |
||
20 | |||
21 | <pre> |
||
22 | 49 | Gareth Eaton | sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php |
23 | sudo apt-get update |
||
24 | 43 | Gareth Eaton | </pre> |
25 | |||
26 | 1 | Gareth Eaton | |
27 | Before starting, LAMP stack must be installed on your server. If not installed, you can install it with the following command: |
||
28 | 13 | Gareth Eaton | |
29 | 28 | Gareth Eaton | NOTE: If you are installing Nextcloud 26 + on Ubuntu 20.04, you will need php8, this so use this LAMP stack |
30 | 13 | Gareth Eaton | <pre> |
31 | 42 | Gareth Eaton | sudo apt install apache2 mariadb-server php8.1 php8.1-cli php8.1-fpm php8.1-intl php8.1-imagick php8.1-pdo php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml php8.1-bcmath libapache2-mod-php8.1 -y |
32 | |||
33 | 52 | Gareth Eaton | |
34 | 13 | Gareth Eaton | </pre> |
35 | |||
36 | 53 | Gareth Eaton | NOTE: to use 8.3 php install the following... |
37 | 51 | Gareth Eaton | |
38 | 1 | Gareth Eaton | <pre> |
39 | 52 | Gareth Eaton | sudo apt install apache2 mariadb-server php8.3 php8.3-cli php8.3-fpm php8.3-intl php8.3-imagick php8.3-pdo php8.3-mysql php8.3-zip php8.3-gd php8.3-mbstring php8.3-curl php8.3-xml php8.3-bcmath libapache2-mod-php8.3 -y |
40 | |||
41 | sudo apt-get install librsvg2-bin |
||
42 | 1 | Gareth Eaton | sudo apt-get install --reinstall php-imagick |
43 | 53 | Gareth Eaton | </pre> |
44 | 1 | Gareth Eaton | |
45 | 53 | Gareth Eaton | if you have installed 8.1 you can remove it using this... |
46 | 1 | Gareth Eaton | |
47 | 53 | Gareth Eaton | <pre> |
48 | sudo apt-get remove libapache2-mod-php8.1 php8.1 php8.1-bcmath php8.1-cli php8.1-common php8.1-curl php8.1-fpm php8.1-gd php8.1-gmp php8.1-imagick php8.1-intl php8.1-mbstring php8.1-mysql php8.1-opcache php8.1-readline php8.1-xml php8.1-zip |
||
49 | |||
50 | sudo apt-get autoremove |
||
51 | sudo systemctl restart apache2 |
||
52 | 51 | Gareth Eaton | </pre> |
53 | |||
54 | 1 | Gareth Eaton | After installing all packages, edit the PHP configuration file and change some default settings: |
55 | |||
56 | 14 | Gareth Eaton | Use php -v to check which php is installed, and change the #.# with the right numbers |
57 | 46 | Gareth Eaton | in my case it say, *PHP 8.1* |
58 | 13 | Gareth Eaton | |
59 | 1 | Gareth Eaton | <pre> |
60 | 54 | Gareth Eaton | nano /etc/php/8.1/apache2/php.ini |
61 | 1 | Gareth Eaton | </pre> |
62 | |||
63 | Change the following lines: |
||
64 | |||
65 | <pre> |
||
66 | 14 | Gareth Eaton | date.timezone = UTC or what ever time zone you are in |
67 | 1 | Gareth Eaton | memory_limit = 512M |
68 | upload_max_filesize = 500M |
||
69 | post_max_size = 500M |
||
70 | max_execution_time = 300 |
||
71 | 55 | Gareth Eaton | opcache.interned_strings_buffer=16 |
72 | 1 | Gareth Eaton | </pre> |
73 | |||
74 | 29 | Gareth Eaton | |
75 | 40 | Gareth Eaton | Note: https://www.php.net/manual/en/timezones.php |
76 | |||
77 | 1 | Gareth Eaton | Save and close the file then restart the Apache service to apply the changes: |
78 | |||
79 | <pre> |
||
80 | systemctl restart apache2 |
||
81 | </pre> |
||
82 | |||
83 | |
||
84 | |||
85 | h2. Create a Database for Nextcloud |
||
86 | |||
87 | |||
88 | --- |
||
89 | |||
90 | Nextcloud uses a MariaDB database as a database backend so you will need to create a database and user in MariaDB. |
||
91 | |||
92 | First, connect to the MariaDB shell with the following command: |
||
93 | |||
94 | <pre> |
||
95 | mysql |
||
96 | </pre> |
||
97 | |||
98 | Once you are connected to the MariaDB, create a database and user with the following command: |
||
99 | |||
100 | 20 | Gareth Eaton | *NOTE: Change the 'password' to the password you would like to use.* |
101 | |||
102 | 1 | Gareth Eaton | <pre> |
103 | CREATE DATABASE nextcloud; |
||
104 | CREATE USER 'nextcloud'@'localhost' identified by 'password'; |
||
105 | </pre> |
||
106 | |||
107 | Next, grant all the privileges to the Nextcloud database with the following command: |
||
108 | |||
109 | <pre> |
||
110 | GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost'; |
||
111 | </pre> |
||
112 | Next, flush the privileges and exit from the MariaDB with the following command: |
||
113 | <pre> |
||
114 | FLUSH PRIVILEGES; |
||
115 | QUIT; |
||
116 | </pre> |
||
117 | |||
118 | |
||
119 | |||
120 | h2. Download Nextcloud |
||
121 | |||
122 | --- |
||
123 | |||
124 | 50 | Gareth Eaton | At the time of of updateing this article, the latest version of Nextcloud is -26.0.2.- It is now nextcloud-28.0.0.zip - You can download it with the following command: |
125 | 15 | Gareth Eaton | *NOTE: you can go to https://download.nextcloud.com/server/releases/ to check which is the latest version* |
126 | 1 | Gareth Eaton | |
127 | <pre> |
||
128 | 50 | Gareth Eaton | wget https://download.nextcloud.com/server/releases/nextcloud-28.0.0.zip |
129 | 1 | Gareth Eaton | </pre> |
130 | |||
131 | Once the download is completed, unzip the downloaded file with the following command: |
||
132 | |||
133 | 47 | Gareth Eaton | |
134 | |||
135 | 1 | Gareth Eaton | <pre> |
136 | 48 | Gareth Eaton | apt install unzip |
137 | 50 | Gareth Eaton | unzip nextcloud-28.0.0.zip |
138 | 1 | Gareth Eaton | </pre> |
139 | |||
140 | |||
141 | Next, move the extracted directory to the Apache web root with the following command: |
||
142 | |||
143 | <pre> |
||
144 | mv nextcloud /var/www/html/ |
||
145 | </pre> |
||
146 | |||
147 | Next, change the ownership and permission of the Nextcloud directory using the following command: |
||
148 | |||
149 | <pre> |
||
150 | chown -R www-data:www-data /var/www/html/nextcloud |
||
151 | chmod -R 775 /var/www/html/nextcloud |
||
152 | </pre> |
||
153 | |||
154 | |
||
155 | |||
156 | h2. Create an Apache Virtual Host for Nextcloud |
||
157 | |||
158 | --- |
||
159 | |||
160 | Next, you will need to create an Apache virtual host configuration file for Nextcloud. You can create it with the following command: |
||
161 | <pre> |
||
162 | nano /etc/apache2/sites-available/next.conf |
||
163 | </pre> |
||
164 | |||
165 | Add the following lines: |
||
166 | |||
167 | 17 | Gareth Eaton | *NOTE: Change the admin@example.com and next.example.com, to the right one for you* |
168 | 16 | Gareth Eaton | |
169 | 1 | Gareth Eaton | <pre> |
170 | <VirtualHost *:80> |
||
171 | ServerAdmin admin@example.com |
||
172 | DocumentRoot /var/www/html/nextcloud |
||
173 | ServerName next.example.com |
||
174 | ErrorLog /var/log/apache2/nextcloud-error.log |
||
175 | CustomLog /var/log/apache2/nextcloud-access.log combined |
||
176 | |||
177 | <Directory /var/www/html/nextcloud> |
||
178 | Options +FollowSymlinks |
||
179 | AllowOverride All |
||
180 | Require all granted |
||
181 | SetEnv HOME /var/www/html/nextcloud |
||
182 | SetEnv HTTP_HOME /var/www/html/nextcloud |
||
183 | <IfModule mod_dav.c> |
||
184 | Dav off |
||
185 | </IfModule> |
||
186 | </Directory> |
||
187 | </VirtualHost> |
||
188 | </pre> |
||
189 | |||
190 | Save and close the file then activate the Apache virtual host and other required Apache modules with the following command: |
||
191 | |||
192 | <pre> |
||
193 | a2ensite next |
||
194 | a2enmod rewrite dir mime env headers |
||
195 | </pre> |
||
196 | |||
197 | Next, restart the Apache service to apply the changes: |
||
198 | |||
199 | <pre> |
||
200 | systemctl restart apache2 |
||
201 | </pre> |
||
202 | |||
203 | 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. |
204 | |||
205 | <pre> |
||
206 | sudo a2dissite 000-default.conf |
||
207 | service apache2 reload |
||
208 | </pre> |
||
209 | |||
210 | 1 | Gareth Eaton | |
211 | 3 | Gareth Eaton | |
212 | 33 | Gareth Eaton | |
213 | 19 | Gareth Eaton | Now in a web-browser go to your nextcloud address(http://next.example.com) and finish the install, |
214 | 1 | Gareth Eaton | |
215 | 19 | Gareth Eaton | Set up an admin user account, and for the database it should be, |
216 | |||
217 | 18 | Gareth Eaton | <pre> |
218 | Database user: nextcloud |
||
219 | Database password: what ever you used |
||
220 | Database name: nextcloud |
||
221 | Database hose:localhost |
||
222 | </pre> |
||
223 | 22 | Gareth Eaton | |
224 | 18 | Gareth Eaton | --- |
225 | 3 | Gareth Eaton | |
226 | 35 | Gareth Eaton | [["Adding default phone region to Nextcloud config file for validating phone numbers in profile settings."]] |
227 | |||
228 | --- |
||
229 | |||
230 | 23 | Gareth Eaton | The install should now be complete. |
231 | |||
232 | 21 | Gareth Eaton | --- |
233 | 37 | Gareth Eaton | |
234 | 36 | Gareth Eaton | [["Configure a Memcache for Better Performance in Nextcloud"]] |
235 | 1 | Gareth Eaton | |
236 | 36 | Gareth Eaton | --- |
237 | 38 | Gareth Eaton | |
238 | 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. |
239 | 1 | Gareth Eaton | |
240 | 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. |
241 | 23 | Gareth Eaton | |
242 | 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. |
243 | 21 | Gareth Eaton | |
244 | --- |
||
245 | |||
246 | 3 | Gareth Eaton | h3. [[Installing SSL with Let's Encrypt SSL]] |
247 | 4 | Gareth Eaton | [[Installing on with a Nginx with a reverse proxy using a Nginx Proxy Manager]] |