Update Remi PHP to next version

Since Centos ships with an old PHP version, there are many tutorials on how to install Remi PHP which enables you to use more modern versions of PHP on your site. But when it came time to update from PHP72 to php73/4 I couldn’t find a lot of docs on this so I decided to put this one up to remind me next time am doing this.

First, we will need to enable the PHP version we want to install such as below.


# yum-config-manager --enable remi-php73
# yum-config-manager --enable remi-php74

In my case, I was moving from php72 to 73 before 74 so I enabled 73 and disabled 72.


# yum-config-manager --enable remi-php73
# yum-config-manager --disable remi-php72

After enabling the version you want to move to and disabling your current version, run yum update and restart your webserver.


# yum update
# apachectl restart

To validate the update was successful check the current version of PHP as reported in your terminal, and those are the steps needed to move from one Remi PHP version to another.


# php -v
PHP 7.3.29 (cli) (built: Jun 29 2021 09:30:31) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.29, Copyright (c) 1998-2018 Zend Technologies

Running KVM and docker on the same host with a bridge

I have been running kvm with a bridge on my fedora machine for a while, when trying to run docker on the same host access to the kvm hosts would die as soon as docker came up. I read up online and most places mention that the two technologies should be able to co-exist with each other without any problems, after some further searching I was able to find an article that mentioned that if you have already setup a bridge for KVM you can tell docker to use this bridge. I was able to test this on my setup and it worked allowing docker to run without interfering with the existing bridge. Looking at the interfaces I can still see docker created an interface

docker0
but it doesn’t seem to be active.

The docker configuration involved adding this file

/etc/docker/daemon.json
with the following entry.
{ "bridge": "br0" }

Make sure the bridge number matches your existing bridge number in use by kvm.

Getting java JDK as a zip instead of exe

Sometimes you may need to have the java JDK available on your system without having to run the installer exe/msi for different reasons. This solution worked for me with JDK8u45, I haven’t tried it with other JDK versions so your mileage might vary.
Thanks to @Marc T for this solution.

create destination folder (c:\jdk8)
download JDK exe from Oracle
7zip -> unzip into destination folder
Open command prompt and enter cmd [cd c:\jdk8]
Enter this command to unpack the contents of the folder [for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar"]

VP8/9 vs h264/5 for personal videos

Recently I needed to encode some clips taken with my phone to a web optimized format since the videos were already in mp4 my initial thought was to keep them in mp4 format h264 video/AAC Audio.
First things first to get the videos to a web optimized format a re-encode would be needed so I had to accept that some drop in quality was going to happen. That was the easy part. A little googling and I found that libfdk_aac is the best AAC codec currently to use with ffmpeg, so I uninstalled my RPM installed ffmpeg and tried to compile my own. Getting sources for all the codecs I needed to have in my ffmpeg was pretty straight forward, but the build failed with some make error gcc was having issues building for the platform. This left me with 2 options wipe the OS fedora 20 and upgrade to the latest 21 or spin up a VM and use that to do the compile. The second option seemed like the way to go but I still wasn’t sold on the idea of having to do all this extra effort just to encode some phone clips.

During this thinking period when I was trying to get some time to go with option two I came across an article about vp9 and it hit me I was willing to jump through all this hoops to use a proprietary codec while there was a comparable opensource codec I could use with ffmpeg out of the box. So I re-installed ffmpeg from RPM spent about an hour tweaking some scripts to do the conversion and rotation of the clips.
Played back the newly encoded webm files and I could barely notice a difference with the original files, they were also 50% – 70% the size of the original files. Getting my video hosting application to work with webm files took about another hour as it was not on the list of supported extensions this was uprising since it’s an open source application.

Right now am feeling pretty happy with my choice as expected safari and IE don’t support webm so for those needing to watch the clips am just telling them to use Chrome or firefox. While the video hosting application allows me to share the clips with outsiders for my internal consumption of the clips I use Plex Media Server once they add support for webm to their native clients I will be converting the whole collection of clips from mp4 to webm.

Update: I received some feedback from family members and they are able to view the videos without a problem, so looks like I will be sticking with VP8/9.

Gnome Shell

I upgraded to Fedora 15 yesterday and I like gnome shell, sure it’s different to the old gnome but that’s why we upgrade software. I also like the fact that you can alt tab all the way to other workspaces nice!!. Personally I don’t miss the status bar and according to the word online, some features are already being added to Gnome3.2 which are missing currently, so for the first release this is pretty awesome work congrats Gnome team.
Personally the only thing I would like is for it to be easier to customize, but I see their is already an app Gnome Tweak Tool to help you customize your setup. The fact that the UI has moved away from all that windows like look is a great plus, this is Linux after all and we pride ourselves in being different.

p7zip Command Line

In CentOS to use p7zip  from command line the cmd is 7za and not p7zip or 7z, I wasted some time on this as most manuals online tell you to use p7zip [options] filename.

To extract a file you would do:

7za x filename.7z

You can substitute the .7z extension with whatever archive extension you are trying to xtract e.g tar,gz,zip etc as long as its an extension that can be handled by 7zip which should be most of the common formats.

Great Linux CMDs

In this post I will be making a list of great Linux cmd’s that I find all over the net one great place to stop by is commandlinefu.com they have a great deal of important linux cmd’s.

First cmd is mtr, it combines your ping and netstat cmd’s. In CentOS you have to su- to run this cmd:

mtr google.com

The following cmd I just started using recently and it has been a life saver I don’t know how I went all that time without it. The cmd is screen it works like your VNC or NX but for the terminal, it is especially handy if you SSH into your box but you don’t want to leave the terminal running waiting for a task to finish, you just start a screen run your cmd and detach from the screen. Now even if your connection gets disconnected or you disconnect yourself all you have to do when you connect again is run “screen -dR” and you are connected back to your earlier session and you can check on the progress of your task. To list screen instances “screen -ls”.

screen

Ctrl+a   ->pressing this twice moves to the next screen

Ctrl+a+c  ->adds a new screen to you screen instance

Ctrl+a+d ->detach from screen session

Ctrl+d  ->exit a screen

screen -dR   ->connect to/start a screen session

Mount a drive world writeable

mount -t ntfs-3g -o umask=000 /dev/drive /mnt/mountpoint

mount -t cifs -o umask=000,username=username,password=password //ipaddress/folder /mnt/mountpoint

by adding the option umask=000 any user can write to the mounted folder, this comes in handy when you want to write to a mounted drive as a regular user.  I have had a problem with some slack based distro’s not accepting this option in the current format and might need to play around with the mask cmd placement to see what works.

Update vs Clean Install

I just upgraded to CentOS 5.5 and while talking to a friend of mine we got into talking about updating vs clean install. After my update I had to restore to an image before the update as my mail system was not working, checked all packages contained in the update and zeroed the cause to a sendmail update. Which was disabling my current MTA “postfix”. I fixed that and another issue with my open office and I was ready to go. While my friend prefers to just do a clean install.

To me it just comes down to preference, if you have a heavily customized system it’s time saving to just do an upgrade, but if you are running a generic system with few modifications a clean install might be the best way for you.

Trying out new distros

The one good thing about Linux is the range of distributions available. Every few months I will load a new Distribution on my flash drive or make a Live cd and try it out. I am currently trying out Linux Mint and I like it, I would definitely recommend it for new users it comes loaded with most apps that you need day to day. It’s eye candy is one of the best I have checked out so far, I even loaded it onto one of my old boxes that am planning on donating.

Find and Identify Device ID’s

If you help fix people’s computers you will come across devices that windows will not have drivers for or you may be having problems downloading them from the machine manufacturer site, here is a quick way to go about it.

Go to Device Manager right click on unrecognised device there will be an exclamation mark on it click Properties ->Details and select Hardwae ID’s from the property drop down list. VID_ and VEN_ are used to identify vendors and PID_ and DEV_ identify Product ID. The HEX value following Product ID “PID_/DEV_” or Vendor ID “VID_/VEN_” is what you use in your search to identify the device.

Now go to pcidatabase.com enter your product or vendor id to such for your device.