Skip to content

Posts from the ‘Linux Tutorials’ Category


My Ubuntu 16.04 Networking is configured but I cannot find config files

If your Ubuntu machine has networking configured but there’s nothing in: /etc/network/interfaces (maybe only loopback interface is configured there) and there’s no file in /etc/network/interfaces.d then maybe the network was configured via Ubuntu’s GUI (Network Manager).

In that case the config file is located in /etc/NetworkManager directory.


Configure Networking in OpenSUSE Linux with manual IPv4

Here is a Quick Guide to configure networking in OpenSUSE Linux using manual IPv4.

First let’s see where config files are located.

# ls /etc/sysconfig/network/ifcfg-*
/etc/sysconfig/network/ifcfg-eth0  /etc/sysconfig/network/ifcfg-lo
linux-t003:/home/ovi #

Edit /etc/sysconfig/network/ifcfg-eth0 file and add:

NAME='82540EM Gigabit Ethernet Controller'

Edit /etc/sysconfig/network/routes file and add:

default -	-

Edit /etc/resolv.conf and add:


Then we need to restart network service:

service network restart

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

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

Compile the latest version of ImageMagick

Read more »


Install MySQL Client and Server on Centos6 Linux

This quick tutorial shows you how to install MySQL Server and Client on CentOS 6.6 Linux.

First we check if MySQL Server is installed or not:

yum list installed | grep mysql

Then we search for mysql-server on CentOS repositories we added to our machine:

yum search mysql-server

MySQL server is found:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * epel:
 * extras:
 * updates:
=== N/S Matched: mysql-server ===
mysql-server.x86_64 : The MySQL server and related files

Now we will install mysql-server:

yum install mysql-server

Let’s install mysql client too (in CentOS mysql package is in fact mysql client):

yum install mysql

At this point MySQL server is installed. Let’s start the server:

service mysqld start

We must add a password for MySQL root user (which is different from system root account):

/usr/bin/mysqladmin -u root password your-new-password

To change MySQL server password if you already configured one run (you need old password):

/usr/bin/mysqladmin -u root -p password your-new-password

To test if password was configured we will connect to our MySQL server using mysql client:

mysql -u root -p

We can also run mysql_secure_installation script which will remove test database and anonymous user created by default.


Configure Network Interface in Ubuntu Linux

If you want to configure a static IP on your Ubuntu or Debian from command line, here is what you have to do.

First we will switch login user to root.

sudo su

Then we will edit /etc/network/interfaces file:

vi /etc/network/interfaces

and we will add the following lines:

auto lo
iface lo inet loopback
auto eth1
iface eth1 inet static
  post-up route add default gw
  pre-down route del default gw

Last thing to do is to restart network services.

service networking restart

Create a GPT partition and a filesystem on CentOS Linux.

Let’s say we’ve just added a secondary drive to our CentOS Linux machine and we want to add GPT partition table and then create a GPT partition that will fill our disk. In order to do that we will use parted.

First we will install parted package:

yum install parted

Then we will go to parted CLI:

parted -s -a optimal /dev/vdb

There we add GPT partition table (don’t type “(parted)” part, it is the parted CLI prompt):

(parted) mklabel gpt

Then we will create our new partition:

(parted) mkpart primary ext4 1 -1

If we want not to fill entire drive but to make a partition of a let’s say 100G we will run instead:

(parted) mkpart primary ext4 1 300GB

Now we can exit the parted CLI and put a filesystem on our partition:

mkfs.ext4 /dev/vdb1

That’s it. We can just mount the partition.


Authenticate with Public and Private Keys on CentOS 6 Linux

If you want to disable password authentication and only authenticate with Public/Private keys on a CentOS 6 Linux machine when connecting via ssh here’s what you need to do.

How ssh keys auth works

We have a client an a server. On client we generate a pair of public/private keys. Then we copy the public key to the server in a specific file that will be used by ssh server to recognise the key. Then we configure the sshd server to disable password authentication and only permit public/private key auth.

Read more »


Create a web development environment using LXC

What is and why use LXC?

LXC is a linux container system that offers an environment as close as possible as of a virtual machine, without emulating any hardware and sharing the same kernel with the host, it is very lightweight and fast.
I prefer to keep the development environment isolated from my main machine. This assures that if everything goes wrong with the development environment, my main machine remains stable, also I can easily backup and test different configurations on the environment. For example I could setup multiple containers with different php versions.
The main objective of this article is to create a container that will behave like an app with a LEMP (Linux, NGINX, MySQL, PHP) stack that I can start and stop just as I would start a WAMP or MAMP app on Windows or OS X. The main machine is Ubuntu 14.04.
Read more »


How to install LEMP in Ubuntu 14.04

Add your user to the same group as nginx.

sudo usermod -aG www-data $USER

Enter root to install and configure the packages.

sudo -s
apt-get update

If in LXC container:

apt-get install software-properties-common -y

Read more »


Quick Guide to Ubuntu Package Management

To see installed packages from your system run:

sudo apt --installed list

To update (re-syncronize the package index files from their sources) the list of packages to be installed run:

Read more »