Install Fast and Free SSL and HTTPS in cPanel with Let’s Encrypt

Let’s Encrypt is a trusted, open source certificate authority that offers free SSL certificates for as many domains as you want – and now there are easy ways to integrate it with cPanel for one-click, automated certificate installation that takes mere seconds to complete.

Installing an SSL certificate with Let’s Encrypt is already fast, but if you own a hosting business, you’re a developer who manages clients’ sites, or you want an even faster solution, then there are three Let’s Encrypt plugins you can integrate into cPanel, including an official plugin by cPanel.

In this post, I’ll cover how to install each of the three Let’s Encrypt plugins for cPanel and how you can use them to install and renew free certificates in a few seconds.

Server Requirements

To run any of the three plugins for cPanel there are a few prerequisites:

  • You need cPanel installed with a valid license
  • Root and SSH access to your server
  • The basic requirements for using Let’s Encrypt:
    • Unix-type OSes that include Python 2.6 or 2.7
  • For the official cPanel plugin:
    • cPanel and WHM versions 58.0.17 or above
  • For the plugin found on GitHub, you need:
    • A Centos five, six or seven server
    • A static IP address if you have Centos five
  • For the Let’s Encrypt for cPanel plugin, you need
    • i386 or x86_64 CentOS 6 or 7 (5 is not supported)
    • WHM 11.52 or higher (CloudLinux and LSWS compatible)
    • Remote access key has been generated (/root/.accesshash)

If you don’t have a remote access key generated but want to use the Let’s Encrypt for cPanel plugin, log into WHM and go to Clusters > Remote Access Key and click theGenerate New Key button.

It may be important to note that the Let’s Encrypt for cPanel plugin is the only premium option on the list. It’s $30 and there’s a free trial available. If you would like to try it out before purchasing a license, you can install it with a trial license automatically.

If you decide to purchase a premium license after all, you can replace the trial licensee on your server with the premium license file. The details on this can be found on the Let’s Encrypt for cPanel Installation page.

Once you have all the server requirements for the plugin you want to use, you can go ahead and install it. Feel free to skip ahead to the one you want to install:

  1. Let’s Encrypt for cPanel Installation
  2. Free Let’s Encrypt cPanel GitHub Plugin
  3. Free Official cPanel Plugin

1. Let’s Encrypt for cPanel Installation

Installing the cPanel Plugin

Log into your SSH client at root level, then add the Let’s Encrypt repository with the following command:

cd /etc/yum.repos.d/ && wget https://letsencrypt-for-cpanel.com/static/letsencrypt.repo
view rawadd-lets-encrypt-repo hosted with ❤ by GitHub

Next, install the plugin for cPanel with line below and yum:

yum -y install letsencrypt-cpanel
view rawinstall-le-cpanel hosted with ❤ by GitHub

The installation process usually takes about a minute. If all goes well and the installation was successful, a test should run automatically.

If it renders similar messages as the example below, you’re good to go:

le-cp self-test
[SELF-TEST] Can read config ………… SUCCESS.
[SELF-TEST] Can connect to daemon and check licence ………… SUCCESS.
[SELF-TEST] Can connect to Lets Encrypt ………… SUCCESS.
[SELF-TEST] Can talk to WHM API ………… SUCCESS.
[SELF-TEST] Can talk to plugin RPC ………… SUCCESS.
view rawsuccess-le-cpanel hosted with ❤ by GitHub

You can log in to your cPanel account and install your first SSL certificate.

Installing a Certificate

Once you’re logged into cPanel, you should see a Let’s Encrypt for cPanel button under Security. Click on it to access your active domains list to install a certificate.

The Let's Encrypt for cPanel button in cPanel.

Click the Let’s Encrypt for cPanel button to get started installing some SSL certificates.

Toward the bottom of the page, you should see the Issue a new certificate section. You should see a list of all your active domains including variations of them with and without a www. prefix.

You can check multiple boxes to install more than one certificate at a time or click the Issue Single link beside the domain where you want your certificate installed.

If you check multiple boxes, click one of the Issue Multiple links at the top or bottom of the list.

The Issue a new certificate section.

You can install multiple certificates at a time or just one.

Next, click the checkboxes next to the domains you don’t want to include if you selected multiple ones on the list on the previous page. Also select which domain you wish to be the primary one users are going to visit.

If you use one of the domains to access your email, also check the box labeled Install mail SMTPS/POP3S/IMAPS SSL certificate. Finally, click Issue to install your certificates.

Let's Encrypt for cPanel options.

Select which domains to include and install by clicking the Issue button.

The installation process takes about 10 seconds, but can take up to 45 seconds depending on how many certificates you have selected to issue. When the process has completed, you should see a message letting you know the installation was a success.

If something went wrong, try again. It usually works the second time around.

When you return to the main page, you should see your domains with certificates installed listed at the top of the page. You can click the Remove links to delete certificates one-by-one, or the Reinstall link to renew the certificates before the expiry date.

Using cron to delete files older than X minutes/ days

If you want to empty files in /tmp folder older than X minutes:

find /tmp -mmin +30 -type f -name "*.*" -exec rm -f {} ;

+30: 30 minutes; “*.*”: if you want to delete all files (please specify name as you want)

If you want to empty files in /tmp folder older than X days:

find /tmp -mtime +1 -type f -name "*.*" -exec rm -f {} ;

+1: 1 days (24 hours); “*.*”: if you want to delete all files

How to install FFmpeg and ffmpeg-php on CentOS Easily

FFmpeg is an amazing collection of open-source tools that can record and stream video and audio. However, it can also transcode video and audio (convert the files to different formats), and that is what has me so excited. There’s also a great PHP package called ffmpeg-phpthat allows for easy use of FFmpeg from inside PHP scripts. Today, I’m going to see if I can’t help you get both of these set up on your system.

Admittedly, it’s been a while since I’ve tried to install FFmpeg, about two years. I recently thought up some ideas on how I’d like to use FFmpeg, so I thought it was time to give it a try yet again. Today, I’m proud to say that installing FFmpeg is so much easier to install compared to the past, that I dare say it’s simple.

Here is my experience with installing FFmpeg on my server and how to fix the pitfalls that I encountered.

Preface

Note that I did all the following steps on a CentOS server. The specific version is CentOS x64 6.7.

These instructions can work for other distros with little or no modifications, but some distros will be completely different. For example, theDAG RPM Repository that I’m using (more info below) has support for the following distros: Red Hat Enterprise Linux, Fedora Core, Yellow Dog Linux, Aurora Linux, CentOS, Scientific Linux (they really need to get a verified SSL cert), TaoLinux, WhiteBox Linux, Lineox, andBLAG. Other distros will need to use a different repository.

If you successfully get FFmpeg running on another distro, please comment your changes here and I’ll update the post (and make sure you get credit of course).

Also note that I experienced some bumps in the road while installing everything. While many of you may not experience these issues, I found it important to document these problems and how I fixed them in case you encounter them.

Preparing

The first thing that you need to do is set up the DAG repository. This repository is an actively-maintained repository that provides a staggering number of packages with current or near current builds. Adding this repository is a great way to run the latest offerings of many packages.

Adding the DAG repository is simple. I’m using yum, so I did the following to add the repository:

  1. Create and open a new file called /etc/yum.repos.d/dag.repo. I ran “vi /etc/yum.repos.d/dag.repo“.
  2. Add the following text to the file:
    [dag]
    name=DAG RPM Repository
    baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
    gpgcheck=1
    enabled=1
  3. Finally, save and close the file.

In order to successfully use the DAG repository with tools such as yum, you need to add DAG’s GPG key. Failure to do so will result in an error like the following:

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Public key for faac.x86_64.1.26-1.el5.rf.rpm is not installed

In order to add the GPG key for DAG, run the following:

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

The DAG: Frequently Asked Questions page has additional instructions on how to get the repository loaded and working on your distro.

Now that DAG is setup, it’s a good idea to update all your packages.

yum update

Depending on the packages you currently have installed, this could potentially upgrade, install, or replace numerous packages that may or may not be very important to you. Make sure you carefully look through that list and do any necessary preparations before telling yum that it can go ahead.

For example, yum told me that it was going to replace my current MySQL interface library for Perl with a new one. I added to my check list a note to verify that my Perl code functioned correctly after the install.

I ran into another hitch when I told yum to go ahead with the update. It informed me that my current version of Subversion conflicted with the new version it wanted to install. When this happens, you need to remove the old package before proceeding. This time, I made backups of all of my repositories and my /etc/sysconfig/svnserve file before proceeding just in case. I then removed Subversion “yum remove subversion“, ran the update process “yum update“, and installed Subversion again “yum install subversion“.

Installing – FFmpeg

Now you are ready to install FFmpeg with yum. I wanted to install all the available FFmpeg packages, so I first asked yum what was available.

yum search ffmpeg

Searching through the results, I found that three packages need to be installed: ffmpeg, ffmpeg-devel, and ffmpeg-libpostproc.

yum install ffmpeg ffmpeg-devel ffmpeg-libpostproc

Note: If you install ffmpeg-libpostproc, the entire FFmpeg software library changes from the LGPL license to the GPL license.

After a couple of minutes, the packages and the packages that they depend on were installed.

I simply ran “ffmpeg” from the command line, and I took the lack of threatening error or warning messages as a good sign that things were working.

Preparing for ffmpeg-php

I often work with programs through command line calls in code, but I wanted something more robust this time, so I looked around and foundffmpeg-php. Based on the API, it looks to be a great tool to interface PHP and FFmpeg.

There are four things that are required to successfully install and run ffmpeg-php; they are:

  • ffmpeg-0.4.9_pre1 or higher
  • php-4.3.0 or higher
  • gd-2.0 or higher
  • php-devel

PHP and FFmpeg should be good to go since at the time of this writing, DAG has PHP version 5.1.6 and FFmpeg version 0.4.9. GD and php-devel can be easily installed by running the following yum command:

yum install php-gd php-devel

In case you are wondering what php-devel is for, it installs the phpize program which is used to install ffmpeg-php.

Installing ffmpeg-php

Now we are ready to install ffmpeg-php. This can be done in six easy steps:

  1. Download the latest ffmpeg-php release
  2. Extract the archive:
    tar -xjf ffmpeg-php-X.x.x.tbz2
  3. cd ffmpeg-php-X.x.x/
  4. phpize
  5. ./configure && make
  6. sudo make install

Finishing Thoughts

This may seem like a lot of work when I earlier described this process as “simple,” but trust me that this is a thousand times easier than when I first tried installing FFmpeg. I think I spent three hours working on installing FFmpeg just to find out that it didn’t work the first time I tried.

Time and time again, package management has proven to be an extremely powerful tool. While I know the value of manually configuring and compiling code, the ease of simply using a package manager can reduce the time needed to install and manage software from hours or days to minutes.

I’m glad to see that FFmpeg has benefited from the use of these package managers and great repositories like the DAG RPM Repository.

How to install MP4Box on CentOS

MP4Box is a MP4 multiplexer. So let see How TO Install MP4Box on CentOS.  MP4Box can import MPEG-4 video, DivX, XviD, 3ivx, h264 etc, audio streams and subtitles into the .mp4 container. The end result is a compliant MP4 stream. It can also extract streams from a .mp4. MP4Box is a command line tool, but can be used with graphical user interfaces such as YAMB or my MP4box GUI.

1) Install some dependencies packages with yum command

 yum -y install freetype-devel SDL-devel freeglut-devel

2) Download and install gpac

cd /usr/local/src/
wget http://mirror.ffmpeginstaller.com/source/gpac/gpac-0.5.0.tar.gz
wget http://mirror.ffmpeginstaller.com/source/gpac/gpac_extra_libs-0.5.0.zip

3) Extract gpac tar files

tar -zxvf gpac-0.5.0.tar.gz
unzip gpac_extra_libs-0.5.0.zip

4) Install gpac

cd extra_libs
cp -r * /usr/local/src/gpac/extra_lib
cd ..
cd gpac
chmod 755 configure
./configure
make lib
make apps
make install lib
make install
cp bin/gcc/libgpac.so /usr/lib 
install -m644 bin/gcc/libgpac.so /usr/local/lib/libgpac.so
chmod +x /usr/local/lib/libgpac.so
ldconfig

And it’s done.

[root@server ~]# which MP4Box
/usr/local/bin/MP4Box
[root@server ~]# /usr/local/bin/MP4Box -version
MP4Box - GPAC version 0.5.0-rev4065
GPAC Copyright: (c) Jean Le Feuvre 2000-2005
 (c) ENST 2005-200X
GPAC Configuration:
Features: GPAC_HAS_SSL GPAC_HAS_JPEG GPAC_HAS_PNG

Install Transmission Client to RHEL / CentOS 6

Torrent Guide – Install Transmission Client to RHEL / CentOS 6

transmission

Transmission Bittorrent Client

Transmission is an open source and extremely lightweight Bittorrent client. It is available for any OS and comes with it’s own GUI interface.

Although Transmission is not as popular as rTorrent/ruTorrent for seedboxes, it is still a strong solid choice as it does not require a web server to be deployed on the OS and has a light memory footprint allowing for it to run in very-low ram VPS environments.

Installing Transmission-BT to CentOS 6

For this guide I will be using CentOS 6, but any RHEL distro should work with similar commands.

Transmission can be installed quite easily through the repositories, however it is not part of the default Red Hat repositories. First we will need to install the EPEL repository to our server:

You can find the lastest EPEL repositories here:

https://fedoraproject.org/wiki/EPEL

For simplicity sake you can always just following my guide with version as of time of this writing, as it will be updated when you do an upgrade anyways.

1
2
wget http://mirror.pnl.gov/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm

Now with this repository added we can install Transmission via yum

1
2
yum -y update
yum -y install transmission transmission-daemon

Then start the process:

1
service transmission-daemon start

Test Transmission

Transmission uses port 9091 by default, try it now using your server’s IP or FQDN.

You will either see Transmission load, or you will see an error like this:

Transmission_-_2014-04-21_14.36.17

The reason for this error is because Transmission is setup by default to only accept connections from localhost. If you get this error proceed to the next step…

Configure Transmission For Remote Access

Before we modify the configuration we’ll want to stop the service. This is important!! Transmission will write it’s setting files on shutdown, so if we edit the settings now and “restart” Transmission then our changes just get overwritten.

1
service transmission-daemon stop

Now we can make changes to the settings.json file. Transmission will automatically write it’s config to the user’s home directory. By default the daemon process will be using “Transmission” user which is set to /var/lib/transmission rather then using the /home folders.

If you have trouble finding your settings.json you can always use the findcommand:

1
find / -name settings.json

Edit the settings.json file once you’ve located it:

1
nano /var/lib/transmission/.config/transmission/settings.json

Find the following lines:

    "rpc-whitelist": "127.0.0.1",
    "rpc-whitelist-enabled": true,

Change this according to your preferences. When a “White List” is set it means only those IP addresses can access the software. If you want to use the White List then set the appropriate IP addresses here. Otherwise we can just set the whitelist to false like so:

    "rpc-whitelist": "127.0.0.1",
    "rpc-whitelist-enabled": false,

Start our service back up:

1
service transmission-daemon start

And test:

Transmission_Web_Interface_-_2014-04-21_14.44.55

Success!

Android Studio – Rename Package

(1)

Open the file:

app >> manifests >> AndroidManifest.xml

enter image description here

Highlight each part in the package name that you want to modify (don’t highlight entire package name) then:

  • Mouse right click >> Refactor >> Rename >> Rename package
  • type the new name and press (Refactor)

Do these steps in each part of the package name

enter image description here

(2)

Open (Gradle Script) >> (build.gradle(Modul:app))

and update the applicationId to your package name

enter image description here

(3)

open the menu (build) and choose (Rebuild Project)

How to install ffmpeg, ffmpeg-php on CentOS 6/7 (Cpanel Server)

FFmpeg

For EL6:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm

Install FFMpeg from ATRPMS Repository:

yum -y install ffmpeg ffmpeg-devel

How to check if FFMPEG is working?

Verify the ffmpeg version:

ffmpeg -version
[root@centos:~]ffmpeg -version
ffmpeg version 2.2.1
built on Apr 13 2014 13:00:18 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-frei0r --enable-libopencv --enable-libdc1394 --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --disable-stripping
libavutil      52. 66.100 / 52. 66.100
libavcodec     55. 52.102 / 55. 52.102
libavformat    55. 33.100 / 55. 33.100
libavdevice    55. 10.100 / 55. 10.100
libavfilter     4.  2.100 /  4.  2.100
libswscale      2.  5.102 /  2.  5.102
libswresample   0. 18.100 /  0. 18.100
libpostproc    52.  3.100 / 52.  3.100

Check the supported formats:

ffmpeg -formats

Test converting videos. Here’s an example from mp4 to h264:

cd /usr/local/src
wget https://archive.org/download/WoodstockFestivalTrailer/Woodstock_Festival_Trailer.avi
ffmpeg -i Woodstock_Festival_Trailer.avi -vcodec libx264 Woodstock_Festival_Trailer-H264.avi

After done, you should see the new H264 file:

-rw-r--r-- 1 root root 20M May 4 2006 Woodstock_Festival_Trailer.avi
-rw-r--r-- 1 root root 15M Jan 30 10:01 Woodstock_Festival_Trailer-H264.avi

How can I work with ffmpeg using PHP?

Simple.  Just install php-ffmpeg extension. First, install REMI repo in order to get your php-ffmpeg package as below:

Let’s download the RPM file for CentOS 5.x and CentOS 6.x:

EPEL repo for  Centos 5.x

wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-5*.rpm

EPEL repo for Centos 6.x

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh  epel-release-6*.rpm

EPEL repo for Centos 7.x

wget http://download.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
rpm -Uvh  epel-release-6*.rpm

That command will install the EPEL repo inside your /etc/yum.repos.d directory.

then

Manually, install FFmpeg-Php
        cd /usr/local/src
        wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2
        tar jxvf ffmpeg-php-0.6.0.tbz2
        cd ffmpeg-php-0.6.0
        phpize
        ./configure
        make
If you get (error make: *** [ffmpeg_frame.lo] Error 1) do this commands.
sed -i 's/PIX_FMT_RGBA32/PIX_FMT_RGB32/g' ffmpeg_frame.c
 OR
 vi ffmpeg_frame.c
 :%s/PIX_FMT_RGBA32/PIX_FMT_RGB32
:wq
Then rerun "./configure && make" and if all went fine make install make install If no error skil to step 5. Step 5. Now adding to php.ini echo 'extension=ffmpeg.so' >> /usr/local/lib/php.ini Step 6. Now test php with ffmpeg php -r 'phpinfo();' | grep ffmpeg

-i | grep ffmpeg -i

/etc/php.d/ffmpeg.ini,
ffmpeg
ffmpeg-php version => 0.7.0
ffmpeg-php built on => Jan  1 2013 09:50:55
ffmpeg-php gd support  => enabled
ffmpeg libavcodec version => Lavc53.61.100
ffmpeg libavcodec license => GPL version 3 or later
ffmpeg libavformat version => Lavf53.32.100
ffmpeg libavformat license => GPL version 3 or later
ffmpeg swscaler version => SwS2.1.100
ffmpeg swscaler license => GPL version 3 or later

When you run command ./configure if you get error: configure: error: ffmpeg headers not found. Make sure ffmpeg is compiled as shared libraries using the –enable-shared option. Check some library with command:

rpm -ql ffmpeg-devel

In On CentOS 6/7 with nux-dextop installed ffmpeg-devel

locate avio.h avformat.h avcodec.h
/usr/include/ffmpeg/libavcodec/avcodec.h
/usr/include/ffmpeg/libavfilter/avcodec.h
/usr/include/ffmpeg/libavformat/avformat.h
/usr/include/ffmpeg/libavformat/avio.h
/usr/share/doc/ffmpeg/libavcodec.html
/usr/share/doc/ffmpeg/libavformat.html

Now  do command:

[root@centos ffmpeg-php-0.6.0]# strace -f -o /ffmpeg-strace ./configure --with-php-config=/usr/bin/php-config --with-ffmpeg=/usr --includedir=/usr/include/ffmpeg

Then:

cat /ffmpeg-strace | egrep 'avio.h|avformat.h|avcodec.h'

Looks like ffmpeg-devel installed headers at

  • /usr/include/ffmpeg/libavcodec/avcodec.h
  • /usr/include/ffmpeg/libavfilter/avcodec.h
  • /usr/include/ffmpeg/libavformat/libavformat.h
  • /usr/include/ffmpeg/libavformat/avio.h

Problem is specific to avcodec.h, avformat.h, avio.h and swscale.h – so what about symlinking them

ln -s /usr/include/ffmpeg/libavcodec/avcodec.h /usr/include/ffmpeg/avcodec.h
ln -s /usr/include/ffmpeg/libavformat/libavformat.h /usr/include/ffmpeg/libavformat.h
ln -s /usr/include/ffmpeg/libavformat/libavformat.h /usr/include/ffmpeg/libavformat.h
ln -s /usr/include/ffmpeg/libswscale/swscale.h /usr/include/ffmpeg/swscale.h

Then configure and make again:

./configure && make