Update 27-10-2019

This commit is contained in:
2019-10-27 18:43:35 +01:00
parent 6bf6471098
commit 73cd251d7b
14 changed files with 656 additions and 13 deletions

View File

@@ -322,6 +322,199 @@ Connection to 127.0.0.1 closed.
### Installer LAMP:
```bash
sudo apt-get install apache2
sudo apt-get install mariadb-server # This will ask for a root password, I leave it blank.
sudo apt-get install php
sudo apt-get install php7.3-mysql
```
#### Configurer le serveur local:
Ouvrir le fichier Vagrantfile et dé-commenter les 2 lignes suivantes:
```bash
config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
config.vm.network "private_network", ip: "192.168.33.10"
```
Quitter la box
```bash
exit
```
et redémarrer
```bash
$ vagrant reload
$ vagrant ssh
sudo /etc/init.d/apache2 start
```
Dans un navigateur, aller à *192.168.33.10* pour voir la page d'accueil d'Apache.
#### Dossiers partagés:
Créer un dossier *vagrant_site* sur le Mac et y ajouter un fichier *index.php*.
```php
<?php echo "Hello world"; ?>
```
Ouvrir le fichier Vagrantfile et dé-commenter la ligne suivante:
```bash
config.vm.synced_folder "../data", "/vagrant_data"
```
et la modifier comme suit:
```bash
config.vm.synced_folder "../vagrant_site/", "/var/www/html/"
```
- "../vagrant_site/" est le chemin vers le dossier nouvellement crée.
- "/var/www/html/" est le chemin où seront les fichiers dans la VM Vagrant.
Quitter la box:
```bash
exit
```
et redémarrer:
```bash
$ vagrant reload
$ vagrant ssh
```
Dans un navigateur, recharger *192.168.33.10* pour voir la page 'Hello World'.
#### MySQL:
Se connecter à la VM et démarrer Mysql:
```bash
sudo mysql
```
```mysql
CREATE USER 'debian';
GRANT ALL PRIVILEGES ON *.* TO debian;`
quit
```
Quitter la VM:
```bash
exit
```
puis
```bash
$ vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/bruno/vagrant_boxes/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
```
Ouvrir Sequel Pro et initier une connexion SSH:
- Hôte MySQL: 127.0.0.1
- Utilisateur: debian
- Mot de passe: <vide>
- Base: <vide>
- Port: <vide>
- Hôte SSH: 127.0.0.1
- Utilisateur SSH: vagrant
- Clé SSH: select /Users/bruno/vagrant_boxes/.vagrant/machines/default/virtualbox/private_key
- Port SSH: 2222
#### Virtual Host:
Editer le fichier *hosts* sur le mac:
```bash
$ sudo nano /etc/hosts
```
Ajouter cette ligne à la fin:
```bash
# Vagrant
192.168.33.10 hello.world
```
SSH dans la VM:
```bash
$ vagrant ssh
```
Puis:
```bash
cd /etc/apache2/sites-available/
```
Créer un nouveau fichier de config:
```bash
sudo nano hello.world.conf
```
Et y ajouter:
```bash
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName hello.world
DocumentRoot /var/www/html/
</VirtualHost>
```
Relancer Apache:
```bash
sudo a2ensite hello.world.conf
sudo service apache2 reload
```
Dans le navigateur, charger la page *hello.wolrd*
### Quitter la box:
```bash
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
```
### Supprimer la box: ### Supprimer la box:
```bash ```bash
@@ -333,7 +526,7 @@ $ vagrant destroy
### Supprimer les fichiers: ### Supprimer les fichiers:
```bash ```bash
$ vagrant box remove (supprime les fichiers) $ vagrant box remove <name>
``` ```
@@ -400,3 +593,7 @@ $ vagrant reload --provision
[How To Provision A LEMP Stack In Vagrant](https://kenfavors.com/code/how-to-provision-a-lemp-stack-in-vagrant/) [How To Provision A LEMP Stack In Vagrant](https://kenfavors.com/code/how-to-provision-a-lemp-stack-in-vagrant/)
[Setting Up a LAMP Server on a Vagrant Machine](https://dev.to/boringbdon/setting-up-a-lamp-server-on-a-vagrant-machine-ppi)
[SCOTCH BOX 3.5](https://box.scotch.io)

View File

@@ -48,7 +48,7 @@ https://www.ceos3c.com/open-source/install-linux-mint-19-virtualbox/
Ajouter: Ajouter:
```bash ```bash
add vagrant user # add vagrant user
vagrant ALL=(ALL) NOPASSWD:ALL vagrant ALL=(ALL) NOPASSWD:ALL
``` ```
@@ -57,6 +57,8 @@ https://www.ceos3c.com/open-source/install-linux-mint-19-virtualbox/
- Tester: - Tester:
`sudo pwd` `sudo pwd`
Pour Debian, voir [ici](../debian.md)
5. #### Mettre à jour l'OS: 5. #### Mettre à jour l'OS:
```bash ```bash
@@ -127,7 +129,7 @@ mkdir ~/vagrant_boxes
cd ~/vagrant_boxes cd ~/vagrant_boxes
``` ```
12. #### Créer le paquet (tar.gz et fichiers Vagrantfile , metadata.json 12. #### Créer le paquet (tar.gz et fichiers Vagrantfile , metadata.json ):
```bash ```bash
$ vagrant package --base Linux\ Mint\ 19\ xfce $ vagrant package --base Linux\ Mint\ 19\ xfce
@@ -137,7 +139,7 @@ $ vagrant package --base Linux\ Mint\ 19\ xfce
==> Linux Mint 19 xfce: Compressing package to: /Users/bruno/vagrant_boxes/package.box ==> Linux Mint 19 xfce: Compressing package to: /Users/bruno/vagrant_boxes/package.box
``` ```
13. #### Tester la box 13. #### Tester la box:
```bash ```bash
$ vagrant box add mint19-64 package.box $ vagrant box add mint19-64 package.box
@@ -149,6 +151,10 @@ $ vagrant box add mint19-64 package.box
## Vagrant
#### Initialiser la VM:
```bash ```bash
$ vagrant init mint19-64 $ vagrant init mint19-64
A `Vagrantfile` has been placed in this directory. You are now A `Vagrantfile` has been placed in this directory. You are now
@@ -157,6 +163,10 @@ the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant. `vagrantup.com` for more information on using Vagrant.
``` ```
#### Démarrer la VM:
```bash ```bash
$ vagrant up $ vagrant up
Bringing machine 'default' up with 'virtualbox' provider... Bringing machine 'default' up with 'virtualbox' provider...
@@ -171,6 +181,7 @@ information on this option, please refer to the VirtualBox manual:
https://www.virtualbox.org/manual/ch04.html#sharedfolders https://www.virtualbox.org/manual/ch04.html#sharedfolders
``` ```
```bash ```bash
This option can be disabled globally with an environment variable: This option can be disabled globally with an environment variable:
@@ -204,6 +215,8 @@ or on a per folder basis within the Vagrantfile:
#### Se connecter à la VM:
```bash ```bash
$ vagrant ssh $ vagrant ssh
vagrant@vagrant-VirtualBox:~$ ls vagrant@vagrant-VirtualBox:~$ ls
@@ -216,3 +229,12 @@ déconnexion
Connection to 127.0.0.1 closed. Connection to 127.0.0.1 closed.
``` ```
#### Arrêter la VM:
```bash
$ vagrant halt
==> default: Attempting graceful shutdown of VM...
```

118
docs/Divers/debian.md Normal file
View File

@@ -0,0 +1,118 @@
# debian
#### Régler un clavier mac:
Passer en mode administrateur « root » puis écrire la commande :
```bash
nano /etc/default/keyboard
```
Il faut modifier les deux lignes:
```markup
XKBVARIANT="latin9"
XKBOPTIONS="”
```
par :
```markup
XKBVARIANT="mac"
XKBOPTIONS="lv3:switch,compose:lwin”
```
Sauver puis redémarrer.
#### Installer et configurer sudo:
Contrairement à Ubuntu, sudo nest pas installé par défaut sur Debian 10.
Passer en mode administrateur « root » puis :
```bash
# apt-get install sudo
```
##### Ajouter un utilisateur à sudo:
```bash
sudo nano /etc/sudoers
```
puis:
```bash
# User privilege specification
root ALL=(ALL:ALL) ALL
user ALL=(ALL:ALL) ALL
```
Sinon:
```bash
/usr/sbin/adduser user
```
##### Ajouter l'utilisateur vagrant à sudo:
```bash
sudo nano /etc/sudoers
```
puis:
```bash
# User privilege specification
root ALL=(ALL:ALL) ALL
vagrant ALL=(ALL) NOPASSWD:ALL
```
##### Exécuter la dernière commande avec sudo:
```bash
$ sudo !!
```
#### Installer Guest Tools (VirtualBox):
Passer en mode administrateur « root » puis
```bash
apt update
apt ugrade
apt install build-essential module-assistant dkms
```
Préparer le système à compiler les modules kernel:
```bash
m-a prepare
```
Dans *VirtualBox*, menu *Devices*, cliquer sur *Insert Guest Additions CD image*, puis:
```bash
mount /dev/cdrom /mnt
cd /mnt
./VBoxLinuxAdditions.run
```
Redémarrer la VM:
```bash
shutdown -r now
```

46
docs/Divers/zsh/zsh.md Normal file
View File

@@ -0,0 +1,46 @@
# zsh
### [nyae]?
`n`: **n**o. Ne corrige pas et exécute la commande entrée.
```bash
[bruno@silverbook/~] $ lx
zsh: correct 'lx' to 'ls' [nyae]? n
zsh: command not found: lx
```
`y`: **y**es. Corrige et exécute la modification suggérée par zsh.
```bash
[bruno@silverbook/~] $ lx
zsh: correct 'lx' to 'ls' [nyae]? y
Applications Movies Sites
Applications (Parallels) Music SynologyDrive
Brewfile Nextcloud backup_list.conf
Cloud OneDrive pCloud Drive
Desktop Parallels path
Documents Pictures plugins.d
Downloads Public project
Dropbox PycharmProjects
Library Shared with me
```
`a`: **a**bort. Ne fait rien et affiche un nouveau prompt.
```bash
$ setfile
zsh: correct 'setfile' to 'SetFile' [nyae]? a
$
```
`e`: **e**dit. Editer la ligne.
```bash
$ setfile
zsh: correct 'setfile' to 'SetFile' [nyae]? e
$ setfile|
```

View File

@@ -2,6 +2,72 @@
### Install MariaDB avec Homebrew:
```bash
bruno@SilverBook: ~ $ sudo find / -name mysql
Password:
/usr/local/bin/mysql
/usr/local/include/mysql
/usr/local/etc/init.d/mysql
/usr/local/etc/logrotate.d/mysql
/usr/local/var/mysql
/usr/local/var/mysql/mysql
/usr/local/Cellar/mariadb/10.4.6_1/bin/mysql
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/server/mysql
/usr/local/Cellar/mariadb/10.4.6_1/include/mysql/mysql
/usr/local/Cellar/mariadb/10.4.6_1/.bottle/etc/init.d/mysql
/usr/local/Cellar/mariadb/10.4.6_1/.bottle/etc/logrotate.d/mysql
/usr/local/Cellar/mariadb/10.4.6_1/share/mysql
/usr/local/share/mysql
```
#### my.cnf
```bash
bruno@SilverBook: /usr/local/etc $ ls -la
total 160
-rw-r--r-- 1 bruno admin 212 4 sep 16:53 my.cnf
drwxr-xr-x 3 bruno admin 96 16 aoû 10:43 my.cnf.d
-rw-r--r-- 1 bruno admin 113 4 sep 16:53 my.cnf.default
```
```bash
bruno@SilverBook: /usr/local/etc/my.cnf.d $ l
total 0
-rw-r--r-- 1 bruno admin 0 16 aoû 10:43 wont_prune.txt
```
#### Bases
```bash
bruno@SilverBook: /usr/local/var/mysql $ l
total 245920
-rw-rw---- 1 bruno admin 6519 15 oct 17:48 SilverBook.local.err
-rw-rw---- 1 bruno admin 5 15 oct 17:48 SilverBook.local.pid
-rw-rw---- 1 bruno admin 24576 15 oct 17:46 aria_log.00000001
-rw-rw---- 1 bruno admin 52 15 oct 17:46 aria_log_control
-rw-r----- 1 bruno admin 976 15 oct 17:46 ib_buffer_pool
-rw-rw---- 1 bruno admin 50331648 15 oct 17:48 ib_logfile0
-rw-rw---- 1 bruno admin 50331648 6 aoû 20:18 ib_logfile1
-rw-rw---- 1 bruno admin 12582912 15 oct 17:46 ibdata1
-rw-rw---- 1 bruno admin 12582912 15 oct 17:48 ibtmp1
-rw-rw---- 1 bruno admin 0 6 aoû 20:18 multi-master.info
drwx------ 90 bruno admin 2880 6 aoû 20:18 mysql
drwx------ 3 bruno admin 96 6 aoû 20:18 performance_schema
-rw-rw---- 1 bruno admin 3047 11 aoû 22:49 silverbook-1.home.err
-rw-rw---- 1 bruno admin 30926 15 oct 17:46 silverbook.home.err
```
[Reset Expired root Password for MySQL 5.7 on Mac OS X](Expired-root-Password.md) [Reset Expired root Password for MySQL 5.7 on Mac OS X](Expired-root-Password.md)
[mysqlcheck](mysqlcheck.md) [mysqlcheck](mysqlcheck.md)

View File

@@ -166,7 +166,9 @@ Package nano (2.9.6-1) is installed on root and has the following files:
##### Chercher un paquet: ##### Chercher un paquet:
```bash ```bash
bruno@DS916:~ $ sudo opkg search <paquet> ??? bruno@DS916:~ $ sudo opkg search '*php*'
bruno@DS916:~ $ sudo opkg find '*php*'
``` ```
##### Afficher les infos sur un paquet: ##### Afficher les infos sur un paquet:

View File

@@ -1,10 +1,4 @@
# FFmpeg # Scripts
[:fa-link: Doc](http://ffmpeg.org/ffmpeg.html#Options)
[:fa-link: Encode AAC](https://trac.ffmpeg.org/wiki/Encode/AAC)

6
docs/macos/Mail.md Normal file
View File

@@ -0,0 +1,6 @@
# Récupérer les BAL *Sur mon Mac* dans OSX Mail
https://grayjetmedia.com/2016/04/01/recovering-lost-on-my-mac-local-mailboxes-after-os-x-10-11-el-capitan-upgrade/

58
docs/macos/chflags.md Normal file
View File

@@ -0,0 +1,58 @@
# chflags
Changer les flags d'un fichier ou d'un dossier.
Voir les flags dans macOS (**ls -lO**):
```bash
silverbook-1:~ enzo$ ls -lO
total 0
drwx------+ 3 enzo staff - 96 12 aoû 22:28 Desktop
drwx------+ 3 enzo staff - 96 12 aoû 22:28 Documents
drwx------+ 3 enzo staff - 96 12 aoû 22:28 Downloads
drwx------@ 56 enzo staff hidden 1792 17 aoû 08:07 Library
drwx------+ 3 enzo staff - 96 12 aoû 22:28 Movies
drwx------+ 3 enzo staff - 96 12 aoû 22:28 Music
drwx------+ 3 enzo staff - 96 12 aoû 22:28 Pictures
drwxr-xr-x+ 4 enzo staff - 128 12 aoû 22:28 Public
```
Par défaut, le dossier Bibliothèque de l'utilisateur est caché.
Si aucun flag n'est pis, un tiret est affiché.
Les différents flags sont:
- <u>arch</u>, <u>archived</u> (super-user only)
- <u>opaque</u> (owner or super-user only)
- <u>nodump</u> (owner or super-user only)
- <u>sappnd</u>,<u>sappend</u> (super-user only)
- <u>schg</u>, <u>schange</u>, <u>simmutable</u> (super-user only)
- <u>uappnd</u>, <u>uappend</u> (owner or super-user only)
- <u>uchg</u>, <u>uchange</u>, <u>uimmutable</u> (owner or super-user only)
- <u>hidden</u>
Pour supprimer un flag, il faut le régler à l'opposé:
```bash
$ sudo chflags dump /usr/bin/local/oty.sh
```
Comme pour chmod, l'option -R permet la récursivité.
```bash
$ chflags -R nohidden ~/Desktop
```

View File

@@ -0,0 +1,62 @@
# GetFileInfo - SetFile
### GetFileInfo
#### Attributs (-a):
Minuscule = 0, Majuscule = 1
A Alias file
B Bundle
C Custom icon*
D Desktop*
E Hidden extension*
I Inited*
M Shared (can run multiple times)
N No INIT resources
L Locked
S System (name locked)
T Stationery
V Invisible*
Z Busy*
Les items marqués avec un astérisque (*) sont autorisés avc les dossiers.
Après une clean install de Mojave, mon dossier utilisateur n'apparassait pas dans le Finder (/Users/).
```bash
silverbook:Users enzo$ GetFileInfo bruno/
directory: "/Users/bruno"
attributes: aVbstclinmedz
created: 08/03/2019 17:59:52
modified: 08/12/2019 23:03:17
```
Je crée un 2nd utilisateur qui lui apparait bien.
```bash
silverbook:Users enzo$ GetFileInfo enzo/
directory: "/Users/enzo"
attributes: avbstclinmedz
created: 08/12/2019 22:28:15
modified: 08/12/2019 23:06:58
```
Dans le 1er cas, l'attribut V (majuscule) est mis sur invisible.
Dans le 2nd cas, l'attribut v (minuscule) est correctement mis sur visible.
### SetFile
Pour remettre visible mon dossier utilisateur:
```bash
silverbook:Users bruno$ SetFile -a v bruno/
```

View File

@@ -249,6 +249,35 @@ Already downloaded: /Users/bruno/Library/Caches/Homebrew/downloads/1916f7da74b03
### Error: undefined method `match?' for nil:NilClass
```bash
Casks upgrade.
==> Satisfying dependencies
==> Downloading https://download.docker.com/mac/stable/37877/Docker.dmg
Already downloaded: /Users/bruno/Library/Caches/Homebrew/downloads/b3bb59c37763f69c59847ec95b1e097d3500ace49f5d25eb9acfd4f4eee215f5--Docker.dmg
==> Verifying SHA-256 checksum for Cask 'docker'.
==> Uninstalling Cask docker
==> Removing launchctl service com.docker.helper
Password:
==> Removing launchctl service com.docker.vmnetd
Error: undefined method `match?' for nil:NilClass
Follow the instructions here:
https://github.com/Homebrew/homebrew-cask#reporting-bugs
```
Supprimer l'application Docker manuellement, puis la réinstaller.
```bash
$ rm -rvf "$(brew --prefix)/Caskroom/docker"
$ brew cask install docker
```
### Réinstaller une ancienne version de VirtualBox (6.0.6 au lieu de 6.0.8): ### Réinstaller une ancienne version de VirtualBox (6.0.6 au lieu de 6.0.8):
Désinstaller la version actuelle: Désinstaller la version actuelle:

View File

@@ -61,7 +61,7 @@ export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
### Utilisation ### Utilisation:
Installer NodeJS. Installer NodeJS.
@@ -155,3 +155,21 @@ Now using node v10.15.0 (npm v6.4.1)
$ nvm reinstall-packages 8 $ nvm reinstall-packages 8
``` ```
### Erreur:
```bash
# A l'ouverture d'une fenêtre bash
N/A: version "N/A -> N/A" is not yet installed.
You need to run "nvm install N/A" to install it before using it.
```
Entrer:
```bash
$ nvm alias default 12
```

View File

@@ -597,3 +597,26 @@ mysql.db OK
mysql.event OK mysql.event OK
``` ```
#### BASH : exécuter une requête MySql et exploiter le résultat
```bash
$ echo "SHOW DATABASES;" | mysql -h localhost -u root -ppassword
Database
information_schema
mysql
performance_schema
wordpress
zenphoto
```
[exécuter une requête MySql et exploiter le résultat](https://www.quennec.fr/trucs-astuces/systèmes/gnulinux/utilisation/bash-exécuter-une-requête-mysql-et-exploiter-le-résultat)
#### Créer un utilisateur avec les permissions lecture seule pour le backup des bases.
```mysql
GRANT SELECT, LOCK TABLES ON *.* TO 'MYBACKUPUSER'@'%' IDENTIFIED BY 'MYPASSWORD';
```

View File

@@ -127,6 +127,7 @@ nav:
- Index: Raspberry/index.md - Index: Raspberry/index.md
- apt-get: Raspberry/apt-get.md - apt-get: Raspberry/apt-get.md
- aptitude: Raspberry/aptitude.md - aptitude: Raspberry/aptitude.md
- Backup SD: Raspberry/backup_sd.md
- Boot et clone: Raspberry/boot.md - Boot et clone: Raspberry/boot.md
- Backup: Raspberry/backup.md - Backup: Raspberry/backup.md
- Hardware: Raspberry/hardware.md - Hardware: Raspberry/hardware.md
@@ -172,6 +173,7 @@ nav:
- Session de travail avec git: Divers/git/git-session.md - Session de travail avec git: Divers/git/git-session.md
- go: Divers/go.md - go: Divers/go.md
- Markdown: Divers/markdown.md - Markdown: Divers/markdown.md
- Nextcloud: Divers/nextcloud.md
- Plex: Divers/plex.md - Plex: Divers/plex.md
- Vagrant: - Vagrant:
- Installation: Divers/Vagrant/Vagrant.md - Installation: Divers/Vagrant/Vagrant.md