-
Notifications
You must be signed in to change notification settings - Fork 973
How to install LAMP, FFMPEG and Git on a fresh Ubuntu 20.x for AVideo Platform version 11.x or newer
This Tutorial will guide you on the basic AVideo installation Streamer + Encoder + Live server (Nginx RTMP)
Just copy and paste this:
sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt install ca-certificates apt-transport-https software-properties-common -y && sudo add-apt-repository ppa:ondrej/php -y && sudo apt-get install sshpass nano net-tools curl apache2 php8.1 libapache2-mod-php8.1 php8.1-mysql php8.1-curl php8.1-gd php8.1-intl php-zip mysql-server mysql-client ffmpeg git libimage-exiftool-perl libapache2-mod-xsendfile -y && 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 apt-get install python -y && 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 build-essential libpcre3 libpcre3-dev libssl-dev php8.1-xml -y && 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 unzip -y && sudo apt-get install htop python3-pip -y && cd /var/www/html/AVideo/plugin/User_Location/install && sudo unzip install.zip && sudo pip3 install youtube-dl && sudo pip3 install --upgrade youtube-dl && sudo a2enmod expires && sudo a2enmod headers && 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 --reinstall zlibc zlib1g zlib1g-dev -y && 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 --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 && sudo apt install certbot python3-certbot-apache software-properties-common snap snapd -y
After that, you need to set your mysql-root-password. This step has moved from Ubuntu 16 (password set while install) to Ubuntu 18 (password can be set anytime).
The most simple seems to be this:
sudo mysql_secure_installation
or
sudo mysqladmin -u root OLDPASSWORD NEWPASSWORD
or, if none of them work
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'NEWPASSWORD';
Replace NEWPASSWORD with your password.
Source and more info are here, maybe also Issue 796 can help you.
Virtual hosting is a method for hosting multiple domain names (with separate handling of each name) on a single server (or pool of servers). This allows one server to share its resources, such as memory and processor cycles, without requiring all services provided to use the same hostname.
Open a terminal or a console and write the following commands
Go to your sites-available apache2 folder with:
cd /etc/apache2/sites-available/
Open that new file (mysite.com.conf) with your best text editor or use:
sudo nano mysite.com.conf
Copy and paste the text below into your mysite.com.conf file, do not forget to replace the 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 as follows:
sudo a2ensite mysite.com
Restart your apache2 web server
sudo /etc/init.d/apache2 restart
Before copying the nginx.conf
to other locations, ensure you update the domain name to match your setup:
- Open the
nginx.conf
file using your preferred text editor:
sudo nano /usr/local/nginx/conf/nginx.conf
- Locate the section that starts with the
server {
block. Find the line that says:
server_name localhost;
- Replace
localhost
with your domain name. For example, if your domain ismysite.com
andwww.mysite.com
, the line should read:
server_name mysite.com www.mysite.com;
- Save the file and exit the text editor.
sudo snap install --classic certbot
sudo mv /usr/bin/certbot /usr/bin/certbot_old
sudo ln -s /snap/bin/certbot /usr/bin/certbot
Run this command and follow the steps
sudo certbot --apache --register-unsafely-without-email --redirect
sudo apt-get install python3-certbot-nginx -y
To make sure you have the correct nginx.conf and the correct directories run those commends
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
sudo certbot --nginx --nginx-server-root /usr/local/nginx/conf --no-redirect
sudo sed -i 's/listen 443 ssl/listen 8443 ssl/g' /usr/local/nginx/conf/nginx.conf
sudo /usr/local/nginx/sbin/nginx -s stop && sleep 1 && sudo /usr/local/nginx/sbin/nginx
Open your best web browser and write in its address bar: mysite.com
We hope you have fun! If you need help, have any question or Issue please open an Issue on https://github.com/WWBN/AVideo/issues