]>
Commit | Line | Data |
---|---|---|
1 | # Dependencies | |
2 | ||
3 | <!-- START doctoc generated TOC please keep comment here to allow auto update --> | |
4 | <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | |
5 | ||
6 | ||
7 | - [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives) | |
8 | - [Arch Linux](#arch-linux) | |
9 | - [CentOS 7](#centos-7) | |
10 | - [Fedora](#fedora) | |
11 | - [FreeBSD](#freebsd) | |
12 | - [macOS](#macos) | |
13 | - [Gentoo](#gentoo) | |
14 | - [Other distributions](#other-distributions) | |
15 | ||
16 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> | |
17 | ||
18 | ## Debian / Ubuntu and derivatives | |
19 | ||
20 | 1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation | |
21 | ||
22 | ``` | |
23 | # apt-get install curl sudo unzip vim | |
24 | ``` | |
25 | ||
26 | 2. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access | |
27 | ||
28 | 3. Install certbot (choose instructions for nginx and your distribution) : | |
29 | [https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions) | |
30 | 4. Install NodeJS 10.x: | |
31 | [https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions) | |
32 | 5. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest): | |
33 | [https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab) | |
34 | ||
35 | 6. Run: | |
36 | ||
37 | ``` | |
38 | sudo apt update | |
39 | sudo apt install nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git python-dev | |
40 | ffmpeg -version # Should be >= 3.x | |
41 | g++ -v # Should be >= 5.x | |
42 | ``` | |
43 | ||
44 | If you still have a 2.x version of FFmpeg on Ubuntu: | |
45 | ||
46 | ``` | |
47 | sudo add-apt-repository ppa:jonathonf/ffmpeg-3 | |
48 | sudo apt-get update | |
49 | sudo apt install ffmpeg | |
50 | ``` | |
51 | ||
52 | Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis: | |
53 | ||
54 | ``` | |
55 | sudo systemctl start redis postgresql | |
56 | ``` | |
57 | ||
58 | ## Arch Linux | |
59 | ||
60 | 1. Run: | |
61 | ||
62 | ``` | |
63 | sudo pacman -S nodejs-lts-dubnium yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx | |
64 | ``` | |
65 | ||
66 | Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis: | |
67 | ||
68 | ``` | |
69 | sudo systemctl start redis postgresql | |
70 | ``` | |
71 | ||
72 | ## CentOS 7 | |
73 | ||
74 | 1. Install NodeJS 10.x: | |
75 | [https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora) | |
76 | ||
77 | 2. Install yarn: | |
78 | [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install) | |
79 | ||
80 | 3. Install or compile ffmpeg: | |
81 | ||
82 | * Install - [https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/](https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/) | |
83 | * Compile - [https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh](https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh) | |
84 | ||
85 | 4. Run: | |
86 | ||
87 | ``` | |
88 | sudo yum update | |
89 | sudo yum install epel-release centos-release-scl | |
90 | sudo yum update | |
91 | sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7 | |
92 | ``` | |
93 | ||
94 | 5. You need to use a more up to date version of G++ in order to run the yarn install command, hence the installation of devtoolset-7. | |
95 | ||
96 | ``` | |
97 | sudo scl enable devtoolset-7 bash | |
98 | ``` | |
99 | ||
100 | Later when you invoke any node command, please prefix them with `CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++`, such as with: | |
101 | ||
102 | ``` | |
103 | sudo -H -u peertube CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++ yarn install --production --pure-lockfile | |
104 | ``` | |
105 | ||
106 | Initialize the PostgreSQL database: | |
107 | ||
108 | ``` | |
109 | sudo postgresql-setup initdb | |
110 | ``` | |
111 | ||
112 | Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis: | |
113 | ||
114 | ``` | |
115 | sudo systemctl enable redis | |
116 | sudo systemctl enable postgresql | |
117 | sudo systemctl start redis | |
118 | sudo systemctl start postgresql | |
119 | ``` | |
120 | ||
121 | ## Fedora | |
122 | ||
123 | 1. Upgrade your packages: | |
124 | ||
125 | ``` | |
126 | dnf upgrade | |
127 | ``` | |
128 | ||
129 | 2. Add a user with sudoers group access: | |
130 | ||
131 | ``` | |
132 | useradd my-peertube-user | |
133 | passwd my-peertube-user | |
134 | usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers | |
135 | su my-peertube-user | |
136 | ``` | |
137 | ||
138 | 3. (Optional) Install certbot (choose instructions for nginx and your distribution): | |
139 | [https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions) | |
140 | ||
141 | 4. Install NodeJS 10.x: | |
142 | [https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora) | |
143 | ||
144 | 5. Install yarn: | |
145 | [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install) | |
146 | ||
147 | 6. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp) | |
148 | ||
149 | ``` | |
150 | sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm | |
151 | ``` | |
152 | This is necessary because `ffmpeg` is not in the Fedora repos. | |
153 | ||
154 | 7. Run: | |
155 | ||
156 | ``` | |
157 | sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git | |
158 | ffmpeg -version # Should be >= 3.x | |
159 | g++ -v # Should be >= 5.x | |
160 | ``` | |
161 | ||
162 | 8. Post-installation | |
163 | ||
164 | _from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_ | |
165 | > Due to policies for Red Hat family distributions, the PostgreSQL installation will not be enabled for automatic start or have the database initialized automatically. | |
166 | ||
167 | ``` | |
168 | # PostgreSQL | |
169 | sudo postgresql-setup initdb | |
170 | sudo systemctl enable postgresql.service | |
171 | sudo systemctl start postgresql.service | |
172 | # Nginx | |
173 | sudo systemctl enable nginx.service | |
174 | sudo systemctl start nginx.service | |
175 | # Redis | |
176 | sudo systemctl enable redis.service | |
177 | sudo systemctl start redis.service | |
178 | ``` | |
179 | ||
180 | 9. Firewall | |
181 | ||
182 | By default, you cannot access your server via public IP. To do so, you must configure firewall: | |
183 | ||
184 | ``` | |
185 | # Ports used by peertube dev setup | |
186 | sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp | |
187 | sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp | |
188 | # Optional | |
189 | sudo firewall-cmd --permanent --zone=public --add-service=http | |
190 | sudo firewall-cmd --permanent --zone=public --add-service=https | |
191 | # Reload firewall | |
192 | sudo firewall-cmd --reload | |
193 | ``` | |
194 | ||
195 | 10. Configure max ports | |
196 | ||
197 | This is necessary if you are running dev setup, otherwise you will have errors with `nodemon` | |
198 | ||
199 | ``` | |
200 | echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p | |
201 | ``` | |
202 | ||
203 | [More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097) | |
204 | ||
205 | ## FreeBSD | |
206 | ||
207 | On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail: | |
208 | ||
209 | 1. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed): | |
210 | ||
211 | ``` | |
212 | pkg | |
213 | pkg update | |
214 | pkg install -y sudo bash wget git python nginx pkgconf vips postgresql96-server postgresql96-contrib redis openssl node npm yarn ffmpeg unzip | |
215 | ``` | |
216 | ||
217 | 2. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo. | |
218 | ||
219 | ``` | |
220 | # visudo | |
221 | ``` | |
222 | ||
223 | Uncomment the line 90 | |
224 | ||
225 | ``` | |
226 | %wheel ALL=(ALL) ALL | |
227 | ``` | |
228 | ||
229 | 3. Enable nginx, redis, postgresql services and initialize database. | |
230 | ||
231 | ``` | |
232 | sysrc postgresql_enable="YES" | |
233 | sysrc redis_enable="YES" | |
234 | sysrc nginx_enable="YES" | |
235 | ``` | |
236 | ||
237 | Initialize database and start services | |
238 | ||
239 | ``` | |
240 | service postgresql initdb | |
241 | service postgresql start | |
242 | service redis start | |
243 | service nginx start | |
244 | ``` | |
245 | ||
246 | ## macOS | |
247 | ||
248 | 1. Add the packages: | |
249 | ||
250 | ``` | |
251 | brew install ffmpeg nginx postgresql openssl gcc make redis git yarn | |
252 | ``` | |
253 | ||
254 | 2. Run the services: | |
255 | ||
256 | ``` | |
257 | brew services run postgresql | |
258 | brew services run redis | |
259 | ``` | |
260 | ||
261 | ## Gentoo | |
262 | ||
263 | 1. Add this to ``/etc/portage/sets/peertube``: | |
264 | ||
265 | ``` | |
266 | net-libs/nodejs | |
267 | sys-apps/yarn | |
268 | media-video/ffmpeg[x264] # Optionnally add vorbis,vpx | |
269 | dev-db/postgresql | |
270 | dev-db/redis | |
271 | dev-vcs/git | |
272 | app-arch/unzip | |
273 | dev-lang/python:2.7 | |
274 | www-servers/nginx | |
275 | ||
276 | # Optional, client for Let’s Encrypt: | |
277 | # app-crypt/certbot | |
278 | # app-crypt/certbot-nginx | |
279 | ``` | |
280 | ||
281 | 2. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn: | |
282 | ||
283 | ``` | |
284 | mkdir -p /etc/portage/package.keywords | |
285 | cat << EOF >> /etc/portage/package.keywords/peertube | |
286 | # required by yarn (argument) for PeerTube | |
287 | sys-apps/yarn ~amd64 | |
288 | EOF | |
289 | ``` | |
290 | ||
291 | 3. Compile the peertube set: | |
292 | ||
293 | ``` | |
294 | emerge -a @peertube | |
295 | ``` | |
296 | ||
297 | 4. Initialize the PostgreSQL database if you just merged it: | |
298 | ||
299 | ``` | |
300 | emerge --config postgresql | |
301 | ``` | |
302 | ||
303 | 5. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot): | |
304 | ||
305 | ``` | |
306 | rc-update add redis | |
307 | rc-update add postgresql-11 | |
308 | rc-service redis start | |
309 | rc-service postgresql-11 start | |
310 | ``` | |
311 | ||
312 | ## Other distributions | |
313 | ||
314 | Feel free to update this file in a pull request! |