Tuesday, December 20, 2016

Screen capture video and sound on Ubuntu

There are a couple of ways you can do a screen capture on Ubuntu. The problem is that most of the integrated graphical user interfaces are either not stable and crash in the middle of recording, or are not using proper codecs thus creating huge files, which one has to convert in order to edit or publish.

I'll share the two basic and reliable tools I'm using: Simple Screen Recorder and manually recording via FFmpeg:
For the Simple Screen Recorder is notable that it has pause shortcuts as well as one can adjust its various options very easily.
Image: screenshot.png
Installation:
sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder
sudo apt-get update
sudo apt-get install simplescreenrecorder
Afterward, just start using the program.

The second option is to manually record your screen. The first step is to install FFmpeg
sudo apt-get install ffmpeg
 Then create capture.sh file with
sudo nano capture.sh
and place the following information inside. Contents of the screen recorder:
#!/bin/sh
#
REC_iface=$(pactl list sources short | awk '{print$2}')
SCREEN_res=$(xrandr -q --current | grep '*' | awk '{print$1}')
REC_iface=alsa_input.usb-Superlux_digit_Superlux_E205U-00.analog-stereo
ffmpeg -async 1 -threads auto -f pulse -i $REC_iface -ac 2 -acodec vorbis -f x11grab -thread_queue_size 1024 -r 15 -s $SCREEN_res -i :0.0 -vcodec libx264 -crf 36 -preset slow -pix_fmt yuv420p  screencast.mp4
the only thing you need to change in this file is the REC_iface, this is your microphone input which you can find with the command:
pactl list sources short
Afterward, give chmod +x capture.sh to the file to make it executable.

then start the capturing process:
./capture.sh
this will start the recorder. Wait 5 seconds and start your screencast. When ready just click CTRL+C to stop the recording.

Cheers!

Saturday, December 10, 2016

Install OpenStack Mitaka under Virtualbox

First, let's get VirtualBox and set up our VirtualBox machine:

Give it at least 6 GB RAM, having a 64-bit processor
Then create 3 networks:
NatNetwork(for connection with the external world) with address: 10.0.2.0/24, to support DHCP
and allow port forwarding which we will use to connect to the internal Virtual Machine (VM)s:
name:ssh, protocol: TCP, host IP: 10.0.2.15, host port 22, guest IP: 127.0.0.1, guest port:2022
this way you can use ssh or putty to connect to 127.0.0.1:2022 and access the internal Virtual machines.
Next, create 2 other host-only networks with the following details(for communication and data transfer):
ip:10.50.0.1
mask:255.255.255.0
and
ip:10.254.254.1
mask:255.255.255.0
both with DHCP disabled

SSH access:
If you experience problems connecting to the Virtual Machine, you can try to disable and stop the firewall:
sudo systemctl disable firewalld
sudo systemctl stop firewalld
add an exception for SSH access in the firewall
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
check the selinux configuration
sudo nano /etc/selinux/config
check the open ports on your network with:
1. find all the networks you would like to inspect:
ip a |more
2. Install and use Nmap to portscan those networks:
sudo yum install nmap
scan the open ports on the virtual machines:
nmap 10.0.2.*
nmap 10.254.254.*

Install CentOS host system
Download CentOS minimal ISO and boot up the machine via VirtualBox.
Once logged in in the VM, edit the sudoers file and place your account there:  sudo cat /etc/sudoers
(instead of always typing sudo in front of the commands, you can write: sudo -i and continue working)
sudo dhclient - to make DHCP give access to the Virtual machines to outside(Internet) IP addresses
then edit /etc/resolv.conf sudo nano /etc/resolv.conf and add google nameserver 8.8.8.8 to be able to fetch internet websites from VM.

Configure the three network interfaces using information such as IP addresses from above :
cd /etc/sysconfig/network-scripts/
sudo nano ifcfg-enp0s3
sudo ifdown enp0s3
sudo ifup enp0s3
(repeat the process for enp0s9 and enp0s8)
check if the configuration is correct
ip a

Preparing installation
We need to install additional packages:
sudo yum install wget tcpdump curl
install network synchronizing time server
sudo yum install ntp
set the hostname of our virtual machine:
sudo hostnamectl set-hostname myopenstack.com
stop and disable network interference from Network Manager:
sudo systemctl stop NetworkManager.service
sudo systemctl disable NetworkManager.service


Upgrade to the latest available kernel to ensure better performance on virtualization and integration with VirtualBox:
enable elrepo kernel repository
yum --enablerepo=elrepo-kernel install kernel-ml
install ncurses library:
sudo  yum install gcc ncurses ncurses-devel
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
install fastestmirror to get closest repository:
sudo yum install yum-plugin-fastestmirror
install the kernel:
sudo yum --enablerepo=elrepo-kernel install kernel-ml
Reboot the system to make new kernel effectively loading
sudo reboot
check the kernel version
uname -a

Installing OpenStack Mitaka
get the RDO-release:
sudo yum install http://rdo.fedorapeople.org/rdo-release.rpm
then install the RPM package: sudo yum install openstack-packstack
Generate answers file for easier installation configuration of OpenStack
sudo packstack --gen-answers-file=.answers.cfg
install OpenStack using the answer-file:
sudo packstack --answer-file=.answers.cfg
Upgrade the openstack distribution as well as all other CentOS packages
sudo yum upgrade

Enter OpenStack dashboard using browser
(in Windows you can install xming server - to allow access from outside to OpenStack via ssh graphical screen )

install xauth authorization
sudo yum install xauth
sudo yum groupinstall fonts
*start the graphical terminal xterm
export DISPLAY=:0.0
start firefox and open up OpenStack dashboard
firefox 10.254.254.100/dashboard

Congratulations, you can now start using OpenStack :)
Enjoy!

Saturday, December 03, 2016

How to install the newest kernel on Ubuntu

Being with the latest stable kernel usually brings lots of benefits resulting in:

- having the latest supported drivers for your hardware
- fixing commonly reported bugs
- increase in overall system performance
- various speed and stability related, software-oriented optimizations
Reference: Practical Ubuntu Linux Server for beginners

Here is a video of the update process:



In order to do a simple kernel upgrade, so to be sure to have the latest one installed.
First visit: https://www.kernel.org/
Then choose from stable or unstable(mainline) kernel branch you would like to have your kernel installed. Just look up the numbers. Note: r.c. has the meaning of release candidate, so the kernel is still in development.
Then go to http://kernel.ubuntu.com/~kernel-ppa/mainline/
You'll find a huge directory with supported kernels tailored for Ubuntu distributions.
Scroll down, to pick the chosen one and enter its directory. Then open up a terminal and write:

cd /tmp
This way we will enter the temporary folder, which will be erased automatically when we reboot our machine.
We have to download the proper kernel version. To check if we have 32 or 64-bit system installed  type:
uname -m
which if shows i686 then your kernel should be 32 bit, and if shows x86_64 then you have to download the 64-bit kernel packages.
Next point at the right kernel with the right mouse click, copy the link location from 3 files: one with a name ending on: _all, and two _generic .deb packages
  linux-headers-4.15.2-041502_4.15.2-041502.201802072230_all.deb
  linux-headers-4.15.2-041502-generic_4.15.2-041502.201802072230_amd64.deb
  linux-headers-4.15.2-041502-lowlatency_4.15.2-041502.201802072230_amd64.deb
  linux-image-4.15.2-041502-generic_4.15.2-041502.201802072230_amd64.deb
  linux-image-4.15.2-041502-lowlatency_4.15.2-041502.201802072230_amd64.deb

from those we need to download everything, except the 2 lowlatency packages.
In terminal just enter wget then paste the link location. Here follows an example of the first package:
wget linux-headers-4.15.2-041502_4.15.2-041502.201802072230_all.deb
The last step is to install the downloaded packages using sudo privileges:
sudo dpkg -i linux*
Reboot the computer in order to load the new kernel:
sudo reboot

If you have problems with the newly installed kernel, just press several times on restart the 'ESC' key and choose from Advanced options the previous working stable kernel version.
After some time you may notice that kernels begin to pile up, thus reducing your disk space. I advise you to remove the redundant ones with: sudo apt remove linux- and then list the not used: modules, image and headers packages.
Congratulations and happy learning!

Wednesday, November 30, 2016

Install Laravel on Ubuntu

Here is briefly how to do a basic install of Laravel on Ubuntu. First, get the PHP language interpreter. And here is updated video on how to do the installation on Ubuntu 19.04 / 19.10, also, please enjoy the Ubuntu admin course



sudo apt-get install php
Then install and run composer which will take care of packages dependencies:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
copy composer binary file into /sbin directory to be able to run composer from everywhere.
sudo mv composer.phar /usr/local/sbin/composer
or update the local path to be able to access composer vendor binaries and later be able to run laravel: export PATH = "$HOME/.config/composer/vendor/bin:$PATH" . If you would like the path change to be persistent just add the line into the .bashrc file.

install the two minimal PHP libraries required for laravel:
sudo apt-get install php-mbstring
sudo apt-get install php-xml
use composer to create a new project called learning-laravel from a package named laravel/laravel. The new directory which package would get installed will be called learning-laravel:
composer create-project laravel/laravel learning-laravel
enter into the new directory
cd learning-laravel
and start a local listening PHP server on port 8888 and address localhost(127.0.0.1). This will also make PHP interpret all the files within the subdirectory /public:
php -S localhost:8888 -t public
Open a browser on localhost:8888 Congratulations! You have installed a running Laravel project!

Subscribe To My Channel for updates

Burnout or toxic culture ?

Outsourcing companies are hell to be in for an experienced programmer, because managers are being allowed to mistakes, which are covered, th...