Avr 10

Notes à trier

1/ Sous Simple Hosting, rebase un repo distant :

[~/ODOO] ➔ git pull --rebase origin master

2/ Pour changer les messages de gcc en anglais :

LC_MESSAGES=C make

3/ Rediriger les erreurs :

find -name "*" -exec grep "timezone" {} \; -print 2>/dev/null

4/ Git en anglais :

alias git='LANG=en_US.UTF-8 git'

5/ Supprimer l’historique bash :

cat /dev/null > ~/.bash_history && history -c && exit

Sep 22

[Gandi] [Simple Hosting] Génération de la ‘Demande de Signature de Certificat’ / ‘Certificate Signing Request’ (CSR)

[Gandi] [Simple Hosting] Génération de la ‘Demande de Signature de Certificat’ / ‘Certificate Signing Request’ (CSR).

1/ Connexion sur l’instance Simple Hosting via la console ‘ssh‘ :

[~] ➔ ssh 7555491@console.dc0.gpaas.net
Asking for console, please wait
Connected

Grabbing terminal
Ok
Press [Enter] to start a shell

hosting-user@testssl:/srv/data$ 

Lien :
https://wiki.gandi.net/fr/simple/console

2/ Se déplacer dans le répertoire temporaire ‘/srv/data/tmp/‘ :

hosting-user@testssl:/srv/data$ cd /srv/data/tmp/
hosting-user@testssl:/srv/data/tmp$ 

3/ Génération de la ‘Demande de Signature de Certificat‘ / ‘Certificate Signing Request‘ (CSR) :

Informations à indiquer dans la ligne de commande ‘openssl’ :

Chiffrement : SHA2
Clé RSA : 2048
Common Name : framboisepi.info = Nom de domaine à protégé

Soit :

hosting-user@testssl:/srv/data/tmp$ openssl req -nodes -newkey rsa:2048 -sha256 -keyout framboisepi.info.key -out framboisepi.info.csr
Generating a 2048 bit RSA private key
.............................+++
.......................................................................+++
writing new private key to 'framboisepi.info.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:FR
State or Province Name (full name) [Some-State]:Meurthe-et-Moselle
Locality Name (eg, city) []:Mexy
Organization Name (eg, company) [Internet Widgits Pty Ltd]:FramboisePi
Organizational Unit Name (eg, section) []: (ne rien mettre)
Common Name (e.g. server FQDN or YOUR name) []:framboisepi.info
Email Address []:lesanglierdesardennes@gmail.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: (ne rien mettre)
An optional company name []: (ne rien mettre)
hosting-user@testssl:/srv/data/tmp$ 

4/ Vérification que les fichiers ont été correctement généré :

hosting-user@testssl:/srv/data/tmp$ ls -l framboisepi.info.*
-rw-rw-rw- 1 hosting-user hosting-admin 1074 Sep 22 08:10 framboisepi.info.csr
-rw-rw-rw- 1 hosting-user hosting-admin 1708 Sep 22 08:10 framboisepi.info.key

5/ Afficher le contenu du fichier ‘.csr’ :

hosting-user@testssl:/srv/data/tmp$ cat framboisepi.info.csr 
-----BEGIN CERTIFICATE REQUEST-----
666C4DCCAcgCAQAwgZoxCzAJBgNVBAYTAkZSMRswGQYDVQQIDBJNZXVydGhlLWV0
LU1vc2VsbGUxDTALBgNVBAcMBE1leHkxFDASBgNVBAoMC0ZyYW1ib2lzZVBpMRkw
FwYDVQQDDBBmcmFtYm6662VwaS5pbmZvMS4wLAYJKoZIhvcNAQkBFh9sZXNhbmds
aWVyZGVzYXJkZW5uZXNAZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
MIIBCgKCAQEA4Czntvdg2Z7yV6aNPlj1Rag44c1/bKCbxJD0zt5AuZHnD0+qkNW2
wcJCKCKPTB1OV5vFfu6NCzQ35gmKm8+RFKNDvcggRS+zL666LVfJCP8eNQ0YF+th
GmAqWTOsIrxyxRIZiKfNV6UDtqXt46idOH5Wz5BYs1IQdzU0oHF+LTABFWJ6pN1J
DUQLO7tyHYnNnlcfULW3OF8CuHeSax7yN0lN1I0nS/meS4SKrlzTI6uC5XbmwREl
zAGHv666h3MBg/tjA+8lYFQs/yiPXbGWkMJnf3LcNdx9zhNb4Bdg1Qp8OuWZmkin
Gpg8/a1JztIcy7WcBZ3UxK6SKH0V0VcrIwIDAQABoAAwDQYJKoZIhvcNAQELBQAD
ggEBAKVKVTBt5gMJ9FbFM0pIuw63kZl9ZrdSfa177irbJhSYrv5Jg6m3TJ6OEdkC
2S9K4B8MYKvTqMjvl4mqDl0666UTqA7mc/DOOrmX7lDRNiLRE88wdl5rBlS6e6uE
9p+fNLhCC0ufbgUtnVtRgg+3C3DeJ5B9m80mOviff4i+XDQBslm1JCrYD7pBoV5Q
3MwSmJSaa567yyhoJlva2soV2SL1OnooYvmuMVtWWBn9SiVGU5T6666djoTy8D+/
vKqPIfS/F3p/aHecuOOzju5rzquF6UTv8PO7FNrz3ifsugYsUI7dJ956ThjAH9sn
sACDM3DB5fAXrMtMlpcYFVRfctI=
-----END CERTIFICATE REQUEST-----

6/ Téléchargement des fichiers générés via le logiciel Filezilla :

Site officiel : https://filezilla-project.org/
Utilisation de Filezilla : https://wiki.gandi.net/fr/simple/sftp/filezilla

Répertoire SFTP où se trouve les fichiers :

/lamp0/tmp

7/ Liens :

https://wiki.gandi.net/fr/ssl/csr
http://rockstarninja.tech/gandiserveur-generation-des-certificats-ssl/

Sep 09

[Gandi] [Serveur] Installation de DevStack

[Gandi] [Serveur] Installation de DevStack.

Caractéristique du serveur Gandi :

Distribution : Ubuntu 14.04 64 bits LTS (HVM)
Kernel : 3.18-x86_64 (hvm)
Coeur : 4
Ram : 8192 Mo
Disque : 20 Go

1/ Mise-à-jour de la distribution :

administrateur@server01:~$ su
Password: 
root@server01:/home/administrateur# 
root@server01:/home/administrateur# apt-get update && apt-get upgrade

2/ Installation des paquets de base :

root@server01:/home/administrateur# apt-get install vim screen htop links dnsutils git-core sudo
root@server01:/home/administrateur# exit
exit
administrateur@server01:~$ 

3/ Téléchargement de Devstack via le dépôt d’OpenStack :

administrateur@devstack:~$ git clone https://git.openstack.org/openstack-dev/devstack

4/ Copie du fichier de configuration de base :

administrateur@devstack:~$ cp devstack/samples/local.conf devstack/

5/ Configuration du mot de passe dans le fichier de configuration :

Ouvrir :

devstack/local.conf

Chercher :

ADMIN_PASSWORD=nomoresecret
DATABASE_PASSWORD=stackdb
RABBIT_PASSWORD=stackqueue
SERVICE_PASSWORD=$ADMIN_PASSWORD

Remplacer par :

ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD

6/ Création de l’utilisateur ‘stack‘ :

administrateur@server01:~$ su
Password: 
root@server01:/home/administrateur# 
root@server01:/home/administrateur# devstack/tools/create-stack-user.sh
Creating a group called stack
Creating a user called stack
Giving stack user passwordless sudo privileges
root@server01:/home/administrateur# 

7/ Basculement vers l’utilisateur ‘stack‘ :

root@server01:/home/administrateur# su stack
stack@server01:/home/administrateur$ 

8/ Copie du répertoire ‘devstack/‘ vers le répertoire de l’utilisateur ‘stack‘ :

stack@server01:/home/administrateur$ cp -R devstack ~/  

9/ Changement vers le répertoire de l’utilisateur ‘stack‘ :

stack@server01:/home/administrateur$ cd ~/devstack
stack@server01:~/devstack$ 

10/ Installation de ‘DevStack‘ :

stack@server01:~/devstack$ ./stack.sh 
...
=========================
DevStack Component Timing
=========================
Total runtime         1267

run_process            56
test_with_retry         2
apt-get-update          3
pip_install           291
restart_apache_server  10
wait_for_service       13
git_timed             237
apt-get               157
=========================



This is your host IP address: 95.146.166.156
This is your host IPv6 address: 2001:4b96:dc0:46:216:6eff:fe65:6fc0
Horizon is now available at http://95.146.166.156/dashboard
Keystone is serving at http://95.146.166.156/identity/
The default users are: admin and demo
The password: secret
stack@server01:~/devstack$ 

11/ Capture d’écran :

– Connexion sur l’interface d’administration de Horizon :

openstack01

openstack02

– Hyperviseur Qemu :

openstack03

12/ Lien :

https://oliverveits.wordpress.com/2016/06/21/getting-started-with-openstack-using-devstack/

Sep 08

[Gandi] [Simple Hosting] Tirer/pousser (pull/push) des modifications

[Gandi] [Simple Hosting] Tirer/pousser (pull/push) des modifications.

1/ Répertoire de travail :

[~] ➔ mkdir NODEJS-example-clone
[~] ➔ cd NODEJS-example-clone 
[~/NODEJS-example-clone] ➔ 

2/ Création du répertoire de l’application :

[~/NODEJS-example-clone] ➔ mkdir myapp
[~/NODEJS-example-clone] ➔ cd myapp/
[~/NODEJS-example-clone/myapp] ➔ 

3/ Initialiser le dépôt git local :

[~/NODEJS-example-clone/myapp] ➔ git init .
Initialized empty Git repository in /home/sam/NODEJS-example-clone/myapp/.git/

4/ Ajout et/ ou modification de fichier.

5/ Etat du dépôt :

[~/NODEJS-example-clone/myapp] ➔ git status
On branch master

Initial commit

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	CHANGELOG

nothing added to commit but untracked files present (use "git add" to track)

6/ Ajout de la branche distance du dépôt distant :

[~/NODEJS-example-clone/myapp] ➔ git remote add gandi git+ssh://935763@git.dc2.gpaas.net/default.git

7/ Récupérer les fichiers :

[~/NODEJS-example-clone/myapp] ➔ git pull --rebase gandi master
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 10 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (10/10), done.
From git+ssh://git.dc2.gpaas.net/default
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> gandi/master

8/ Etat du dépôt :

[~/NODEJS-example-clone/myapp] ➔ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	CHANGELOG

nothing added to commit but untracked files present (use "git add" to track)

9/ Ajout du ou des fichiers :

[~/NODEJS-example-clone/myapp] ➔ git add -A
[~/NODEJS-example-clone/myapp] ➔ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	new file:   CHANGELOG

10/ Committer les changements :

[~/NODEJS-example-clone/myapp] ➔ git commit -m "Add changelog"
[master 6916245] Add changelog
 1 file changed, 2 insertions(+)
 create mode 100644 CHANGELOG

11/ Pousser les changements :

[~/NODEJS-example-clone/myapp] ➔  git push gandi master 
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 297 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To git+ssh://935763@git.dc2.gpaas.net/default.git
   81444f8..6916245  master -> master

12/ Déployer l’application :

[~/NODEJS-example-clone/myapp] ➔  ssh 935763@git.dc2.gpaas.net 'deploy default.git'
initializing builder
..............builder ready
Vm password: 
Grabbing terminal
Ok
-----> Starting new deployment (default - master)
-----> Fetching application code
-----> Building new application
mkdir: cannot create directory '/dev/null': Not a directory
mkdir: cannot create directory '/dev/null': Not a directory
Found '/tmp/build.fVk3iGGdnU/.nvmrc' with version <4.4>
v4.4.7 is already installed.
Now using node v4.4.7 (npm v2.15.8)
express@4.14.0 node_modules/express
├── array-flatten@1.1.1
├── escape-html@1.0.3
...
node_modules/express/node_modules/vary/
node_modules/express/node_modules/vary/package.json

sent 107,508 bytes  received 1,186 bytes  217,388.00 bytes/sec
total size is 1,184,631  speedup is 10.90
sending incremental file list
.nvmrc
CHANGELOG
Procfile
README.md
app.json
index.js
package.json
public/node.svg

sent 3,573 bytes  received 177 bytes  7,500.00 bytes/sec
total size is 2,971  speedup is 0.79
-----> Build complete
-----> Cleaning temporary files
[~/NODEJS-example-clone/myapp] ➔ 

14/ Historique des changements :

[~/NODEJS-example-clone/myapp] ➔ git log

commit 8ac470d98c4be6821586a3baf29a952de763579a
Author: samuel.gondouin <samuel.gondouin@gandi.net>
Date:   Thu Sep 8 11:53:26 2016 +0200

    Update index

commit 6916245741a915483e07d73c8bcd258fb15f3f43
Author: samuel.gondouin <samuel.gondouin@gandi.net>
Date:   Thu Sep 8 11:49:58 2016 +0200

    Add changelog

commit 81444f8c3203cdf5aa949fbd1f51a58cc5735c1f
Author: samuel.gondouin <samuel.gondouin@gandi.net>
Date:   Thu Sep 8 09:40:00 2016 +0200

    Version 0.0.1

13/ Test

http://5e6a5d6b83.testurl.ws/

Sep 08

[Gandi] [Simple Hosting] Installation d’une application Nodejs de base avec Expressjs

[Gandi] [Simple Hosting] Installation d’une application Nodejs de base avec Expressjs.

1/ Répertoire de travail :

[~] ➔ mkdir NODEJS-example
[~] ➔ cd NODEJS-example/

2/ Téléchargement de l’exemple :

[~/NODEJS-example] ➔ git clone https://github.com/Nekrofage/nodejs-example.git
Cloning into 'nodejs-example'...
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 10 (delta 0), reused 10 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), done.
Checking connectivity... done.
[~/NODEJS-example] ➔ cd nodejs-example/
[~/NODEJS-example/nodejs-example] ➔

3/ Ajout de la branche distante de l’instance :

[~/NODEJS-example/nodejs-example] ➔ git remote add gandi git+ssh://935763@git.dc2.gpaas.net/default.git

4/ Pousser les modifications vers le gitweb de l’instance :

[~/NODEJS-example/nodejs-example] ➔ git push gandi master 
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (10/10), 2.17 KiB | 0 bytes/s, done.
Total 10 (delta 0), reused 0 (delta 0)
To git+ssh://935763@git.dc2.gpaas.net/default.git
 * [new branch]      master -> master

5/ Déploiement de l’application Nodejs vers l’instance :

[~/NODEJS-example/nodejs-example] ➔ ssh 935763@git.dc2.gpaas.net 'deploy default.git'
initializing builder
.................builder ready
Vm password: 
Grabbing terminal
Ok
-----> Starting new deployment (default - master)
-----> Fetching application code
-----> Building new application
N/A: version "N/A" is not yet installed.

You need to run "nvm install N/A" to install it before using it.
mkdir: cannot create directory '/dev/null': Not a directory
mkdir: cannot create directory '/dev/null': Not a directory
Found '/tmp/build.6XSSzzTFEV/.nvmrc' with version <4.4>
Downloading https://nodejs.org/dist/v4.4.7/node-v4.4.7-linux-x64.tar.xz...
######################################################################## 100.0%
Now using node v4.4.7 (npm v2.15.8)
Creating default alias: default -> 4.4 (-> v4.4.7 *)
express@4.14.0 node_modules/express
├── escape-html@1.0.3
├── array-flatten@1.1.1
├── cookie-signature@1.0.6
...
├── type-is@1.6.13 (media-typer@0.3.0, mime-types@2.1.11)
└── accepts@1.3.3 (negotiator@0.6.1, mime-types@2.1.11)
-----> Copying new application
sending incremental file list
node_modules/
node_modules/express/
node_modules/express/History.
...
node_modules/express/node_modules/vary/HISTORY.md
node_modules/express/node_modules/vary/LICENSE
node_modules/express/node_modules/vary/README.md
node_modules/express/node_modules/vary/index.js
node_modules/express/node_modules/vary/package.json

sent 1,203,159 bytes  received 5,716 bytes  483,550.00 bytes/sec
total size is 1,182,391  speedup is 0.98
sending incremental file list
.nvmrc
Procfile
README.md
app.json
index.js
package.json
public/
public/node.svg

sent 3,480 bytes  received 161 bytes  7,282.00 bytes/sec
total size is 2,939  speedup is 0.81
-----> Build complete
-----> Cleaning temporary files
[~/NODEJS-example/nodejs-example] ➔

7/ Test :

http://5e6a5d6b83.testurl.ws/

8/ Lien :

https://github.com/Nekrofage/nodejs-example

Août 19

Installation de VirtualBox 5.1

Installation de VirtualBox 5.1.

1/ Détection de la version d’Ubuntu de l’ordinateur de travail :

$ cat /etc/issue
Ubuntu 15.10 \n \l

$ lsb_release -c
Codename:	wily

2/ Ajouter le dépôt de VirtualBox :

Ouvrir :

/etc/apt/sources.list

Ajouter :

# According to your distribution, replace 'xenial' by 'vivid', 'utopic', 'trusty', 'raring', 'quantal', 'precise', 'lucid', 'jessie', 'wheezy' or 'squeeze'. 
# 
deb http://download.virtualbox.org/virtualbox/debian wily contrib

3/ Ajouter les clés :

$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

4/ Mise-à-jour de la distribution :

$ sudo apt-get update

5/ Installation de Virtualbox :

$ sudo apt-get install virtualbox-5.1

6/ Ajout de module pour le noyau Linux :

$ sudo apt-get install dkms

7/ Lien :

https://www.virtualbox.org/wiki/Linux_Downloads

Articles plus anciens «