0% found this document useful (0 votes)
118 views35 pages

Install AVideo on CentOS 8 Guide

Uploaded by

morgoth_bass
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views35 pages

Install AVideo on CentOS 8 Guide

Uploaded by

morgoth_bass
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

How to Install
AVideo/YouPHPTube on
CentOS 8 Server
 Last Updated: November 20th, 2020  Xiao Guoan (Admin)  3
Comments  CentOS

This tutorial is going to show you how to run your own


video-sharing website with AVideo (formerly known as
YouPHPTube) on CentOS 8. AVideo is an open-source, self-
hosted alternative to video-sharing websites like YouTube,
Vimeo, etc. With AVideo, users can upload videos to your
server and share it with the Internet.

AVideo Features

Unlimited and simultaneous live streams and you can


have unlimited users connected to each live stream.
Import and encode videos from other sites directly
from the Internet
Bulk encoding from local video directory
Make private videos
Totally integrated function with Youtube, syncing your
videos with Youtube
Transcode multiple formats of multimedia files to
MP4, WebM and MP3 file
Support Amazon S3 (Simple Storage Service)
Responsive site layout. AVideo looks incredible on any
device. (You can choose YouTube or Netfilx style
layout.)
User channels and user playlists
Subscribe to channels you like
You can monitor the performance of your videos with
up-to-date metrics and reports in AVideo Statistics. 
https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 1/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

Extend site functionalities with plugins.


SEO Optimized
iOS and Android apps available

AVideo Server Requirements

First, you should know that a single-core CPU is not viable


for a video sharing website, because the encoding process
will use a lot of CPU resource.

Then choose the server specs in accordance with the number


of users your site have.

If you just want to use it to share your own videos, you


need a server with at least 2 CPU cores and 4GB
RAM. You can buy a powerful VPS (virtual private
server) from Contabo with very little cost.
If you expect you site to have dozens of users, then
you can consider the Contabo extra large VPS, which
has 10 CPU cores, 60GB RAM, 1Gbit/s port speed,
1.6TB disk space, unlimited traffic but costs just 26.99
Euros/month.
When your site grows beyond that, you should buy a
dedicated server.

Software Requirements for Installing


AVideo on CentOS 8

AVideo requires PHP and MySQL/MariaDB. To follow this



tutorial, you should have already set up a LAMP stack or

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 2/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

LEMP stack. If you prefer to use Apache web server, then


install LAMP stack.

How to Install LAMP (Apache, MariaDB, PHP) stack


on CentOS 8

If you prefer to use Nginx web server, then install LEMP


stack.

How to Install LEMP (Nginx, MariaDB, PHP) stack


on CentOS 8

Note: AVideo support with Nginx is only


experimental. Your site may have issues if you use
Nginx.

You also need a domain name. I registered my domain name


at NameCheap because the price is low and they give whois
privacy protection free for life.

AVideo is comprised of two parts.

The main part is the front end stream server, which


allows users to watch existing videos.
The other part is the encoder, which allows users to
upload their videos.

The public encoder uses the domain name


https://encoder1.avideo.com . If you don’t want
users to leave your site when uploading videos, you need to
set up your private encoder. I will show you how in this
article. Without further ado, let’s get started.

Step 1: Download AVideo on CentOS


8 Server

Log into your CentOS 8 server via SSH. Then go to the web
root directory.

cd /var/www/ 
https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 3/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

Clone the AVideo streamer repository from Github.

sudo dnf install git


sudo git clone https://github.com/WWB
N/AVideo.git

Then go into the directory.

cd AVideo/

Clone the AVideo encoder repository from Github.

sudo git clone https://github.com/WWB


N/AVideo-Encoder.git

It will be saved as AVideo-Encoder . We rename it to


upload , so users can have a better idea of what this URL is
for when uploading videos.

sudo mv AVideo-Encoder upload

Next, we need to make the web server user as the owner of


the web root.

Apache

sudo chown apache:apache /var/www/AVi


deo/ -R

Nginx

sudo chown nginx:nginx /var/www/AVide


o/ -R

We also need to change the SELinux context so that the web


server can write to this directory.

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 4/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

sudo chcon -t httpd_sys_rw_content_t


/var/www/AVideo/ -R

Step 2: Install Dependencies

AVideo uses FFmpeg to encode videos. We can easily install


FFmpeg from the RPMFusion repository.

sudo dnf install epel-release

sudo dnf config-manager --enable Powe


rTools

sudo dnf install https://download1.rp


mfusion.org/free/el/rpmfusion-free-re
lease-8.noarch.rpm https://download1.
rpmfusion.org/nonfree/el/rpmfusion-no
nfree-release-8.noarch.rpm

sudo dnf install ffmpeg -y

To read and write meta information in multimedia files, we


need to install the perl-Image-ExifTool package.

sudo dnf install perl-Image-ExifTool

You also need to install some common PHP extensions.

sudo dnf install php-cli php-fpm php-


mysqlnd php-common php-json php-opcac
he php-readline php-curl php-gd php-x
ml

To fetch videos from other sites, we need to install YouTube-


DL. Though it’s included in the CentOS repository, but it’s
outdated. We will install YouTube-DL from the Python

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 5/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

Package Index, which always contains the latest version of


YouTube-DL.

sudo dnf install python3-pip


sudo -H pip3 install youtube-dl

It’s very important that you use the latest version, or you
might not be able to download videos from other sites. We
can create a Cron job to automatically check and install the
latest version.

sudo crontab -e

Add the following line at the end of the Crontab file to try
upgrading YouTube-DL daily.

@daily sudo -H pip3 install --upgrade


youtube-dl > /dev/null

Step 3: Create Database and User in


MariaDB

Log into MySQL/MariaDB shell as root with the following


command. You will need to enter the MySQL/MariaDB root
password.

mysql -u root -p

Then create a database for AVideo. This tutorial names the


database AVideo . You can use whatever name you like.

create database AVideo;

Create the database user. Again, you can use your preferred
name for this user. Replace your-password with your

preferred password.
https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 6/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

create user AVideo@localhost identifi


ed by 'your-password';

Grant this user all privileges on the AVideo database.

grant all privileges on AVideo.* to A


Video@localhost;

We also need to create a separate database for the encoder.

create database AVideoEncoder;

Create a user for this database.

create user AVideoEncoder@localhost i


dentified by 'your-password';

Grant privileges.

grant all privileges on AVideoEncode


r.* to AVideoEncoder@localhost;

Flush the privileges table and exit.

flush privileges;

exit;

Step 4: Setting Up Web Server

We can use Apache or Nginx web server.

Apache

If you prefer Apache, create a virtual host file for AVideo


with a command-line text editor like Nano.

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 7/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

sudo nano /etc/httpd/conf.d/avideo.co


nf

Put the following text into the file. Replace the red-colored
text with your actual data. I use a subdomain in this tutorial.
You can use your main domain name if you prefer. Don’t
forget to set DNS A record for the domain name in your DNS
record manager. Also, note that the document root directory
is case-sensitive and you should not add a forward slash at
the end.

<VirtualHost *:80>
ServerName tube.yourdomain.com
DocumentRoot /var/www/AVideo

<Directory /var/www/AVideo>
DirectoryIndex index.php
Options +FollowSymLinks
AllowOverride All
Require all granted
</Directory>

ErrorLog /var/log/httpd/avideo.er
ror.log
CustomLog /var/log/httpd/avideo.a
ccess.log combined

</VirtualHost>

Save and close the file. Restart Apache for the changes to
take effect.

sudo systemctl restart httpd

Now visit tube.yourdomain.com and you will be


redirected to the setup wizard page

( tube.yourdomain.com/install/index.php ).
https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 8/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

Before entering any information in the setup wizard, we need


to enable HTTPS.

Nginx

If you prefer Nginx, create a avideo.conf file in


/etc/nginx/conf.d/ directory.

sudo nano /etc/nginx/conf.d/avideo.co


nf

Put the following text into the file. Replace the red-colored
text with your actual data. I use a subdomain in this tutorial.
You can use your main domain name if you prefer. Don’t
forget to set DNS A record for the domain name in your DNS
record manager. Also note that the document root directory is
case-sensitive.

server {
listen 80;
listen [::]:80;
server_name tube.yourdomain.com;

root /var/www/AVideo;
index index.php index.html index.
htm;
charset utf-8;
client_max_body_size 2G;

access_log /var/log/nginx/avide
o.access.log;
error_log /var/log/nginx/avide
o.error.log;

location ~ \.php$ {
fastcgi_split_path_info ^(.+
\.php)(/.+)$;
fastcgi_pass unix:/run/php-fp

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 9/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

m/www.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
}

# translating Apache rewrite rule


s in the .htaccess file to Nginx rewr
ite rules
location / {
rewrite ^/$ /view/ last;
}
location /bootstrap {
rewrite ^/bootstrap/(.+)$ /vi
ew/bootstrap/$1 last;
}
location /js {
rewrite ^/js/(.+)$ /view/js/
$1 last;
}
location /css {
rewrite ^/css/(.+)$ /view/cs
s/$1 last;
}
location /img {
rewrite ^/img/(.+)$ /view/im
g/$1 last;
}
location /page {
rewrite ^/page/([0-9]+)/?$ /v
iew/?page=$1 last;
}
location /videoOnly {
rewrite ^/videoOnly/?$ /vie
w/?type=video last;
}
location /audioOnly {

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 10/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

rewrite ^/audioOnly/?$ /vie


w/?type=audio last;
}
location = /download {
rewrite ^(.*)$ /view/download
ExternalVideo.php last;
}
location = /downloadNow {
rewrite ^(.*)$ /objects/downl
oadVideo.php last;
}
location = /getDownloadProgress {
rewrite ^(.*)$ /objects/downl
oadVideoProgress.php last;
}
location = /about {
rewrite ^(.*)$ /view/about.ph
p last;
}
location = /contact {
rewrite ^(.*)$ /view/contact.
php last;
}
location = /sendEmail {
rewrite ^(.*)$ /objects/sendE
mail.json.php last;
}
location = /captcha {
rewrite ^(.*)$ /objects/getCa
ptcha.php last;
}
location /monitor {
rewrite ^/monitor/(.+)$ /obje
cts/ServerMonitor/$1 last;
}
location /cat {
rewrite ^/cat/([A-Za-z0-9-]
+)/?$ /view/?catName=$1 last;

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 11/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

}
location /video {
rewrite ^/video/([A-Za-z0-9-
_.]+)/?$ /view/?videoName=$1 last;
}
location /videoEmbeded {
rewrite ^/videoEmbeded/([A-Za
-z0-9-_.]+)/?$ /view/videoEmbeded.ph
p?videoName=$1 last;
}
location = /upload {
rewrite ^(.*)$ /view/mini-upl
oad-form/ last;
}
location = /fileUpload {
rewrite ^(.*)$ /view/mini-upl
oad-form/upload.php last;
}
location /uploadStatu {
rewrite ^/uploadStatus /view/
mini-upload-form/videoConversionStatu
s.php last;
}
location = /user {
rewrite ^(.*)$ /view/user.php
last;
}
location = /users {
rewrite ^(.*)$ /view/managerU
sers.php last;
}
location = /users.json {
rewrite ^(.*)$ /objects/user
s.json.php last;
}
location = /updateUser {
rewrite ^(.*)$ /objects/userU
pdate.json.php last;

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 12/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

}
location = /savePhoto {
rewrite ^(.*)$ /objects/userS
avePhoto.php last;
}
location = /addNewUser {
rewrite ^(.*)$ /objects/userA
ddNew.json.php last;
}
location = /deleteUser {
rewrite ^(.*)$ /objects/userD
elete.json.php last;
}
location = /recoverPass {
rewrite ^(.*)$ /objects/userR
ecoverPass.php last;
}
location = /saveRecoverPassword {
rewrite ^(.*)$ /objects/userR
ecoverPassSave.json.php last;
}
location = /signUp {
rewrite ^(.*)$ /view/signUp.p
hp last;
}
location = /createUser {
rewrite ^(.*)$ /objects/userC
reate.json.php last;
}
location = /usersGroups {
rewrite ^(.*)$ /view/managerU
sersGroups.php last;
}
location = /usersGroups.json {
rewrite ^(.*)$ /objects/users
Groups.json.php last;
}
location = /addNewUserGroups {

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 13/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

rewrite ^(.*)$ /objects/userG


roupsAddNew.json.php last;
}
location = /deleteUserGroups {
rewrite ^(.*)$ /objects/userG
roupsDelete.json.php last;
}
location = /ads {
rewrite ^(.*)$ /view/managerA
ds.php last;
}
location = /addNewAd {
rewrite ^(.*)$ /objects/video
_adsAddNew.json.php last;
}
location = /ads.json {
rewrite ^(.*)$ /objects/video
_ads.json.php last;
}
location = /deleteVideoAd {
rewrite ^(.*)$ /objects/video
_adDelete.json.php last;
}
location /adClickLo {
rewrite ^/adClickLog /object
s/video_adClickLog.php last;
}
location = /categories {
rewrite ^(.*)$ /view/managerC
ategories.php last;
}
location = /categories.json {
rewrite ^(.*)$ /objects/categ
ories.json.php last;
}
location = /addNewCategory {
rewrite ^(.*)$ /objects/categ
oryAddNew.json.php last;

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 14/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

}
location = /deleteCategory {
rewrite ^(.*)$ /objects/categ
oryDelete.json.php last;
}
location = /orphanFiles {
rewrite ^(.*)$ /view/orphanFi
les.php last;
}
location = /mvideos {
rewrite ^(.*)$ /view/manager
Videos.php last;
}
location = /videos.json {
rewrite ^(.*)$ /objects/video
s.json.php last;
}
location = /deleteVideo {
rewrite ^(.*)$ /objects/video
Delete.json.php last;
}
location = /addNewVideo {
rewrite ^(.*)$ /objects/video
AddNew.json.php last;
}
location = /refreshVideo {
rewrite ^(.*)$ /objects/video
Refresh.json.php last;
}
location = /setStatusVideo {
rewrite ^(.*)$ /objects/video
Status.json.php last;
}
location = /reencodeVideo {
rewrite ^(.*)$ /objects/video
Reencode.json.php last;
}
location = /addViewCountVideo {

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 15/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

rewrite ^(.*)$ /objects/video


AddViewCount.json.php last;
}
location = /saveComment {
rewrite ^(.*)$ /objects/comme
ntAddNew.json.php last;
}
location /comments {
rewrite ^/comments.json/([0-
9]+)$ /objects/comments.json.php?vide
o_id=$1 last;
}
location = /login {
rewrite ^(.*)$ /objects/logi
n.json.php last;
}
location = /logoff {
rewrite ^(.*)$ /objects/logof
f.php last;
}
location = /like {
rewrite ^(.*)$ /objects/like.
json.php?like=1 last;
}
location = /dislike {
rewrite ^(.*)$ /objects/like.
json.php?like=-1 last;
}
location /update {
rewrite ^/update/?$ /update/u
pdate.php last;
}
location = /siteConfigurations {
rewrite ^(.*)$ /view/configur
ations.php last;
}
location = /updateConfig {
rewrite ^(.*)$ /objects/confi

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 16/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

gurationUpdate.json.php last;
}
location = /charts {
rewrite ^(.*)$ /view/charts.p
hp last;
}

location = /upload/index.php {
rewrite ^(.*)$ /upload/view/in
dex.php last;
}

location = /upload/isAdmin {
rewrite ^(.*)$ /upload/view/isA
dmin.php last;
}

location = /upload/removeStreamer
{
rewrite ^(.*)$ /upload/view/remo
veStreamer.php last;
}

location = /upload/priority {
rewrite ^(.*)$ /upload/view/prio
rity.php last;
}

location = /upload/status {
rewrite ^(.*)$ /upload/view/stat
us.php last;
}

location = /upload/serverStatus {
rewrite ^(.*)$ /upload/view/statu
s.php?serverStatus=1 last;
}

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 17/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

location = /upload/upload {
rewrite ^(.*)$ /upload/view/uploa
d.php last;
}

location = /upload/listFiles.json {
rewrite ^(.*)$ /upload/view/listFi
les.json.php last;
}

location = /upload/deleteQueue {
rewrite ^(.*)$ /upload/view/delet
eQueue.php last;
}

location = /upload/saveConfig {
rewrite ^(.*)$ /upload/view/saveC
onfig.php last;
}

location = /upload/youtubeDl.json {
rewrite ^(.*)$ /upload/view/youtu
beDl.json.php last;
}

location = /upload/send.json {
rewrite ^(.*)$ /upload/view/send.
json.php last;
}

location = /upload/streamers.json {
rewrite ^(.*)$ /upload/view/strea
mers.json.php last;
}

location = /upload/queue.json {
rewrite ^(.*)$ /upload/view/queu
e.json.php last;

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 18/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

location = /upload/queue {
rewrite ^(.*)$ /upload/view/queu
e.php last;
}

location = /upload/login {
rewrite ^(.*)$ /upload/objects/lo
gin.json.php last;
}

location = /upload/logoff {
rewrite ^(.*)$ /upload/objects/lo
goff.json.php last;
}

location /upload/ {
rewrite "^/getImage/([A-Za-z0-9
=/]+)/([A-Za-z0-9]{3})$" /upload/obje
cts/getImage.php?base64Url=$1&format=
$2 last;
rewrite "^/getImageMP4/([A-Za-z0-
9=/]+)/([A-Za-z0-9]{3})/([0-9.]+)$" /
upload/objects/getImageMP4.php?base64
Url=$1&format=$2&time=$3 last;
}

location /upload/getSpiritsFromVide
o {
rewrite ^/getSpiritsFromVideo/([A
-Za-z0-9=/]+)/([0-9]+)/([0-9]+)$ /upl
oad/objects/getSpiritsFromVideo.php?b
ase64Url=$1&tileWidth=$2&totalClips=
$3 last;
}

location /upload/getLinkInfo {

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 19/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

rewrite ^/getLinkInfo/([A-Za-z0-9
=/]+)$ /upload/objects/getLinkInfo.js
on.php?base64Url=$1 last;
}

Save and close the file. Then test Nginx configuration.

sudo nginx -t

If the test is successful, reload Nginx for the changes to take


effect.

sudo systemctl reload nginx

Now visit tube.yourdomain.com and you will be


redirected to the setup wizard page
( tube.yourdomain.com/install/index.php ).
Before entering any information in the setup wizard, we need
to enable HTTPS.

Step 5: Enabling HTTPS

To encrypt the HTTP traffic, we can enable HTTPS by


installing a free TLS certificate issued from Let’s Encrypt.
Run the following command to install Let’s Encrypt client
(certbot) on CentOS 8 server.

sudo dnf install certbot

If you use Apache, you also need to install the Certbot


Apache plugin.

sudo dnf install python3-certbot-apac


he

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 20/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

And run this command to obtain and install TLS certificate.

sudo certbot --apache --agree-tos --r


edirect --hsts --staple-ocsp --email
[email protected] -d tube.yourdomain.co
m

If you use Nginx, install the Certbot Nginx plugin.

sudo dnf install python3-certbot-ngin


x

Next, run the following command to obtain and install TLS


certificate.

sudo certbot --nginx --agree-tos --re


direct --hsts --staple-ocsp --email y
[email protected] -d tube.yourdomain.com

Where

--nginx : Use the nginx plugin.


--apache : Use the Apache plugin.
--agree-tos : Agree to terms of service.
--redirect : Force HTTPS by 301 redirect.
--hsts : Add the Strict-Transport-Security header to
every HTTP response. Forcing browser to always use
TLS for the domain. Defends against SSL/TLS
Stripping.
--staple-ocsp : Enables OCSP Stapling. A valid
OCSP response is stapled to the certificate that the
server offers during TLS.

The certificate should now be obtained and automatically


installed.


https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 21/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

By default, SELinux forbids Apache/Nginx to make network


requests to other servers, but later Apache/Nginx needs to
request TLS certificate status from Let’s Encrypt CA server
for OCSP stapling, so we need to tell SELinux to allow
Apache/Nginx with the following command.

sudo setsebool -P httpd_can_network_c


onnect 1

Step 6: Finish Installation with the


Setup Wizard

Now go to tube.yourdomain.com and the setup wizard


will appear. On the left side, you can see if your server meet
the requirements.

If you use Nginx, you can ignore the following message.

Your server is nginx/1.14.2, you must


install Apache. 
https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 22/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

As you can see, the PHP post_max_size should be at


least 100M and upload_max_filesize should be at least
100M. We need to edit the php.ini file to change the two
values.

sudo nano /etc/php.ini

Find the following two lines.

post_max_size = 8M
upload_max_filesize = 2M

Change the values according to the video file size you are
going to upload. For example, if you allow uploading 1G
video file, then

post_max_size = 1024M
upload_max_filesize = 1024M

Save and close the file. Restart PHP-FPM for the changes to
take effect.

sudo systemctl restart php-fpm

Now refresh the AVideo install wizard page. Your server


should pass all requirements. Now on the right side, you can
enter a title your video site, and set a system admin
password. Enter the AVideo database name, user and
password you created earlier. (Note: You should use the main
database, not the encoder database. Also be aware of case-
sensitive.)


https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 23/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

Click the Install now button and AVideo should be


installed successfully.

Now we need to remove the


/var/www/AVideo/install/ directory.

sudo rm /var/www/AVideo/install/ -r

Click the Go to the main page button and you will see
the AVideo main page.

You can click the drop-down menu on the left and login as
the admin user and with the password you set just a few
moments ago. 
https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 24/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

Step 7: Set Up the Encoder

Go to https://tube.yourdomain.com/upload/ . You
will be redirected to the Encoder setup wizard. If you are not
automatically redirected, then you can manually enter the
setup wizard URL.

https://tube.yourdomain.com/upload/in
stall/index.php/

The left-hand side will show you if your server meet the
requirements of AVideo Encoder.


https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 25/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

If you use Nginx, you can ignore the following message.

Your server is nginx/1.14.2, you must


install Apache.

We installed exiftool, FFmpeg and youtube-dl in step 2, but


PHP-FPM can’t find the binaries. That’s because the we
didn’t enable the PATH variable in PHP. Edit PHP-FPM
configuration file.

sudo nano /etc/php-fpm.d/www.conf

Find the following line, and remove the semicolon (;) at the
beginning.

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 26/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

;env[PATH] = /usr/local/bin:/usr/bi
n:/bin

Save and close the file. Then restart PHP-FPM.

sudo systemctl restart php-fpm

Refresh the encoder installation page. The setup wizard


should be able to find exiftool, FFmpeg and youtube-dl
binaries. If the video directory isn’t writable, then run the
following command.

sudo chcon -t httpd_sys_rw_content_t


/var/www/AVideo/ -R

As you can see the PHP max_execution_time should be


at least 7200 and PHP memory_limit should be at least
512M. We need to edit the php.ini file to change the two
values.

sudo nano /etc/php.ini

Find the following two lines.

max_execution_time = 30
memory_limit = 128M

Change the values.

max_execution_time = 7200
memory_limit = 512M

Note that if later video encoding stops halfway through,


you need to increase the max_execution_time , or
upgrade your CPU.

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 27/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

Save and close the file. Then restart PHP-FPM.

sudo systemctl restart php-fpm

Now refresh the AVideo Encoder install wizard page. Your


server should pass all requirements. Now on the right side,
you need to enter the AVideoEncoder database name, user
and password your created earlier. Be aware of case-sensitive
and enter the streamer site’s admin password.

Click the Install Now button and AVideo Encoder will be


installed.


https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 28/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

Remove the install directory.

sudo rm /var/www/AVideo/upload/instal
l/ -r

Go to the main page. You will be able to log in to AVideo


encoder.

Step 8 : Change the Encoder URL

By default, AVideo uses public encoder for uploading videos.


To use your own encoder, sign in as admin in AVideo (not
AVideo Encoder) and go to the admin panel from the left
sidebar.

Go to settings -> site settings -> advanced


configuration . Change the Encoder URL to
https://tube.yourdomain.com/upload/ . Save the
settings, clear the cache directory and generate a new
sitemap.


https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 29/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

Now log out and log back in. If you click the encode
video and audio button on the upper-right corner, you
will be taken to your own encoder to upload videos. It should
be noted that the encoding speed depends on your server’s
CPU power. It doesn’t require much RAM because the
encoder will copy the video to a temporary file in the upload
directory ( /var/www/AVideo/upload/videos ).

Step 9: Configure SMTP

To send out emails (such as account registration, password


reset, etc), you need to configure an SMTP server. If you
would like to use your own mail server to send emails to
clients, please check out the following article to set up your
own mail server. Note that I highly recommend running
iRedMail mail server on a fresh clean OS. Installing
iRedMail on an OS that has other web applications can fail,
and likely break existing applications.

How to easily set up an email server on CentOS 8 with


iRedMail

If you would like to use an SMTP relay service, I


recommend Mailjet. You can follow the tutorial below to set
up SMTP relay on your AVideo server.

How to Set Up Postfix SMTP relay on CentOS with


Mailjet

You can test email sending by going to the admin panel -


> Setttings -> Site Settings -> Advanced 
https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 30/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

Configuration , you can find SMTP configuration. Use


the following settings.

Enable SMTP.
Enable SMTP Auth.
Use tls in SMTP Secure.
Use 587 as the SMTP port.
Enter your mail server’s hostname.
Enter an SMTP username and password.

Click the Save button to save the settings, then click Test
Email to see if it’s working.

Enable TCP BBR

For a video streaming server, it’s recommended to enable the


TCP BBR congestion control algorithm in the Linux kernel.
Edit sysctl.conf file.

sudo nano /etc/sysctl.conf


Add the following two lines at the end of the file.
https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 31/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr

Save and close the file. Then reload sysctl configurations.

sudo sysctl -p

Now check the congestion control algorithm in use.

sysctl net.ipv4.tcp_congestion_contro
l

Output:

net.ipv4.tcp_congestion_control = bbr

Mobile Apps

You can download the free android app or iOS app by doing
a search for AVideo on Google Play Store or YPT Mobile
in Apple Store. White-label mobile app require a paid
license.

Troubleshooting

If your AVideo main page failed to load some CSS and


JavaScript resources,


https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 32/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

It’s likely that you have added extra forward slash in the
Apache or Nginx virtual host file for the web root directory.
Instead of using

DocumentRoot /var/www/AVideo/

You should use

DocumentRoot /var/www/AVideo

If the main website isn’t working properly, you can check the
log file at /var/www/AVideo/videos/avideo.log . If
your encoder isn’t working properly, you can check the log
file at
/var/www/AVideo/upload/videos/avideo.log .

Other Tidbits

When encoding videos, you can choose resolutions (low, SD,


HD). If you use AVideo as a personal video streaming site, I
recommend choosing HD resolution only to reduce encoding
time and save disk space. If you have already encoded videos
to all 3 resolutions, you can go to the AVideo video directory
(/var/www/AVideo/videos) and delete low resolution and SD
resolution videos.

cd /var/www/AVideo/videos/
sudo rm *Low.mp4
sudo rm *SD.mp4

How To Download All Videos From


Your Video Site

You can use the youtube-dl command-line utility to


download all videos. First, you need to go to AVideo
dashboard, then go to the video list page and scroll down to 
https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 33/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

the bottom, click the download your videos list (permalink


.txt file) button. You will see a list of URL for all the videos.

Next, open up a terminal and create a txt file with a text


editor, copy the URLs from the web page and paste them
into the file. Then you can run the following command to
download the videos. Replace video-list.txt with your
own file name.

youtube-dl -a video-list.txt

Wrapping Up

I hope this tutorial helped you install AVideo on CentOS 8


server. As always, if you found this post useful, then
subscribe to our free newsletter to get more tips and tricks.
Take care 🙂
Rate this tutorial

[Total: 2 Average: 5]

You may also like:

Install How to Install How to


Next… Instal… Roun… Instal…

How to How to How to Run


Instal… Instal… Instal… Your…

https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 34/35
1/2/23, 21:14 How to Install AVideo/YouPHPTube on CentOS 8 Server - LinuxBabe

AVideo Self Hosted


https://www.linuxbabe.com/centos/install-avideo-youphptube-centos-8-server 35/35

You might also like