suite
This commit is contained in:
BIN
docs/.DS_Store
vendored
BIN
docs/.DS_Store
vendored
Binary file not shown.
@@ -19,8 +19,8 @@ bruno@macbook-pro:~/ git init
|
||||
|
||||
bruno@macbook-pro:~/ git remote -v
|
||||
|
||||
bruno@macbook-pro:~/ git remote add origin ssh:dsm916/volume1/Repositories/wp2012.git
|
||||
bruno@macbook-pro:~/ git remote add origin bruno@dsm916:/volume1/Repositories/wp2012.git
|
||||
#bruno@macbook-pro:~/ git remote add origin ssh:dsm916e/volume1/Repositories/wp2012.git
|
||||
bruno@macbook-pro:~/ git remote add origin bruno@dsm916e:/volume1/Repositories/wp2012.git
|
||||
|
||||
bruno@macbook-pro:~/ git add *
|
||||
|
||||
|
||||
205
docs/Divers/wp-cli/ovh.md
Normal file
205
docs/Divers/wp-cli/ovh.md
Normal file
@@ -0,0 +1,205 @@
|
||||
# Installer wp-cli sur un serveur ovh mutualisé
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Rappel: voici ce dont on a a accès lorsque que l'on se connecte en ssh:
|
||||
|
||||
```bash
|
||||
myuser@ssh1.300gp.ha.ovh.net (php/7.1/production/stable) ~ $ l
|
||||
total 2855
|
||||
drwxr-xr-x+ 14 myuser users 22 sept. 15 12:44 .
|
||||
drwxr-xr-x 4 root root 80 sept. 17 05:46 ..
|
||||
-rw-------+ 1 myuser users 11671 sept. 17 06:24 .bash_history
|
||||
-rw-r--r--+ 1 myuser users 246 sept. 15 14:22 .bash_profile
|
||||
-rw-r--r--+ 1 myuser users 49 sept. 15 06:59 ._bashrc
|
||||
drwx---r-x+ 2 myuser users 2 oct. 15 2008 cgi-bin
|
||||
drwxr-xr-x+ 3 myuser users 6 sept. 15 06:52 .composer
|
||||
drwxr-xr-x+ 3 myuser users 3 août 3 2016 git
|
||||
-rw-r--r--+ 1 myuser users 447 mai 24 2003 LISEZ-MOI
|
||||
drwxr-xr-x+ 4 myuser users 4 août 25 06:30 opt
|
||||
-rw----r--+ 1 myuser users 104 janv. 1 2018 .ovhconfig
|
||||
-rw----r--+ 1 myuser users 23 janv. 13 2017 php.ini
|
||||
drwx---r-x+ 36 myuser users 38 oct. 15 2008 requetes
|
||||
drwx---r-x+ 2 myuser users 2 mai 24 2003 sessions
|
||||
drwx------+ 2 myuser users 4 sept. 15 05:40 .ssh
|
||||
drwxr-xr-x+ 5 myuser users 7 sept. 15 09:21 .wp-cli
|
||||
drwx---r-x+ 18 myuser users 39 sept. 17 05:57 www
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Composer
|
||||
|
||||
On commence par [installer Composer](https://getcomposer.org/download/) (dans opt/bin):
|
||||
|
||||
```bash
|
||||
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
|
||||
$ php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
||||
|
||||
$ php composer-setup.php --install-dir=opt/bin
|
||||
|
||||
$ php -r "unlink('composer-setup.php');"
|
||||
|
||||
```
|
||||
|
||||
On vérifie la version installée:
|
||||
|
||||
```bash
|
||||
myuser@ssh2.300gp.ha.ovh.net (php/7.1/production/stable) ~ $ composer -V
|
||||
Composer version 1.7.2 2018-08-16 16:57:12
|
||||
```
|
||||
|
||||
|
||||
|
||||
### wp-cli
|
||||
|
||||
Pas moyen de télécharger directement wp-cli (Connection refused):
|
||||
|
||||
```bash
|
||||
$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||
% Total % Received % Xferd Average Speed Time Time Time Current
|
||||
Dload Upload Total Spent Left Speed
|
||||
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
|
||||
```
|
||||
|
||||
Il faut d'abord le télécharger en local puis le renvoyer sur ovh.
|
||||
|
||||
On le rend exécutable et on le déplace dans opt/bin.
|
||||
|
||||
```bash
|
||||
$ chmod +x wp-cli.phar
|
||||
$ sudo mv wp-cli.phar opt/bin/wp
|
||||
```
|
||||
|
||||
On vérifie que tout va bien avec `wp --info`
|
||||
|
||||
On peut ajouter un fichier de configuration `config.yml` dans `~/.wp-cli/`
|
||||
|
||||
```yaml
|
||||
path: ../www/wordpress
|
||||
url: https://clicclac.info/wordpress
|
||||
core config:
|
||||
dbhost: db.mysql.db
|
||||
dbname: dbwp
|
||||
dbuser: userwp
|
||||
dbpass: passwd
|
||||
```
|
||||
|
||||
Finalement...
|
||||
|
||||
```bash
|
||||
$ wp --info
|
||||
OS: Linux 4.14.61-ovh-vps-grsec-zfs-classid #1 SMP Tue Aug 7 02:27:59 CEST 2018 x86_64
|
||||
Shell: /bin/ovh_ssh
|
||||
PHP binary: /usr/local/php7.1/bin/php
|
||||
PHP version: 7.1.17
|
||||
php.ini used: /usr/local/php7.1/etc/php.ini
|
||||
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
|
||||
WP-CLI vendor dir: phar://wp-cli.phar/vendor
|
||||
WP_CLI phar path: /home/myuser
|
||||
WP-CLI packages dir: /homez.65/myuser/.wp-cli/packages/
|
||||
WP-CLI global config: /homez.65/myuser/.wp-cli/config.yml
|
||||
WP-CLI project config:
|
||||
WP-CLI version: 2.0.1
|
||||
```
|
||||
|
||||
|
||||
|
||||
Une fois wp-cli installé, <u>on ne peut pas y rajouter de package</u>. La connection est toujours refusée.
|
||||
|
||||
```bash
|
||||
~/www/wordpress $ wp package install wp-cli/doctor-command
|
||||
|
||||
Error: The "https://wp-cli.org/package-index/packages.json" file could not be downloaded: failed to open stream: Connection refused
|
||||
|
||||
~/www/wordpress $ wp package install git@github.com:wp-cli/doctor-command.git
|
||||
|
||||
Error: Failed to get url 'https://raw.githubusercontent.com/wp-cli/doctor-command/master/composer.json': cURL error 7: Failed to connect to raw.githubusercontent.com port 443: Connection refused.
|
||||
```
|
||||
|
||||
Même juste afficher la liste des packages pose problème:
|
||||
|
||||
```bash
|
||||
~/www/wordpress $ wp package list
|
||||
Warning: The "https://wp-cli.org/package-index/packages.json" file could not be downloaded: failed to open stream: Connection refused
|
||||
+--------------------------+------------------+------------+--------+----------------+
|
||||
| name | authors | version | update | update_version |
|
||||
+--------------------------+------------------+------------+--------+----------------+
|
||||
| trepmal/wp-revisions-cli | | dev-master | error | error |
|
||||
| wp-cli/doctor-command | Daniel Bachhuber | dev-master | none | |
|
||||
+--------------------------+------------------+------------+--------+----------------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
L'astuce est de passer par un script php et la fonction shell_exec:
|
||||
|
||||
```php
|
||||
$install = shell_exec('wp package install git@github.com:wp-cli/doctor-command.git 2>&1');
|
||||
```
|
||||
|
||||
Pensez à bien renseigner les variables d'environnement au début du script.
|
||||
|
||||
|
||||
|
||||
**install_wp_package.php**
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
putenv('PATH=/usr/local/php7.1/bin:/homez.65/funnymac/.wp-cli:/homez.65/funnymac/opt/bin:/usr/local/bin:/usr/bin:/bin');
|
||||
putenv('COMPOSER_HOME=/homez.65/funnymac/opt/bin/composer');
|
||||
putenv('WP_CLI_PACKAGES_DIR=/homez.65/funnymac/.wp-cli/packages');
|
||||
|
||||
$composer = shell_exec('which composer 2>&1');
|
||||
echo "$ which composer: <br /><code>$composer</code>";
|
||||
|
||||
echo "<br /><br />";
|
||||
|
||||
$composer_v = shell_exec('composer -V 2>&1');
|
||||
echo "$ composer -V: <br /><code>$composer_v</code>";
|
||||
|
||||
echo "<br /><br />";
|
||||
|
||||
$wp = shell_exec('which wp 2>&1');
|
||||
echo "$ which wp: <br /><code>$wp</code>";
|
||||
|
||||
echo "<br /><br />";
|
||||
|
||||
$wp_info = shell_exec('wp --info 2>&1');
|
||||
echo "$ wp --info: <br /><pre>$wp_info</pre>";
|
||||
|
||||
$pwd = shell_exec('pwd');
|
||||
echo "$ pwd: <br /><code>$pwd</code>";
|
||||
|
||||
echo "<br /><br />";
|
||||
|
||||
#$output2 = shell_exec('cd wordpress;wp package path');
|
||||
$output2 = shell_exec('wp package path');
|
||||
echo "$ wp package path: <br /><code>$output2</code>";
|
||||
|
||||
echo "<br /><br />";
|
||||
|
||||
$package_list = shell_exec('wp package list');
|
||||
echo "$ wp package list: <br /><pre>$package_list</pre>";
|
||||
|
||||
#$install = shell_exec('wp package install git@github.com:wp-cli/doctor-command.git 2>&1');
|
||||
#$install = shell_exec('wp package install trepmal/wp-revisions-cli 2>&1');
|
||||
echo "<pre>$install</pre>";
|
||||
|
||||
echo "Update all package $ wp package update"
|
||||
|
||||
#$themes = shell_exec('wp theme list --path=wordpress 2>&1');
|
||||
#echo "$ wp theme list: <br /><pre>$themes</pre>";
|
||||
|
||||
|
||||
?>
|
||||
```
|
||||
|
||||
40
docs/Linux/for.md
Normal file
40
docs/Linux/for.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# for
|
||||
|
||||
|
||||
|
||||
#### 1ere syntaxe:
|
||||
|
||||
```bash
|
||||
bash for variable in liste_valeurs
|
||||
do instruction(s)
|
||||
done
|
||||
```
|
||||
|
||||
#### 2eme syntaxe:
|
||||
|
||||
```bash
|
||||
for ((e1;e2;e3))
|
||||
do instruction(s)
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Exemples:
|
||||
|
||||
Parcourir les arguments passés au script:
|
||||
|
||||
```bash
|
||||
for i in "$@"
|
||||
do
|
||||
echo "$i"
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
for ((i=0 ; 10 - $i ; i++))
|
||||
do echo $i
|
||||
done
|
||||
```
|
||||
@@ -40,7 +40,11 @@ $ nvm install 10
|
||||
|
||||
|
||||
|
||||
### Version de npm:
|
||||
### npm
|
||||
|
||||
npm est un gestionnaire de paquets pour JavaScript automatiquement installé avec Node.
|
||||
|
||||
#### Version de npm:
|
||||
|
||||
```bash
|
||||
# version:
|
||||
@@ -52,11 +56,11 @@ $ npm -v
|
||||
|
||||
|
||||
|
||||
### Update:
|
||||
#### Update:
|
||||
|
||||
|
||||
```bash
|
||||
npm install npm@latest -g
|
||||
$ npm install npm@latest -g
|
||||
|
||||
$ brew install node
|
||||
|
||||
@@ -67,7 +71,7 @@ https://docs.npmjs.com/getting-started/fixing-npm-permissions#option-2-change-np
|
||||
|
||||
|
||||
|
||||
### Local:
|
||||
#### Local:
|
||||
|
||||
Installer npm packages localement => `/Users/bruno/Sites/node_modules`
|
||||
|
||||
@@ -91,7 +95,7 @@ $ npm outdated | awk '{print $1}' | xargs npm update
|
||||
|
||||
|
||||
|
||||
### Global:
|
||||
#### Global:
|
||||
|
||||
Installer npm packages globalement => `/usr/local/lib/node_modules/`
|
||||
|
||||
@@ -102,7 +106,7 @@ Installer npm packages globalement => `/usr/local/lib/node_modules/`
|
||||
|
||||
|
||||
|
||||
### Aller dans node_modules:
|
||||
#### Aller dans node_modules:
|
||||
|
||||
```bash
|
||||
bruno@SilverBook:~$ cd Sites/node_modules/
|
||||
@@ -118,7 +122,7 @@ puis
|
||||
|
||||
|
||||
|
||||
### Supprimer tous les modules:
|
||||
#### Supprimer tous les modules:
|
||||
|
||||
```bash
|
||||
$ for package in `ls node_modules`; do npm uninstall $package; done;
|
||||
@@ -126,7 +130,7 @@ $ for package in `ls node_modules`; do npm uninstall $package; done;
|
||||
|
||||
|
||||
|
||||
### Maintenance:
|
||||
#### Maintenance:
|
||||
|
||||
```bash
|
||||
$ npm doctor
|
||||
@@ -146,7 +150,7 @@ Verify cache contents verified 2159 tarballs
|
||||
|
||||
|
||||
|
||||
### Packages:
|
||||
#### Packages:
|
||||
|
||||
[Rechercher un package](https://npms.io)
|
||||
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
|
||||
|
||||
|
||||
nvm est un gestionnaire de version pour Node.
|
||||
|
||||
|
||||
|
||||
### Installation
|
||||
|
||||
#### Avec Homebrew:
|
||||
|
||||
Installer nvm:
|
||||
|
||||
```bash
|
||||
@@ -36,6 +44,25 @@ $ echo $NVM_DIR
|
||||
$ nvm --version
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Avec git (méthode officielle):
|
||||
|
||||
```bash
|
||||
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
|
||||
```
|
||||
|
||||
Le script d'installation ajoute les lignes suivantes à votre profil (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).
|
||||
|
||||
```bash
|
||||
export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Utilisation
|
||||
|
||||
Installer NodeJS.
|
||||
|
||||
```bash
|
||||
|
||||
@@ -46,6 +46,47 @@ $ python3 -m site --user-base
|
||||
|
||||
|
||||
|
||||
### idle:
|
||||
|
||||
**idle** est l'éditeur par défaut de Python
|
||||
|
||||
Pour le lancer depuis le shell:
|
||||
|
||||
```bash
|
||||
$ idle
|
||||
```
|
||||
|
||||
[Python et tcl/tk versions](https://discussions.apple.com/thread/8066794)
|
||||
|
||||
Python 3 utilise la bibliothèque Tcl/Tk fournie par macOS (8.5.9).
|
||||
|
||||
Pour utiliser une version plus récente (8.6.8) de la bibliothèque :
|
||||
|
||||
```bash
|
||||
$ brew install tcl-tk
|
||||
$ brew reinstall python3 --with-tcl-tk
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### jupyter:
|
||||
|
||||
[jupyter](https://jupyter.org/) est une web application qui permet de créer et partager des documents contenant du live-code...
|
||||
|
||||
Installer:
|
||||
|
||||
```bash
|
||||
$ pip3 install jupyter
|
||||
```
|
||||
|
||||
Démarrer:
|
||||
|
||||
```bash
|
||||
$ jupyter notebook
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Modules:
|
||||
|
||||
#### Mkdocs
|
||||
|
||||
@@ -55,6 +55,8 @@ $ bbedit /usr/local/etc/httpd/extra/httpd-vhosts.conf
|
||||
|
||||
### Virtual Hosts:
|
||||
|
||||
#### Redirection:
|
||||
|
||||
Editer le fichier *hosts*:
|
||||
|
||||
```bash
|
||||
@@ -78,6 +80,29 @@ Editer le fichier *httpd-vhosts.conf*:
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
#### Redirection de port:
|
||||
|
||||
wiki.js tourne sur localhost:3000 Pour le rendre disponible sur wiki.silverbook.local:
|
||||
|
||||
Editer le fichier *hosts*:
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/hosts
|
||||
127.0.0.1 silverbook.local
|
||||
127.0.0.1 wiki.silverbook.local
|
||||
```
|
||||
|
||||
Editer le fichier *httpd-vhosts.conf*:
|
||||
|
||||
```http
|
||||
<VirtualHost *:80>
|
||||
ServerName wiki.silverbook.local
|
||||
ProxyPass / http://localhost:3000/
|
||||
ProxyPassReverse / http://localhost:3000/
|
||||
ProxyPreserveHost On
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
|
||||
|
||||
### SSL:
|
||||
@@ -103,9 +128,6 @@ Listen 443
|
||||
\# General setup for the virtual host
|
||||
\# DocumentRoot "/usr/local/var/www"
|
||||
\# ServerName www.example.com:443
|
||||
\# ServerAdmin you@example.com
|
||||
|
||||
|
||||
```
|
||||
|
||||
<u>Ouvrir le fichier *httpd-vhosts.conf*:</u>
|
||||
@@ -214,7 +236,7 @@ Ajouter le bloc qui suit dans le **httpd.conf**
|
||||
|
||||
|
||||
|
||||
### \# macOS - homebrew:
|
||||
### Différence installation macOS - homebrew:
|
||||
|
||||
***MacOS:***
|
||||
|
||||
|
||||
Reference in New Issue
Block a user