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