Skip to content

Recent Articles

24
Apr

Install Mate Desktop on CentOS Linux 7

Let’s say we’ve installed a minimal version of CentOS Linux 7 from minimal cd iso and now we want to install Mate desktop. In order to do that we will need to install the epel repository, then to install Xorg server and then to add Mate from epel.

First we want to update our system to make sure we have latest version:

yum check-update
yum update

Then let’s proceed with installation:

yum groups mark convert
yum install epel-release
yum groups install "X Window System"
yum groups install "Mate Desktop"
yum install dkms

Then we want to enable graphical desktop at boot:

systemctl set-default graphical.target
24
Apr

Find out the ip of your network card in CentOS 7

If you want to see the IP of your network card use the ip command:

ip addr show

If you’ve installed CentOS from minmal cd image then the ifconfig command is not installed. If you really want the ifconfig command you need to install net-tools:

yum install net-tools

This is working, of course, if your network is properly configured. And don’t think to add net-tools package from CentOS 7 minimal install since it is not there.

Some will say that ifconfig, netstat, arp and route commands have been deprecated for some years now and have been removed from the default CentOS 7 install.

24
Apr

Mount a CD in CentOS 7 Linux

To mount a CD in CentOS 7 Linux run mount:

mount /dev/cdrom /mnt
24
Apr

ifconfig: command not found in CentOS 7 Linux

If you try to run ifconfig command on CentOS Linux 7 and you find out you do not have ifconfig installed then to be able to run it you must install net-tools package:

yum install net-tools

This will work of course if you have the networking configured. Or you can install it from CD media.

12
Apr

Circle crop image with PHP imagick

To create a circular crop with ImageMagick PHP library we will draw a black circle that will be used as a mask for the original image.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// original image
$image = new Imagick('path_to_image');
 
// get width an height of the image
extract($image->getImageGeometry());
 
// create circle mask
$circle = new Imagick();
$circle->newImage($width, $height, '#fff');
$circle->setImageFormat('png');
$circle->setImageMatte(true);
$draw = new ImagickDraw();
$draw->setFillColor('#000');
$draw->circle(round($width / 2), round($height / 2), round($width / 2), $width);
$circle->drawImage($draw);
 
// apply mask
$image->compositeImage($circle, Imagick::COMPOSITE_SCREEN, 0, 0);
 
// save image
$image->writeImage('circle_image_path');
$image->destroy();
19
Mar

Compile latest version of ImageMagick and PHP imagick on Ubuntu 14.04

Packages required to be able to compile

sudo apt-get install build-essential automake pkg-config checkinstall php5-dev

Delegates dependencies

sudo apt-get install ghostscript libgs-dev libautotrace-dev libpcre3-dev libbz2-dev libdjvulibre-dev libfftw3-dev libgraphviz-dev liblcms2-dev liblqr-1-0-dev libpango1.0-dev libwebp-dev

Directory to use for the sources

1
2
3
sudo chown $USER /usr/local/src
ln -s -T /usr/local/src sources
cd sources

Compile the latest version of ImageMagick

Read more »

19
Jan

Error: username is not in the sudoers file. This incident will be reported.

If you try to use sudo to run commands with root privileges in Ubuntu Linux and you get the following error message:

username is not in the sudoers file.  This incident will be reported.

then you must boot in Recovery mode and either add the username to admin group (which is allowed to use sudo) or edit the config file by running:

visudo

and add the following line:

username ALL=(ALL) ALL

where username is your username you want to allow to run sudo.

19
Jan

Remount a root filesystem with read write options in Ubuntu Linux

Let’s say you’ve entered in Recovery mode and you want to make changes to your config files (for example you want to add a new user or you want to change network config) but your root partition is mounted read only. To mount it read write run:

mount -o remount,rw /
18
Dec

Install TCPDUMP on CentOS Linux

You might find that tcpdump is not installed by default on CentOS. To install tcpdump run:

yum install tcpdump
23
Oct

Fix “Unable to unmount, device is busy” error

I am trying to unmount a file system mounted with FUSEFS SSHFS but I get errors and I am unable to unmount the resouce:

# umount -f /mnt/backup
umount2: Device or resource busy
 
# cat /proc/mounts
john@10.0.0.10:/home/john/backup /mnt/backup fuse.sshfs rw,nosuid,nodev,relatime,user_id=0,group_id=0 0 0
 
# fusermount -u /mnt/backup/
fusermount: failed to unmount /mnt/backup: Device or resource busy
 
# ls -la /mnt
/bin/ls: cannot access /mnt/backup: Transport endpoint is not connected
total 8
drwxr-xr-x  3 root root 4096 Aug 29 03:55 ./
dr-xr-xr-x 25 root root 4096 Oct  5 07:36 ../
d?????????  ? ?    ?       ?            ? backup/

To solve the problem we’ll unmount the file system using “lazy unmount”:

umount -l /mnt/backup

And voila, the filesystem is unmounted.

To learn more about -l option just look into umount man page:

      -l     Lazy  unmount.  Detach  the filesystem from the filesystem
hierarchy now, and cleanup all references to the filesystem as soon as 
it is not busy anymore.  (Requires kernel 2.4.11 or later.)