Skip to content

Posts from the ‘Linux Tutorials’ Category

10
Feb

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.

10
Feb

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:

BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='10.0.1.31/24'
MTU=''
NAME='82540EM Gigabit Ethernet Controller'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'

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

default 10.0.1.1 -	-

Edit /etc/resolv.conf and add:

nameserver 10.0.1.1

Then we need to restart network service:

service network restart
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

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

Compile the latest version of ImageMagick

Read more »

23
Jul

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: centos.mirrors.ovh.net
 * epel: epel.mirrors.ovh.net
 * extras: centos.mirrors.ovh.net
 * updates: centos.mirrors.ovh.net
=== 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.

/usr/bin/mysql_secure_installation
29
Jun

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
  address 10.0.0.2
  broadcast 10.0.0.255
  netmask 255.255.255.0
  post-up route add default gw 10.0.0.1
  pre-down route del default gw 10.0.0.1
 
dns-nameservers 10.0.1.1

Last thing to do is to restart network services.

service networking restart
28
Jun

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.

28
Jun

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 »

22
Jun

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 »

22
Jun

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 »

8
Jun

Quick Guide to Ubuntu Package Management

To see installed packages from your system run:

sudo apt --installed list

or

$ apt list --installed | grep clang
 
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
 
clang-4.0/zesty,now 1:4.0-1ubuntu1 amd64 [installed]
libclang-3.8-dev/zesty,now 1:3.8.1-18ubuntu1 amd64 [installed]
libclang-common-3.8-dev/zesty,now 1:3.8.1-18ubuntu1 amd64 [installed,automatic]
libclang-common-4.0-dev/zesty,now 1:4.0-1ubuntu1 amd64 [installed,automatic]
libclang1-3.8/zesty,now 1:3.8.1-18ubuntu1 amd64 [installed,automatic]
libclang1-4.0/zesty,now 1:4.0-1ubuntu1 amd64 [installed,automatic]

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

Read more »