Skip to content

How to install LAMP, FFMPEG and Git on a fresh Ubuntu 24.x for AVideo Platform

Daniel Neto edited this page Oct 24, 2024 · 2 revisions

This Tutorial will guide you on the basic AVideo installation Streamer + Encoder + Live server (Nginx RTMP) for Ubuntu 24.04

Help with Installation

Feel free to ask us for help, you can hire us to do it for you:

Install Streamer + Encoder + Live (Nginx RTMP)

Just copy and paste this:

export DEBIAN_FRONTEND=noninteractive
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp && \
sudo chmod a+rx /usr/local/bin/yt-dlp && \
sudo apt-get update -y && \
sudo apt-get upgrade -y && \
sudo apt install -y --no-install-recommends ca-certificates apt-transport-https software-properties-common && \
sudo add-apt-repository -y ppa:ondrej/php && \
sudo apt-get install -y sshpass nano net-tools curl apache2 php libapache2-mod-php php-mysql php-sqlite3 php-curl php-gd php-intl php-zip php-mbstring mysql-server mysql-client ffmpeg git libimage-exiftool-perl libapache2-mod-xsendfile && \
sudo a2enmod xsendfile && \
cd /var/www/html && \
sudo git clone https://github.com/WWBN/AVideo.git && \
cd /var/www/html && \
sudo git clone https://github.com/WWBN/AVideo-Encoder.git && \
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl && \
sudo chmod a+rx /usr/local/bin/youtube-dl && \
sudo apt-get install -y build-essential libpcre3 libpcre3-dev libssl-dev php-xml && \
sudo a2enmod rewrite && \
sudo chown www-data:www-data /var/www/html/AVideo/plugin && \
sudo chmod 755 /var/www/html/AVideo/plugin && \
sudo apt-get install -y unzip && \
sudo apt-get install -y htop python3-pip && \
cd /var/www/html/AVideo/plugin/User_Location/install && \
sudo unzip install.zip && \
sudo a2enmod expires && \
sudo a2enmod headers && \
sudo systemctl start mysql && \
sudo mysql -u root -e "USE mysql;CREATE USER 'youphptube'@'localhost' IDENTIFIED BY 'youphptube';GRANT ALL PRIVILEGES ON *.* TO 'youphptube'@'localhost'; FLUSH PRIVILEGES;" && \
sudo chmod 777 /var/www/html/AVideo/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/ && \
sudo mkdir /var/www/tmp && \
sudo chmod 777 /var/www/tmp && \
sudo apt-get install -y --reinstall zlib1g zlib1g-dev && \
sudo mkdir ~/build && \
cd ~/build && \
sudo git clone https://github.com/arut/nginx-rtmp-module.git && \
sudo git clone https://github.com/nginx/nginx.git && \
cd nginx && \
sudo ./auto/configure --with-http_ssl_module --with-http_stub_status_module --with-http_auth_request_module --add-module=../nginx-rtmp-module --with-cc-opt="-Wimplicit-fallthrough=0" && \
sudo make && \
sudo make install && \
cd /usr/local/nginx/html && \
sudo wget https://raw.githubusercontent.com/WWBN/AVideo/master/plugin/Live/install/stat.xsl && \
sudo pip3 install glances --break-system-packages && \
sudo pip3 install vosk --break-system-packages && \
sudo pip3 install youtube-dl --break-system-packages && \
sudo pip3 install --upgrade youtube-dl --break-system-packages && \
sudo apt install -y --no-install-recommends certbot python3-certbot-apache software-properties-common snap snapd

MySQL Password

After running the commands, you'll need to set your MySQL root password. This step has been adjusted from previous Ubuntu versions:

The simplest way is to use:

sudo mysql_secure_installation

Alternatively, you can set the password with:

sudo mysqladmin -u root OLDPASSWORD NEWPASSWORD

Or, if those don't work:

sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'NEWPASSWORD';

Replace NEWPASSWORD with your chosen password.

For more detailed information, you can refer to this guide or check Issue 796 for additional help.

Apache Virtual Host

Virtual hosting allows multiple domain names to be hosted on a single server. To set up a virtual host:

Create the virtual host file

Navigate to your sites-available directory with:

cd /etc/apache2/sites-available/

Create a new virtual host file, for example:

sudo nano mysite.com.conf

Copy and paste the following configuration, replacing mysite.com with your domain name:

<VirtualHost *:80>
    DocumentRoot "/var/www/html/AVideo"
    ServerName mysite.com
    # ServerAlias www.mysite.com
    ServerAdmin webmaster@localhost
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
    DocumentRoot "/var/www/html/AVideo"
    ServerName mysite.com
    # ServerAlias www.mysite.com
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<Directory /var/www/html/AVideo/>
    Options Indexes FollowSymLinks
    XSendFile on
    XSendFilePath /var/www/html/AVideo/
    AllowOverride All
    Require all granted
    Order Allow,Deny
    Allow from All
</Directory>

Enable the site with:

sudo a2ensite mysite.com

Then restart Apache:

sudo /etc/init.d/apache2 restart

Install SSL with Let's Encrypt

Install Certbot

sudo snap install --classic certbot
sudo mv /usr/bin/certbot /usr/bin/certbot_old
sudo ln -s /snap/bin/certbot /usr/bin/certbot

Install the SSL Certificate

Run the following command and follow the prompts:

sudo certbot --apache --register-unsafely-without-email --redirect

Install Certbot for Nginx

sudo apt-get install python3-certbot-nginx -y

To ensure you have the correct nginx.conf and directories, run these commands:

sudo mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.old && cd /usr/local/nginx/conf/ && sudo wget https://raw.githubusercontent.com/WWBN/AVideo/master/plugin/Live/install/nginx.conf && sudo mkdir /HLS && sudo mkdir /HLS/live && sudo mkdir /HLS/low  
sudo mv /usr/sbin/nginx /usr/sbin/nginx.old && sudo cp /usr/local/nginx/sbin/nginx /usr/sbin/nginx
sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old && sudo cp /usr/local/nginx/conf/nginx.conf /etc/nginx/nginx.conf

Install SSL for Nginx

sudo certbot --nginx --nginx-server-root /usr/local/nginx/conf --no-redirect

Replace the port number in the nginx.conf

sudo sed -i 's/listen 443 ssl/listen 8443 ssl/g' /usr/local/nginx/conf/nginx.conf 

Restart Nginx

sudo /usr/local/nginx/sbin/nginx -s stop && sleep 1 && sudo /usr/local/nginx/sbin/nginx

Open the site in your browser

Finally, open your browser and go to mysite.com to access your AVideo installation.

We hope you enjoy using AVideo! If you need any help, have questions, or encounter any issues, please open an issue on GitHub.

Clone this wiki locally