Install on Ubuntu 2204 2210 » History » Version 44
Gareth Eaton, 10/15/2023 11:35 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 | 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 | in my case it say, *PHP 8.0.28*, so I would use 8.0 |
||
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 | <pre> |
||
113 | 41 | Gareth Eaton | unzip nextcloud-27.0.2.zip |
114 | 1 | Gareth Eaton | </pre> |
115 | |||
116 | |||
117 | Next, move the extracted directory to the Apache web root with the following command: |
||
118 | |||
119 | <pre> |
||
120 | mv nextcloud /var/www/html/ |
||
121 | </pre> |
||
122 | |||
123 | Next, change the ownership and permission of the Nextcloud directory using the following command: |
||
124 | |||
125 | <pre> |
||
126 | chown -R www-data:www-data /var/www/html/nextcloud |
||
127 | chmod -R 775 /var/www/html/nextcloud |
||
128 | </pre> |
||
129 | |||
130 | |
||
131 | |||
132 | h2. Create an Apache Virtual Host for Nextcloud |
||
133 | |||
134 | --- |
||
135 | |||
136 | Next, you will need to create an Apache virtual host configuration file for Nextcloud. You can create it with the following command: |
||
137 | <pre> |
||
138 | nano /etc/apache2/sites-available/next.conf |
||
139 | </pre> |
||
140 | |||
141 | Add the following lines: |
||
142 | |||
143 | 17 | Gareth Eaton | *NOTE: Change the admin@example.com and next.example.com, to the right one for you* |
144 | 16 | Gareth Eaton | |
145 | 1 | Gareth Eaton | <pre> |
146 | <VirtualHost *:80> |
||
147 | ServerAdmin admin@example.com |
||
148 | DocumentRoot /var/www/html/nextcloud |
||
149 | ServerName next.example.com |
||
150 | ErrorLog /var/log/apache2/nextcloud-error.log |
||
151 | CustomLog /var/log/apache2/nextcloud-access.log combined |
||
152 | |||
153 | <Directory /var/www/html/nextcloud> |
||
154 | Options +FollowSymlinks |
||
155 | AllowOverride All |
||
156 | Require all granted |
||
157 | SetEnv HOME /var/www/html/nextcloud |
||
158 | SetEnv HTTP_HOME /var/www/html/nextcloud |
||
159 | <IfModule mod_dav.c> |
||
160 | Dav off |
||
161 | </IfModule> |
||
162 | </Directory> |
||
163 | </VirtualHost> |
||
164 | </pre> |
||
165 | |||
166 | Save and close the file then activate the Apache virtual host and other required Apache modules with the following command: |
||
167 | |||
168 | <pre> |
||
169 | a2ensite next |
||
170 | a2enmod rewrite dir mime env headers |
||
171 | </pre> |
||
172 | |||
173 | Next, restart the Apache service to apply the changes: |
||
174 | |||
175 | <pre> |
||
176 | systemctl restart apache2 |
||
177 | </pre> |
||
178 | |||
179 | 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. |
180 | |||
181 | <pre> |
||
182 | sudo a2dissite 000-default.conf |
||
183 | service apache2 reload |
||
184 | </pre> |
||
185 | |||
186 | 1 | Gareth Eaton | |
187 | 3 | Gareth Eaton | |
188 | 33 | Gareth Eaton | |
189 | 19 | Gareth Eaton | Now in a web-browser go to your nextcloud address(http://next.example.com) and finish the install, |
190 | 1 | Gareth Eaton | |
191 | 19 | Gareth Eaton | Set up an admin user account, and for the database it should be, |
192 | |||
193 | 18 | Gareth Eaton | <pre> |
194 | Database user: nextcloud |
||
195 | Database password: what ever you used |
||
196 | Database name: nextcloud |
||
197 | Database hose:localhost |
||
198 | </pre> |
||
199 | 22 | Gareth Eaton | |
200 | 18 | Gareth Eaton | --- |
201 | 3 | Gareth Eaton | |
202 | 35 | Gareth Eaton | [["Adding default phone region to Nextcloud config file for validating phone numbers in profile settings."]] |
203 | |||
204 | --- |
||
205 | |||
206 | 23 | Gareth Eaton | The install should now be complete. |
207 | |||
208 | 21 | Gareth Eaton | --- |
209 | 37 | Gareth Eaton | |
210 | 36 | Gareth Eaton | [["Configure a Memcache for Better Performance in Nextcloud"]] |
211 | 1 | Gareth Eaton | |
212 | 36 | Gareth Eaton | --- |
213 | 38 | Gareth Eaton | |
214 | 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. |
215 | 1 | Gareth Eaton | |
216 | 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. |
217 | 23 | Gareth Eaton | |
218 | 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. |
219 | 21 | Gareth Eaton | |
220 | --- |
||
221 | |||
222 | 3 | Gareth Eaton | h3. [[Installing SSL with Let's Encrypt SSL]] |
223 | 4 | Gareth Eaton | [[Installing on with a Nginx with a reverse proxy using a Nginx Proxy Manager]] |