Configuring FCoE in Linux RHEL and HP FlexFabric

– First step is to identify Ethernet NIC’s and CNA that will pass FCoE traffic and thi is done by collecting information about MAC adresses.
– Installation of both of packages : fcoe-utils and lldpad
yum install fcoe-utils lldpad
– Load the driver bnx2fc
modprobe bnx2fc
– Renaming /etc/fcoe/cfg-ethx file to the name of the CNA, in our case it is eth2 :
cp /etc/fcoe/cfg-ethx /etc/fcoe/cfg-eth2
cat > /etc/fcoe/cfg-eth2 /etc/sysconfig/network-scripts/ifcfg-eth2<EOF
The MTU is set to 9000 because FC payload is 2,112 bytes jumbo frames must be turned on to
avoid unnecessary IP fragmentation
– Run ifup to bring FCoE interface up
ifup eth2
– Run fcoeadm -i to check all created FCoE interfaces and status.
– Run cat /proc/scsi/scsi to see the luns

Configuring FCoE in Linux RHEL and HP FlexFabric

How to Install Docker on Ubuntu 14.04 LTS

Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating-system-level virtualization on Linux. Docker uses resource isolation features of the Linux kernel such as cgroups and kernel namespaces to allow independent “containers” to run within a single Linux instance, avoiding the overhead of starting virtual machines.

Here some tips for installing docker on an Ubuntu 14.04 LTS.

Let’s install docker :
apt-get -y install

Let’s fix link and path :
ln -sf /usr/bin/ /usr/local/bin/docker
sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/

And finally configure docker to start when the server boot :
update-rc.d defaults

Of course we search container that contains ubuntu by search token
docker search ubuntu

And we install it
docker pull ubuntu

How to Install Docker on Ubuntu 14.04 LTS

SRE engineer Bookmarks

I’m Linux system engineer and I develop in Python, Bash and Perl. I’m really interested by SRE position for that, I’m applying for SRE Engineer in Google and production Engineer in facebook. and here I share my daily bookmarks :


SRE engineer Bookmarks

Installing smog mongodb viewer

First of all install dependency packages
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev

Install Node.js & NPM
git clone
cd node

Run git tag to show all available versions
git tag -l

select the latest stable.
git checkout v0.9.9

Run configure and make
sudo make install

Get npm Node package manager using curl
curl | sudo sh

Install smog using node package manager by running
npm install smog -g

Start smog on background:

smog will start on default port 8080

Installing smog mongodb viewer

How to create an Apache Module

1. Use apxs2 to create a skeleton module named mod_hello:
apxs2 -g -n hello

2. Modify the automatically generated mod_hello.c file:
3. Run make and install the .so file into Apache’s libexec directory
apxs2 -iac mod_hello.c
4. Modify httpd.conf to load the module and to install it as the content handler for the URL of your choice:

# httpd.conf
LoadModule hello_module libexec/

<Location /hello_demo>
SetHandler hello

How to create an Apache Module

How to deploy PHP/MySQL web application with several external dependancies, across multiple Linux platforms

If you would create a deployment system for PHP/MySQL web application with several external dependancies, across multiple *nix platforms usually you can use rsync or may be scp, git, and pear for dependencies and some custom scripts.

In the fact, there are a nice solution and interesting one based on three tools : capistrano, jenkins and composer

Capistrano to deploy project to remote servers and be able to rollback when screw up.
Capistrano is a nice ruby application that can perform pre and post-deploy functions like restarting webserver, busting cache, renaming files, running database migrations, with capistrano we can easily copy code from source ( control repository ) to production server.

Capistrano by itself isn’t enough to make my deployment complete, that why my capistrano script will runs composer on the app to gather dependencies.

First , you can get capistrano using gem like that:
sudo gem install capistrano
sudo gem install capistrano-ext

You may get composer using git like this, run :
git clone

In general, you’ll use Capistrano as follows:

You will create a recipe file (“capfile” or “Capfile”) usgin capify command line as follow :
capify .
This will create config directory and a deploy.rb file that we will edit
vim confing/deploy.rb

deploy.rb is ruby file with a very simple syntax, here is my recipe file that i use to deploy my blog:

set :application, "blog"
#You probably want to change this to be the location of the repo you just forked
set :repository,  "git://"

set :php_bin, "/usr/bin/php"

#The following is not the document root, but just the app root 
set :deploy_to, "/home/mezgani/www/#{application}/"

set :current, "/home/mezgani/www/#{application}/current"

role :web, "server1", "server2"                          # Your HTTP server, Apache/etc
role :app, "server1", "server2"                          # This may be the same as your `Web` server
role :db,  "database-server", :primary => true # This is where Rails migrations will run
role :db,  "database-server"

set :local_path, "/home/mezgani/config/wordpress/config"

# SSH Settings
set :user, "mezgani"
#set :password, "password"
ssh_options[:keys] = %w(/home/user/.ssh/id_rsa) # SSH key
ssh_options[:port] = 22

#things you'll probably not change, unless you know what you're doing 
# If you aren't using Subversion to manage your source code, specify
# your SCM below:
# set :scm, :subversion
set :scm, :git

#the following is needed because if it's not there, for some reason we don't get
#asked to accept the key from github..annoying when deploying to a new server
default_run_options[:pty] = true

#since this is PHP, we don't really need to restart apache or anything
set :use_sudo, true 

#ssh agent forwarding..
ssh_options[:forward_agent] = true

#A lot of this stuff has been overridden for PHP/Non Rails magic

namespace :deploy do
  task :default do
  task :finalize_update, :except => { :no_release => true } do
    run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
    run "cp -fr #{current}/wp-content #{shared_path}/"
    run "cp #{current}/.htaccess #{shared_path}/"
    run "cp #{current}/wp-config.php #{shared_path}/configs/"
    run "cp #{shared_path}/configs/wp-config.php #{latest_release}/"
    run "cp -fr #{shared_path}/wp-content #{latest_release}/"
    run "chmod -R 777 #{latest_release}/wp-content"
    run "cp #{shared_path}/.htaccess #{latest_release}/"

task :composer do
  top.upload("#{local_path}/composer.json", "#{shared_path}/install", {:via => :scp, :recursive => true})
  run "cd #{shared_path}/install && curl -s | #{php_bin}"
  run "cd #{shared_path}/install && ./composer.phar install"

task :setup do
  run "sudo apt-get install curl"
  run "mkdir #{shared_path}/"
  run "mkdir #{shared_path}/install/"
  run "mkdir #{shared_path}/configs/"
  set(:wp_environment_ready, Capistrano::CLI.ui.ask("Is wp-config.php ready for this environment? (yes/no): "))
  if wp_environment_ready == 'yes'
    #top.upload("htdocs/wp-config.php", "#{shared_path}/configs/wp-config.php", :via => :scp)
    run "cp #{deploy_to}/wp-config.php #{shared_path}/configs/wp-config.php "
  run "mkdir #{shared_path}/wp-content"
  run "mkdir #{shared_path}/wp-content/uploads"

Before deploy we have to define a composer.json file that defines all
the dependencies my application has, whether they’re composer enabled or not.

Edit composer.json, specify your dependencies and run composer on capistrano to get the dependencies:
vim composer.json

Finally, use the cap script to execute your recipe. Use the cap script as follows:
cap deploy

How to deploy PHP/MySQL web application with several external dependancies, across multiple Linux platforms

Upgrade FreeBSD 8.1 to 9.0 stable release

For upgrading my FreeBSD box i use the binary freebsd-update. Well, i logged as root and i type:

# freebsd-update upgrade -r 9.0-RELEASE
# freebsd-update fetch
# freebsd-update install
# reboot

The system will reboot with the new kernel after the reboot, run freebsd-update install again
to install userland components and rebbot

# freebsd-update install
# reboot

You also need to update all packages, type:
# portsnap fetch update
# pkg_version -vIL=
# portupgrade -a

Upgrade FreeBSD 8.1 to 9.0 stable release