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