How to install YouPHPTube on Ubuntu Server 16.04 LTS

Post Reply
User avatar
LHammonds
Site Admin
Site Admin
Posts: 626
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

How to install YouPHPTube on Ubuntu Server 16.04 LTS

Post: # 596Post LHammonds
Wed Apr 04, 2018 8:52 am

** WORK IN PROGRESS **

I DO NOT HAVE THIS WORKING YET


Greetings and salutations,

I hope this thread will be helpful to those who follow in my foot steps as well as getting any advice based on what I have done / documented.

To discuss this thread, please participate here: >> CREATE FORUM LINK <<

High-level overview

This thread will cover installation of YouPHPTube web site on a dedicated Ubuntu server and will utilize a separate dedicated database server and dedicated encoding server. The server will be installed inside a virtual machine vSphere running on ESXi servers. Although there are some VMware-specific steps, they are very few and the majority of this documentation will work for other VMs such as VirtualBox or even directly installed onto a physical machine. Please excuse any ignorance on my part and if you have any advice on doing things better, please let me know. I love feedback and learning better ways of doing things!

When done, this server will allow the following types of files to be uploaded: mp4, avi, mov, mkv, flv, mp3, wav, m4v, webm, wmv, 3gp, mpg, mod, mpe

After Ubuntu is installed and configured, Apache web server will be installed and configured. Next will be the installation and configuration of YouPHPTube which will utilize an existing remote database server (MariaDB/MySQL).

The last step will cover some custom scripts to help automate tasks such as backing up, automatically growing the file system when free space is low, etc.

Image

Tools utilized in this process
Helpful links

The list below are sources of information that helped me configure this system as well as some places that might be helpful to me later on as this process continues.
Assumptions

This documentation will need to make use of some very-specific information that will most-likely be different for each person / location. And as such, I will note some of these in this section. They will be highlighted in red throughout the document as a reminder that you should plug-in your own value rather than actually using my "place-holder" value.

Under no circumstance should you use the actual values I list below. They are place-holders for the real thing. This is just a checklist template you need to have answered before you start the install process.

Wherever you see RED in this document, you need to substitute it for what your company uses. Use the list below as a template you need to have answered before you continue.
  • Ubuntu Server name: srv-php
  • Internet domain: youphptube.mydomain.com and encoder.mydomain.com
  • Ubuntu Server IP address: 192.168.107.8
  • Ubuntu Admin ID: administrator
  • Ubuntu Admin Password: myadminpass
  • Email Server (remote): 192.168.107.25
  • MySQL Server (remote): 192.168.107.20
  • MySQL root Password: mysqlrootpass
  • MySQL YouPHPTube user: youphptubeuser
  • MySQL YouPHPTube Password: youphptubeuserpass
I also assume the reader knows how to use the VI editor. If not, you will need to beef up your skill set or use a different editor in place of it.

User avatar
LHammonds
Site Admin
Site Admin
Posts: 626
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

Server OS Installation

Post: # 597Post LHammonds
Wed Apr 04, 2018 9:06 am

Installation of Database Server

This documentation will assume you have installed a separate and dedicated database server according to this article: How To Install MariaDB

Installation of Ubuntu Server

This documentation will assume you have installed Ubuntu Server according to this article: How to install and configure Ubuntu Server

It is assumed that the server was configured according to that article with the exceptions that the assumptions in red (variables above) are used instead of the assumptions in that document since we are building a web server.

Be sure to add a host entry that points to your database server in /etc/hosts. Example:

Code: Select all

192.168.107.20	srv-database
Installation of Dedicated Encoding Server

This documentation will assume you have installed a separate and dedicated encoding server according to this article: How To Install YouPHPTube Encoder

User avatar
LHammonds
Site Admin
Site Admin
Posts: 626
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

Configure Database

Post: # 598Post LHammonds
Wed Apr 04, 2018 10:00 am

Configure MariaDB / MySQL

In this scenario, a dedicated and general-purpose database server already exists and it will be used to hold the application's database.
  1. Connect to the MariaDB/MySQL server using PuTTY.
  2. At the login prompt, login with your administrator account (administrator / myadminpass) and then temporarily grant yourself super user privileges by typing sudo su
  3. Type the following commands:
    mysql -u root -p Enter password: rootpass
    CREATE DATABASE youphptube CHARACTER SET utf8 COLLATE utf8_bin; CREATE USER 'youphptubeuser'@'%' IDENTIFIED BY 'youphptubeuserpass'; GRANT ALL ON youphptube.* TO 'youphptubeuser'@'%'; FLUSH PRIVILEGES; exit
    The above commands will allow the database account to connect from any machine from anywhere in the world. This might be OK if your database is not accessible outsite your local network or if your machine name changes or you have multiple servers that connect to the same database that use the same ID. You can make this more secure by specifying your application server when granting access. Make sure the database server will recognize the server name (via hosts file or DNS) or just use the IP address:
    CREATE USER 'youphptubeuser'@'srv-php' IDENTIFIED BY 'youphptubeuserpass'; GRANT ALL ON youphptube.* TO 'youphptubeuser'@'srv-php';
    or
    CREATE USER 'youphptubeuser'@'192.168.107.8' IDENTIFIED BY 'youphptubeuserpass'; GRANT ALL ON youphptube.* TO 'youphptubeuser'@'192.168.107.8';
    This will prevent anyone knowing the credentials from logging into the database from any other remote machine not specified in the grant command.

    If your application is running on the database server (typical on a developer machine / non-production scenario), create the user like this:
    CREATE USER 'youphptubeuser'@'localhost' IDENTIFIED BY 'youphptubeuserpass'; GRANT ALL ON youphptube.* TO 'youphptubeuser'@'localhost';
    This will prevent anyone knowing the credentials from logging into the database from any other remote machine.

    If you mess anything up, you can remove the database and user by issuing these commands:
    DROP USER youphptubeuser; FLUSH PRIVILEGES; DROP DATABASE youphptube;

User avatar
LHammonds
Site Admin
Site Admin
Posts: 626
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

Install Web Server

Post: # 604Post LHammonds
Wed Apr 04, 2018 3:20 pm

Install Apache Web Server
  1. Connect to the SRV-PHP server using PuTTY.
  2. At the login prompt, login with your administrator account (administrator / myadminpass) and then temporarily grant yourself super user privileges by typing sudo su
  3. Type the following commands:

    Code: Select all

    apt -y install apache2 php7.0 libapache2-mod-php7.0 php7.0-curl php7.0-gd php7.0-intl php7.0-mysql
  4. Once that is done, open a web browser and go to http://192.168.107.8 and you should see a web page that says "It works!"
Configure PHP Settings

Edit the PHP configuration and modify the following variables:

Code: Select all

vi /etc/php/7.0/apache2/php.ini
Change:

Code: Select all

max_execution_time = 30
To:

Code: Select all

max_execution_time = 7200
Change:

Code: Select all

post_max_size = 8M
To:

Code: Select all

post_max_size = 2048M
Change:

Code: Select all

upload_max_filesize = 2M
To:

Code: Select all

upload_max_filesize = 2048M
Change:

Code: Select all

memory_limit = 128M
To:

Code: Select all

memory_limit = 512M
Restart web service for changes to take effect:

Code: Select all

service apache2 restart
Download YouPHPTube

Code: Select all

cd /var/www
git clone https://github.com/DanielnetoDotCom/YouPHPTube.git
chown -R www-data:www-data /var/www/YouPHPTube
Create Apache Config for the web site

Your PC needs to be able to resolve the FQDN (Fully-Qualified Domain Name) to the server's IP address from this point forward.

If you are setting up this site before DNS (Domain Naming Service) can resolve the FQDN to the server's IP address, you can temporarily get around this by adding your domain to your local host on Windows or Linux. This will allow just your PC to match the FQDN to the server's IP address. Once DNS is managing this relationship, the local host entry is no longer needed.

Windows Example: C:\Windows\system32\drivers\etc\hosts
192.168.107.8 youphptube.mydomain.com
Linux Example: /etc/hosts
192.168.107.8 youphptube.mydomain.com

Code: Select all

touch /etc/apache2/sites-available/youphptube.conf
chown root:root /etc/apache2/sites-available/youphptube.conf
chmod 0644 /etc/apache2/sites-available/youphptube.conf
vi /etc/apache2/sites-available/youphptube.conf
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName youphptube.mydomain.com DocumentRoot /var/www/YouPHPTube <Directory /var/www/YouPHPTube/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/youphptube-error.log CustomLog ${APACHE_LOG_DIR}/youphptube-access.log combined </VirtualHost>
Enable the site configuration:

Code: Select all

a2ensite youphptube
If you need to disable the site in the future:

Code: Select all

a2dissite youphptube
Reload the Apache config so it is aware of the modified virtual host

Code: Select all

service apache2 reload
Enable Mod_ReWrite

Code: Select all

a2enmod rewrite
service apache2 restart
Enable Mod_Header (this is a work-around for multi-domain)

Code: Select all

a2enmod headers
service apache2 restart

User avatar
LHammonds
Site Admin
Site Admin
Posts: 626
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

Configure YouPHPTube

Post: # 605Post LHammonds
Wed Apr 04, 2018 3:39 pm

Configure YouPHPTube
  1. Access the site via a web browser. Example: http://192.168.107.8 or http://youphptube.mydomain.com
  2. Fill out the following settings and click Submit:
    Your Site URL: http://youphptube.mydomain.com/ (or http://192.168.107.8/)
    System Path to Application: /var/www/YouPHPTube/
    Title of your Web Site: YouPHPTube
    Contact E-mail: webmaster@mydomain.com
    Database Host: srv-database (or 192.168.107.20)
    Database Port: 3306
    Database User: youphptubeuser
    Database Password: youphptubeuserpass
    Database Name: youphptube
    Do you want to create database and tables? Create only tables (Do not create database)
    Select the main Language: English
    System Admin password: YouPHPTubeAdminPass
    Confirm System Admin password: YouPHPTubeAdminPass
  3. On the SRV-PHP server terminal, type the following commands:

    Code: Select all

    rm /var/www/YouPHPTube/install/*
    rmdir /var/www/YouPHPTube/install
  4. On the web browser, you can now click "Go to the main page"
  5. At this point, you should configure the dedicated encoder server.
  6. The "Encode video and audio" link on the main site defaults to the external encoder @ encoder.youphptube.com. To change this, go to Admin Menu, Site Configurations, Advanced Configuration tab and change "Encoder URL" from https://encoder.youphptube.com to your URL and click the Save button. Example: http://encoder.mydomain.com

User avatar
LHammonds
Site Admin
Site Admin
Posts: 626
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

Upgrading YouPHPTube

Post: # 608Post LHammonds
Thu Apr 05, 2018 3:57 pm

How to Upgrade YouPHPTube

>> NOT STARTED <<

User avatar
LHammonds
Site Admin
Site Admin
Posts: 626
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

Backup and Restore

Post: # 609Post LHammonds
Thu Apr 05, 2018 3:57 pm

How to Backup and Restore

>> NOT STARTED <<

User avatar
LHammonds
Site Admin
Site Admin
Posts: 626
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

YouTube Downloading

Post: # 610Post LHammonds
Thu Apr 05, 2018 6:18 pm

How to Enable YouTube Downloading

>> NOT STARTED <<

User avatar
LHammonds
Site Admin
Site Admin
Posts: 626
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

Encryption

Post: # 611Post LHammonds
Fri Apr 06, 2018 9:06 am

Encrypting Traffic Using SSL

>> NOT STARTED <<

User avatar
LHammonds
Site Admin
Site Admin
Posts: 626
Joined: Fri Jul 31, 2009 6:27 pm
Are you a filthy spam bot?: No
Location: Behind You
Contact:

SMTP eMail

Post: # 612Post LHammonds
Fri Apr 06, 2018 10:51 am

SMTP eMail

>> NOT STARTED <<

Gmail?
Hotmail?
Office365?
Yahoo?
Local Mail Relay?

Post Reply