Friday 7 September 2018

HOWTO IMPORT OVA (from VMware) to PROXMOX 5.x



 HOWTO IMPORT OVA (from VMware) to PROXMOX 5.x


        Hi All may be someone has faced to import an OVA (created with VMware) to PROXMOX one time. I have created two scripts :

The first one is checking proxmox's iso folder to see if ova file are there. The second  convert and import the OVA file into proxmox and you can start the KVM VM.

Both are launch separately !

IT can be better I'm in the beginning , so feel free to help me imrove thess scripts.

Don't hesitate to contact me, IT will be a pleasure to help you.

The script are available on GIT HUB so you can help me to create better version with
more integration with proxmox.

https://github.com/ksondjah/masa-dounougnan

Thanks !




Monday 26 March 2018

HOWTO INSTALL HYPERLEDGER FABRIC 1.1.0-rc1 ON UBUNTU 16.04.x + APPLICATION EXAMPLE.



Thank you to be here in my blog. This how to install Hyperledger Fabric 1.1.0-rc1 on Ubuntu 16.04.x. I saw many tutorials about this Solution but most of the time I failed to install successfully the Fabric (maybe I messed up something). Here is the way I found to achieve my goals. Let’s go.

1.       Following prerequisites are required to install the Fabric.

Latest version of cURL and dev libraries
Latest version of Docker & Docker compose (docker v1.12.x or higher)
Latest version of Go-Lang (Go - Programming Language)
Python v2.7
Node JS v6.x (Currently v7.x not supported)

You must be root for topics 2 to 6. After will create a user and at 6.1 will do “sudo” for the rest of the tutorial.

2.       Fisrt Update

$ apt update

3.       Install Curl

$ apt install curl

4.       Install libtool

$ apt-get install libltdl-dev

5.       Install latest docker and docker compose

$ apt-get install docker.io docker-compose

Chreck the version :

$ docker --version

$ docker-compose --version


6.       Install Go Language

$ sudo apt install golang-go

6.1   Create a User

$ useradd –m –c “Fabric DEV User”    yourusername



Put the current user in docker group

$ sudo usermod -a -G docker yourusername
$ sudo su - yourusername


Export the environment variables (put it in user bash profile):

$ vi
$ vi .bashrc

export GOPATH=$HOME/gopath
export PATH=$PATH:/usr/local/go/bin

to test it enter:

$ go
Go is a tool for managing Go source code.

Usage:

     go command [arguments]

The commands are:

     build       compile packages and dependencies
     clean       remove object files
     doc         show documentation for package or sy


etc.

7.       Installation of NODEJS


$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

$ sudo apt-get install -y nodejs

Note: Ensure nodejs version is 6.x

$ nodejs –v

Installing Node.js will also install NPM,
Upgrade the npm tool with the following command:
 
$ sudo npm install npm@3.10.10 -g


8 Install Python 2.7

Pyhton maybe already installed, if not do :

$ apt install python

Check version :

 $ python --version


8.       Hyperledger Fabric Installation

First , create folders for the fabric

$ mkdir -p $GOPATH/src/github.com/hyperledger/
$ cd $GOPATH/src/github.com/hyperledger/ 
Remove all previous images from docker :
$ docker rm -f $(docker ps -aq)

Second you must download the Fabric, it can take time depending of your connection speed

$ curl -sSL https://goo.gl/6wtTN5 | bash -s 1.1.0-rc1

You ‘ll find after download two folder “bin” and “config”

hypledge@vps520804:~/gopath/src/github.com/hyperledger$ ll
total 20
drwxrwxr-x  5 hypledge hypledge 4096 Mar 22 10:48 ./
drwxrwxr-x  3 hypledge hypledge 4096 Mar 21 23:32 ../
drwxrwxr-x  2 hypledge hypledge 4096 Mar  2 00:29 bin/
drwxrwxr-x  2 hypledge hypledge 4096 Mar  1 20:58 config/

Put in your path the following environnement variables. The fabric will need these binaries to work

You ‘ll find these files and more in bin folder:
- cryptogen
 - configtxgen
 - configtxlator
 - peer

Edit user bash profile “.bashrc”:

Replace  : export PATH=$PATH:/usr/local/go/bin

By

 export PATH=$PATH:/usr/local/go/bin:$HOME/gopath/src/github.com/hyperledger/bin

To see all images has been downloaded correctly enter:

hypledge@vps520804:~$ docker images
REPOSITORY                                                                                               TAG                 IMAGE ID            CREATED             SIZE
dev-peer0.org1.example.com-fabcar-1.0-5c906e402ed29f20260ae42283216aa75549c571e2e380f3615826365d8269ba   latest              bc2eee0b277c        4 days ago          172 MB
<none>                                                                                                   <none>              6d9799ae1d8e        4 days ago          1.26 GB
hyperledger/fabric-ca                                                                                    latest              8a6c8c2e2ebf        3 weeks ago         283 MB
hyperledger/fabric-ca                                                                                    x86_64-1.1.0-rc1    8a6c8c2e2ebf        3 weeks ago         283 MB
hyperledger/fabric-tools                                                                                 latest              006c689ec08e        3 weeks ago         1.46 GB
hyperledger/fabric-tools                                                                                 x86_64-1.1.0-rc1    006c689ec08e        3 weeks ago         1.46 GB
hyperledger/fabric-orderer                                                                               latest              10afc128d402        3 weeks ago         180 MB
hyperledger/fabric-orderer                                                                               x86_64-1.1.0-rc1    10afc128d402        3 weeks ago         180 MB
hyperledger/fabric-peer                                                                                  latest              6b44b1d021cb        3 weeks ago         187 MB
hyperledger/fabric-peer                                                                                  x86_64-1.1.0-rc1    6b44b1d021cb        3 weeks ago         187 MB
hyperledger/fabric-javaenv                                                                               latest              ea263125afb1        3 weeks ago         1.52 GB
hyperledger/fabric-javaenv                                                                               x86_64-1.1.0-rc1    ea263125afb1        3 weeks ago         1.52 GB
hyperledger/fabric-ccenv                                                                                 latest              65c951b9681f        3 weeks ago         1.39 GB
hyperledger/fabric-ccenv                                                                                 x86_64-1.1.0-rc1    65c951b9681f        3 weeks ago         1.39 GB
hyperledger/fabric-baseimage                                                                             x86_64-0.4.6        dbe6787b5747        5 weeks ago         1.37 GB
hyperledger/fabric-zookeeper                                                                             latest              92cbb952b6f8        5 weeks ago         1.39 GB
hyperledger/fabric-zookeeper                                                                             x86_64-0.4.6        92cbb952b6f8        5 weeks ago         1.39 GB
hyperledger/fabric-kafka                                                                                 latest              554c591b86a8        5 weeks ago         1.4 GB
hyperledger/fabric-kafka                                                                                 x86_64-0.4.6        554c591b86a8        5 weeks ago         1.4 GB
hyperledger/fabric-couchdb                                                                               latest              7e73c828fc5b        5 weeks ago         1.56 GB
hyperledger/fabric-couchdb                                                                               x86_64-0.4.6        7e73c828fc5b        5 weeks ago         1.56 GB
hyperledger/fabric-baseos                                                                                x86_64-0.4.6        220e5cf3fb7f        5 weeks ago         151 MB
hyperledger/fabric-baseimage                                                                             x86_64-0.3.2        c92d9fdee998        7 months ago        1.26 GB
hyperledger/fabric-baseos 


ok you are done with the fabric. Now let’s install the Fabric Sample.

$ cd $GOPATH/src/github.com/hyperledger/ 
$ git clone https://github.com/hyperledger/fabric-samples.git
$ cd fabric-samples
$ cd fabcar
$ ls
enrollAdmin.js  hfc-key-store  invoke.js  node_modules  package.json  query.js  registerUser.js  startFabric.sh

Now launch the fabric application sample :

$./startFabric

We need to install node SDK for Hyperledger so that we can run the node modules in this example
 
$ npm install

At end enter :

$ node enrollAdmin.js
$ node registerUser

Results :
hypledge@vps520804:~/gopath/src/github.com/hyperledger/fabric-samples/fabcar$ node enrollAdmin.js
 Store path:/home/hypledge/gopath/src/github.com/hyperledger/fabric-samples/fabcar/hfc-key-store
Successfully enrolled admin user "admin"
Assigned the admin user to the fabric client ::{"name":"admin","mspid":"Org1MSP","roles":null,"affiliation":"","enrollmentSecret":"","enrollment":{"signingIdentity":"5dbc7fe466d5ad94bcfdad849b4fa1be2aa7481367d49cb41b08cf571ed46879","identity":{"certificate":"-----BEGIN CERTIFICATE-----\nMIICAjCCAaigAwIBAgIUQAYiw6LEzUl97OxkdcpGMNS9guEwCgYIKoZIzj0EAwIw\nczELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh\nbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMT\nE2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTgwMzI2MTA0NTAwWhcNMTkwMzI2MTA1\nMDAwWjAhMQ8wDQYDVQQLEwZjbGllbnQxDjAMBgNVBAMTBWFkbWluMFkwEwYHKoZI\nzj0CAQYIKoZIzj0DAQcDQgAEQV7GNIU41Y8q0j8y6/R/h3o4MK1SUY9yVNwC/FLB\nE360gj78PHQp697Hmi+MPMA4SVmt5YbYy8GzIxQv9Kb9U6NsMGowDgYDVR0PAQH/\nBAQDAgeAMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFI91gBAuXWnOcKdiERHJCMGr\njkwxMCsGA1UdIwQkMCKAIEI5qg3NdtruuLoM2nAYUdFFBNMarRst3dusalc2Xkl8\nMAoGCCqGSM49BAMCA0gAMEUCIQCCk68DhdccnYGtQ9oVJ62BZelN5I21VAr+OSgH\nAgnOfwIgf4TBQkeUjOf3vv2Gc1UX+FER+Te+v4roMPoI5N7C49A=\n-----END CERTIFICATE-----\n"}}}

hypledge@vps520804:~/gopath/src/github.com/hyperledger/fabric-samples/fabcar$ node registerUser.js
 Store path:/home/hypledge/gopath/src/github.com/hyperledger/fabric-samples/fabcar/hfc-key-store
Successfully loaded admin from persistence
Successfully registered user1 - secret:uTvVwmXGpuWi
Successfully enrolled member user "user1"
User1 was successfully registered and enrolled and is ready to intreact with the fabric network
hypledge@vps520804:~/gopath/src/github.com/hyperledger/fabric-samples/fabcar$

You can now query the app by:

$ node query.js

Results:
hypledge@vps520804:~/gopath/src/github.com/hyperledger/fabric-samples/fabcar$ node query.js
Store path:/home/hypledge/gopath/src/github.com/hyperledger/fabric-samples/fabcar/hfc-key-store
Successfully loaded user1 from persistence
Query has completed, checking results
Response is  [{"Key":"CAR0", "Record":{"colour":"blue","make":"Toyota","model":"Prius","owner":"Tomoko"}},{"Key":"CAR1", "Record":{"colour":"red","make":"Ford","model":"Mustang","owner":"Brad"}},{"Key":"CAR2", "Record":{"colour":"green","make":"Hyundai","model":"Tucson","owner":"Jin Soo"}},{"Key":"CAR3", "Record":{"colour":"yellow","make":"Volkswagen","model":"Passat","owner":"Max"}},{"Key":"CAR4", "Record":{"colour":"black","make":"Tesla","model":"S","owner":"Adriana"}},{"Key":"CAR5", "Record":{"colour":"purple","make":"Peugeot","model":"205","owner":"Michel"}},{"Key":"CAR6", "Record":{"colour":"white","make":"Chery","model":"S22L","owner":"Aarav"}},{"Key":"CAR7", "Record":{"colour":"violet","make":"Fiat","model":"Punto","owner":"Pari"}},{"Key":"CAR8", "Record":{"colour":"indigo","make":"Tata","model":"Nano","owner":"Valeria"}},{"Key":"CAR9", "Record":{"colour":"brown","make":"Holden","model":"Barina","owner":"Shotaro"}}]
hypledge@vps520804:~/gopath/src/github.com/hyperledger/fabric-samples/fabcar$
 
if Node query failed ,do :
$ docker rm -f $(docker ps -aq)

And  after do a ./startFabric again


If you want to have more info about the SAMPLE APPLICATION “FABCAR” go to these links:



Thank you!

Monday 10 October 2016



ZIMBRA : Import Mail accounts from CSV file with ZMPROV in a Shell Bash Script.



There few things to change in the script. Depending of you CSV file.


In the picture above I have 4 columns in my CSV file. So in the script shell you must
identified the number of each colomns you need in your script.

So see the script below :

#!/bin/bash

while read LINE; do
 email=$(echo $LINE | awk -F ";" '{print $4}')
 fn=$(echo $LINE | awk -F ";" '{print $2}')
 ln=$(echo $LINE | awk -F ";" '{print $3}')

 echo -e "Importing All Accounts in  Zimbra .... $email\n"
 CMD=$(zmprov createAccount $email password displayName "${fn} ${ln}" givenName "${fn}" sn "${ln}")
 $CMD
 echo -e "Done !\n"

 echo "Modifying $email password…";
 CMD1=$(zmprov sp $email changeme1)
 $CMD1

 CMD2=$(zmprov ma $email zimbraPasswordMustChange TRUE)
 $CMD2
 echo -e "Modifying password is OK !\n";

done < /tmp/scripts/UserAccounts.csv

 echo "............... ALL OPERATIONS DONE ! ................"

If you have questions please feel free to ask !

Wednesday 27 August 2014

Simple useful vBScript : Search function and Create a folder

I have created this function to help my colleague for a problem. The goal
is to search and find a folder and finally create a folder inside. Simple but very useful
You can also modify to achieve your own goal.
It was tested on Windows 8.x , but must work on Windows 7 , Vista and XP, (Windows Server too)


'
'  Script Created by Lucky Chris ATTOH-TOURE - System & Virtualization Engineer
'  Search and find a folder | Create Folder  also
'  2014 - August 26
Public HiddenState

'Function  check folder attributes
Public Function CheckAttribute(ValueF)
 strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
 NewValue = Replace(ValueF,"\","\\")
 Set colFolders = objWMIService. _
    ExecQuery("Select * from Win32_Directory where name = '" + NewValue + "' ")

    For Each objFolder in colFolders 
       HiddenState = objFolder.Hidden
    if  (HiddenState = 0) then HiddenState = "False" Else HiddenState = "True"
    Next
   
End Function

'
Public Function ShowSubfolders(Folder)
   'Folder you want to find
   strFlag = "Documents"
   
  For Each Subfolder in Folder.SubFolders
    on error resume next
   
    Set fFolder = fso.GetFolder(Subfolder.Path)
    
 CheckAttribute(Subfolder.Path)
 if (((StrComp(Subfolder.Name, strFlag, vbTextCompare)) = 0) AND (HiddenState = "False"))then
   wscript.echo Subfolder.Path
   wscript.echo HiddenState
   If (fso.FolderExists(Subfolder.Path + "\\TESTFOLDER")) Then
    'wscript.echo "Le repertoire existe"
       wscript.quit
   else
       set r = fso.CreateFolder( Subfolder.Path + "\\TESTFOLDER")
   end if
   wscript.quit 
 end if
 
    if err.number <> 0 then wscript.echo err.description
    
 ShowSubfolders Subfolder
 
  Next
 
End Function

set fso = CreateObject("Scripting.FileSystemObject")

Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set oss = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")

For Each os in oss
          OSv = os.Version
Next

Set wshShell = CreateObject( "WScript.Shell" )
USERNAME = wshShell.ExpandEnvironmentStrings( "%USERNAME%" ) 

 OSv = Split(OSv,".")
 
'Windows Vista ,8 +  : OSv => OS Version
If (OSv(0) >= 6) then
 If (fso.FolderExists("C:\\Users\\" + USERNAME + "\\Documents")) Then
         'Put the initial folder or drive (C: or D:)
   ShowSubfolders fso.GetFolder("D:\")
 else
      set r = fso.CreateFolder( "C:\\Users\\" + USERNAME + "\\Documents")
   ShowSubfolders fso.GetFolder("D:\")
    end if
end if

Monday 12 May 2014

CONFIGURATION DE SENDMAIL EN RELAIS SMTP sur CENTOS 5.x



Installez « sendmail » si ce n’est déjà fait.
Yum install sendmail

Sinon nous avons 2 fichiers à éditer :
Sendmail.mc et sendmail.cf
Editons « sendmail.mc » et ajouter les lignes suivantes :



Comme on peut le voir nous avons utilisé le port 26 pour envoyer nos mails cela est possible grâce à la deuxième ligne « define ». Si le serveur smtp de destination utilise le port 25 cette ligne peut être effacée.
En suite nos modifierons le fichier « sendmail.cf » :
Trouvez la ligne commençons par « DS » et ajoutons le serveur de mail qui nous serveur smtp :

La dernière étape est de redémarrer sendmail :


 
Maintenant un test !
 mail -s "Objet du mail"   monadresse@email.com


HOWTO IMPORT OVA (from VMware) to PROXMOX 5.x

  HOWTO IMPORT OVA (from VMware) to PROXMOX 5.x         Hi All may be someone has faced to import an OVA (created with VMware) to PROX...