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