How to install FFMPEG on EC2 running Amazon Linux?
Recently, I needed to install ffmpeg on my EC2 instance and I struggled quite a bit to set it up. The issue was that my EC2 instance is running Amazon Linux based AMI which is probably based on some version of CentOS. For Debian and Ubuntu distributions, ffmpeg is available as a apt-get package but for other distributions you have to manually compile it. To be fair ffmpeg has provided a compilation guide for CentOS but for lazy people, it is too much of an effort. 🙂
Finally, I found a solution that worked perfectly so I thought of sharing it here. Here’s the step by step guide.
Step 1: SSH into your instance and become root
sudo su -
Step 2: Go to the /usr/local/bin directory
Step 3: Inside the /usr/local/bin directory, create an ffmpeg directory and go inside it.
mkdir ffmpeg && cd ffmpeg
Step 4: Download a static build of ffmpeg
Go to the following link and download a static build relevant for your system.
It’s was a Sunday and I was bored. Then I came across a custom URL shortener service, YOURLS that I had previously used in my college days. It was very simple to set it up with my GoDaddy shared web hosting. I no longer have a web hosting package on GoDaddy so I decided to try out AWS cloud instead.
AWS is cheap and easy to get started. Our goal is to get our own custom URL shortener service up and running on http://aloudapp.in.
Before we deep dive into the details of setting up everything, here are our broader goals.
Setup an EC2 instance for cloud hosting
Setup a hosting zone and configure DNS
Setup a load balancer for the EC2 instance.
Install a LAMP web server on the EC2 instance.
Configure YOURLS on the web server.
This article will cover everything up to setting up the LAMP web server.
Create an EC2 instance
An EC2 instance is a virtual server in Amazon’s Elastic Compute Cloud (EC2) for running applications on the Amazon Web Services (AWS) infrastructure.
Launch an EC2 instance
Click on Launch Instance to create a new instance.
Run a Linux machine
Choose Amazon Linux from the listed options for machine images.
Choose an Instance Type
We will go for a t2.micro free instance for the purpose of this example.
Review your EC2 instance
All done! Review your settings.
Create Key Pair
Create a public-private key pair if you desire. This is an optional step but we recommend that you create a key pair and download it. We will be using it later on in the article to SSH into our EC2 instance.
View Launch Status
Good Going! Your instance is up and running.
Edit Security Group
Edit security group settings to allow SSH inbound traffic from your IP address.
Add a custom rule
Next, you need to create a Hosting Zone where you would configure your DNS settings for the domain name. Here are the steps.
Create a Hosting zone
Click on Create Hosting Zone to get started.
Setup Your Domain
Fill in your Domain Name to create a new hosted zone.
Edit Namespace for your Domain
Once you have created a Hosted zone, you will be able to see associated namespace records for it. Edit these NS records for your domain. I purchased the domain from GoDaddy, so I had to go and edit these records in DNS settings for the domain on GoDaddy’s admin panel.
Add a A Record
Coming back to your Hosted Zone, create a new A record. Leave the Name field empty if you don’t want to configure just for a particular subdomain.
That’s it. Your Hosted Zone is now set up. You can also set up a subdomain in 4 easy steps by following this step by step guide.