Install on Ubuntu 2204 2210 » History » Version 29
Gareth Eaton, 06/06/2023 11:19 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 | 29 | Gareth Eaton | *NOTE: You might want to see "Fixing PHP OPcache Configuration Issue in Nextcloud", and make thous changes as well.* |
44 | |||
45 | 1 | Gareth Eaton | Save and close the file then restart the Apache service to apply the changes: |
46 | |||
47 | <pre> |
||
48 | systemctl restart apache2 |
||
49 | </pre> |
||
50 | |||
51 | |
||
52 | |||
53 | h2. Create a Database for Nextcloud |
||
54 | |||
55 | |||
56 | --- |
||
57 | |||
58 | Nextcloud uses a MariaDB database as a database backend so you will need to create a database and user in MariaDB. |
||
59 | |||
60 | First, connect to the MariaDB shell with the following command: |
||
61 | |||
62 | <pre> |
||
63 | mysql |
||
64 | </pre> |
||
65 | |||
66 | Once you are connected to the MariaDB, create a database and user with the following command: |
||
67 | |||
68 | 20 | Gareth Eaton | *NOTE: Change the 'password' to the password you would like to use.* |
69 | |||
70 | 1 | Gareth Eaton | <pre> |
71 | CREATE DATABASE nextcloud; |
||
72 | CREATE USER 'nextcloud'@'localhost' identified by 'password'; |
||
73 | </pre> |
||
74 | |||
75 | Next, grant all the privileges to the Nextcloud database with the following command: |
||
76 | |||
77 | <pre> |
||
78 | GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost'; |
||
79 | </pre> |
||
80 | Next, flush the privileges and exit from the MariaDB with the following command: |
||
81 | <pre> |
||
82 | FLUSH PRIVILEGES; |
||
83 | QUIT; |
||
84 | </pre> |
||
85 | |||
86 | |
||
87 | |||
88 | h2. Download Nextcloud |
||
89 | |||
90 | --- |
||
91 | |||
92 | 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: |
93 | *NOTE: you can go to https://download.nextcloud.com/server/releases/ to check which is the latest version* |
||
94 | 1 | Gareth Eaton | |
95 | <pre> |
||
96 | 12 | Gareth Eaton | wget https://download.nextcloud.com/server/releases/nextcloud-26.0.2.zip |
97 | 1 | Gareth Eaton | </pre> |
98 | |||
99 | Once the download is completed, unzip the downloaded file with the following command: |
||
100 | |||
101 | <pre> |
||
102 | 11 | Gareth Eaton | unzip nextcloud-26.0.2.zip |
103 | 1 | Gareth Eaton | </pre> |
104 | |||
105 | |||
106 | Next, move the extracted directory to the Apache web root with the following command: |
||
107 | |||
108 | <pre> |
||
109 | mv nextcloud /var/www/html/ |
||
110 | </pre> |
||
111 | |||
112 | Next, change the ownership and permission of the Nextcloud directory using the following command: |
||
113 | |||
114 | <pre> |
||
115 | chown -R www-data:www-data /var/www/html/nextcloud |
||
116 | chmod -R 775 /var/www/html/nextcloud |
||
117 | </pre> |
||
118 | |||
119 | |
||
120 | |||
121 | h2. Create an Apache Virtual Host for Nextcloud |
||
122 | |||
123 | --- |
||
124 | |||
125 | Next, you will need to create an Apache virtual host configuration file for Nextcloud. You can create it with the following command: |
||
126 | <pre> |
||
127 | nano /etc/apache2/sites-available/next.conf |
||
128 | </pre> |
||
129 | |||
130 | Add the following lines: |
||
131 | |||
132 | 17 | Gareth Eaton | *NOTE: Change the admin@example.com and next.example.com, to the right one for you* |
133 | 16 | Gareth Eaton | |
134 | 1 | Gareth Eaton | <pre> |
135 | <VirtualHost *:80> |
||
136 | ServerAdmin admin@example.com |
||
137 | DocumentRoot /var/www/html/nextcloud |
||
138 | ServerName next.example.com |
||
139 | ErrorLog /var/log/apache2/nextcloud-error.log |
||
140 | CustomLog /var/log/apache2/nextcloud-access.log combined |
||
141 | |||
142 | <Directory /var/www/html/nextcloud> |
||
143 | Options +FollowSymlinks |
||
144 | AllowOverride All |
||
145 | Require all granted |
||
146 | SetEnv HOME /var/www/html/nextcloud |
||
147 | SetEnv HTTP_HOME /var/www/html/nextcloud |
||
148 | <IfModule mod_dav.c> |
||
149 | Dav off |
||
150 | </IfModule> |
||
151 | </Directory> |
||
152 | </VirtualHost> |
||
153 | </pre> |
||
154 | |||
155 | Save and close the file then activate the Apache virtual host and other required Apache modules with the following command: |
||
156 | |||
157 | <pre> |
||
158 | a2ensite next |
||
159 | a2enmod rewrite dir mime env headers |
||
160 | </pre> |
||
161 | |||
162 | Next, restart the Apache service to apply the changes: |
||
163 | |||
164 | <pre> |
||
165 | systemctl restart apache2 |
||
166 | </pre> |
||
167 | |||
168 | 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. |
169 | |||
170 | <pre> |
||
171 | sudo a2dissite 000-default.conf |
||
172 | service apache2 reload |
||
173 | </pre> |
||
174 | |||
175 | 1 | Gareth Eaton | |
176 | 3 | Gareth Eaton | |
177 | --- |
||
178 | 22 | Gareth Eaton | |
179 | 19 | Gareth Eaton | Now in a web-browser go to your nextcloud address(http://next.example.com) and finish the install, |
180 | 1 | Gareth Eaton | |
181 | 19 | Gareth Eaton | Set up an admin user account, and for the database it should be, |
182 | |||
183 | 18 | Gareth Eaton | <pre> |
184 | Database user: nextcloud |
||
185 | Database password: what ever you used |
||
186 | Database name: nextcloud |
||
187 | Database hose:localhost |
||
188 | </pre> |
||
189 | 22 | Gareth Eaton | |
190 | 18 | Gareth Eaton | --- |
191 | 3 | Gareth Eaton | |
192 | 23 | Gareth Eaton | The install should now be complete. |
193 | |||
194 | 21 | Gareth Eaton | --- |
195 | 1 | Gareth Eaton | |
196 | 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. |
197 | 1 | Gareth Eaton | |
198 | 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. |
199 | 23 | Gareth Eaton | |
200 | 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. |
201 | 21 | Gareth Eaton | |
202 | --- |
||
203 | |||
204 | 3 | Gareth Eaton | h3. [[Installing SSL with Let's Encrypt SSL]] |
205 | 4 | Gareth Eaton | [[Installing on with a Nginx with a reverse proxy using a Nginx Proxy Manager]] |