31-05-2020
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
To list systemd services we will use systemctl command as below
|
||||
# systemctl list-unit-files
|
||||
|
||||
To list active systemd services run
|
||||
Lister tous les services actifs
|
||||
# systemctl | more
|
||||
|
||||
# systemctl list-units --type service
|
||||
@@ -19,11 +19,17 @@ You can pipe the output to grep to search a more specific service as shown below
|
||||
To check the services alongside the ports they are listening.
|
||||
# netstat -pnltu
|
||||
|
||||
For example, to check if OpenSSH is running on your system, run
|
||||
|
||||
Savoir si le service est actif
|
||||
# systemctl is-active sshd
|
||||
|
||||
Connaitre le status dans service (affiche plud d'info que is-active)
|
||||
# systemctl status sshd
|
||||
|
||||
Alternatively, you can use the syntax below to check if the service is active
|
||||
# systemctl is-active sshd
|
||||
Savoir si le service a eu un problème au démarrage
|
||||
# systemctl is-failed sshd
|
||||
|
||||
|
||||
|
||||
o check if OpenSSH is enabled, run
|
||||
# systemctl is-enabled sshd
|
||||
@@ -34,5 +40,48 @@ check the status of OpenSSH, run
|
||||
|
||||
You can also check all services by running
|
||||
# chkconfig --list
|
||||
|
||||
|
||||
Activer un service au démarrage
|
||||
# systemctl enable sshd
|
||||
|
||||
Désactiver un service au démarrage
|
||||
# systemctl disable sshd
|
||||
|
||||
|
||||
Démarrer un service
|
||||
# systemctl start sshd
|
||||
|
||||
Arreter un service
|
||||
# systemctl stop sshd
|
||||
|
||||
Redémarrer un service
|
||||
# systemctl restart sshd
|
||||
|
||||
Recharger la configuraation d'un service
|
||||
# systemctl reload sshd
|
||||
|
||||
|
||||
Voir la configuration d'un service
|
||||
# systemctl cat sshd
|
||||
|
||||
Propriétés d'un service
|
||||
# systemctl show sshd
|
||||
|
||||
Editer un service
|
||||
# systemctl edit sshd
|
||||
|
||||
Masquer un service, c'est à dire d'empêcher le démarrage manuel et automatique de l'unité. Il suffit alors de la démasquer pour pouvoir l'utiliser à nouveau
|
||||
# systemctl mask httpd.service
|
||||
Created symlink from /etc/systemd/system/httpd.service to /dev/null.
|
||||
# systemctl start httpd.service
|
||||
Failed to start httpd.service: Unit is masked.
|
||||
# systemctl unmask httpd.service
|
||||
Removed symlink /etc/systemd/system/httpd.service.
|
||||
# systemctl start httpd.service
|
||||
|
||||
Afficher les dépendances d'un service
|
||||
# systemctl list-dependencies sshd.service
|
||||
```
|
||||
|
||||
https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
|
||||
@@ -117,17 +117,40 @@ $ git commit –m 'version initiale du projet'
|
||||
|
||||
#### [Cloner un dépôt existant:](https://git-scm.com/book/fr/v1/Les-bases-de-Git-D%C3%A9marrer-un-d%C3%A9p%C3%B4t-Git#Cloner-un-d%C3%A9p%C3%B4t-existant)
|
||||
|
||||
```bash
|
||||
$ git clone git://github.com/depot/projet.git
|
||||
```
|
||||
Bash.git est un repo --bare sur le NAS.
|
||||
|
||||
Crée un répertoire <u>grit</u> contenant les données du dépôt ainsi qu'un répertoire .git
|
||||
Créer un répertoire contenant les données du dépôt (working tree) ainsi qu'un répertoire .git
|
||||
|
||||
```bash
|
||||
$ git clone git://github.com/depot/projet.git mondossier
|
||||
$ git clone ssh://bruno@clicclac.synology.me:42666/volume1/Repositories/bash.git
|
||||
|
||||
$ cd bash
|
||||
drwxr-xr-x 12 bruno staff 384 May 8 07:46 .git
|
||||
-rw-r--r-- 1 bruno staff 10 May 8 07:46 .gitignore
|
||||
-rwxr-xr-x 1 bruno staff 3317 May 8 07:46 apache_tools.sh
|
||||
-rwxr-xr-x 1 bruno staff 5158 May 8 07:46 backup-conf.sh
|
||||
```
|
||||
|
||||
Crée un clone du depot dans le dossier mondossier
|
||||
Créer un répertoire Repo contenant les données du dépôt (working tree) ainsi qu'un répertoire .git
|
||||
|
||||
```bash
|
||||
$ git clone ssh://bruno@clicclac.synology.me:42666/volume1/Repositories/bash.git Repo
|
||||
|
||||
$ cd Repo
|
||||
drwxr-xr-x 12 bruno staff 384 May 8 07:46 .git
|
||||
-rw-r--r-- 1 bruno staff 10 May 8 07:46 .gitignore
|
||||
-rwxr-xr-x 1 bruno staff 3317 May 8 07:46 apache_tools.sh
|
||||
-rwxr-xr-x 1 bruno staff 5158 May 8 07:46 backup-conf.sh
|
||||
```
|
||||
|
||||
Créer uniquement le répertoire .git (pas de working tree)
|
||||
|
||||
```bash
|
||||
$ git clone --mirror ssh://bruno@clicclac.synology.me:42666/volume1/Repositories/bash.git
|
||||
|
||||
$ ls -la
|
||||
drwxr-xr-x 10 bruno staff 320 May 8 08:01 bash.git
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -396,12 +419,22 @@ $ git remote show KYMSU
|
||||
master pousse vers master (à jour)
|
||||
```
|
||||
|
||||
##### Ajouter un dépot distant:
|
||||
#### Ajouter un dépot distant:
|
||||
|
||||
```bash
|
||||
$ git remote add origin git@gitea.maboiteverte.fr:bruno/yuzu-child_mbv.git
|
||||
```
|
||||
|
||||
```bash
|
||||
GIT_SSL_NO_VERIFY=true git remote add origin ssh://bruno@192.168.1.7:42666/volume1/Repositories/shell_scripts.git
|
||||
```
|
||||
|
||||
#### Corriger l'URL d'un dépôt distant:
|
||||
|
||||
```bash
|
||||
$ git remote set-url origin git@gitea.maboiteverte.fr:bruno/yuzu-child_mbv.git
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Etiquettes:
|
||||
@@ -587,6 +620,10 @@ Avec la commande rebase, vous prenez toutes les modifications qui ont été vali
|
||||
|
||||
#### => [Session de travail avec git](git-session.md) <=
|
||||
|
||||
#### => [Synchroniser 2 dépôts (--bare)](sync-repo.md) <=
|
||||
|
||||
#### => [git sur Plesk](../../Plesk/git.md) <=
|
||||
|
||||
|
||||
|
||||
http://www.ntu.edu.sg/home/ehchua/programming/howto/Git_HowTo.html
|
||||
146
docs/Divers/git/sync-repo.md
Normal file
146
docs/Divers/git/sync-repo.md
Normal file
@@ -0,0 +1,146 @@
|
||||
# Synchroniser 2 dépôts (--bare):
|
||||
|
||||
|
||||
|
||||
ssh://bruno@clicclac.synology.me:42666/volume1/Repositories/wp_yuzu-child.git
|
||||
|
||||
bruno@maboiteverte.fr:~/git/wp_yuzu-child.git
|
||||
|
||||
```bash
|
||||
$ git clone --mirror ssh://bruno@clicclac.synology.me:42666/volume1/Repositories/wp_yuzu-child.git
|
||||
|
||||
$ cd wp_yuzu-child.git
|
||||
total 16
|
||||
-rw-r--r-- 1 bruno staff 23 May 8 09:13 HEAD
|
||||
-rw-r--r-- 1 bruno staff 253 May 8 09:13 config
|
||||
-rw-r--r-- 1 bruno staff 73 May 8 09:13 description
|
||||
drwxr-xr-x 14 bruno staff 448 May 8 09:13 hooks
|
||||
drwxr-xr-x 3 bruno staff 96 May 8 09:13 info
|
||||
drwxr-xr-x 4 bruno staff 128 May 8 09:13 objects
|
||||
-rw-r--r-- 1 bruno staff 105 May 8 09:13 packed-refs
|
||||
drwxr-xr-x 4 bruno staff 128 May 8 09:13 refs
|
||||
|
||||
$ nano config
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = true
|
||||
ignorecase = true
|
||||
precomposeunicode = true
|
||||
[remote "origin"]
|
||||
url = ssh://bruno@clicclac.synology.me:42666/volume1/Repositories/wp_yuzu-child.git
|
||||
fetch = +refs/*:refs/*
|
||||
mirror = true
|
||||
|
||||
```
|
||||
|
||||
On ajoute le second dépôt distant:
|
||||
|
||||
```bash
|
||||
$ git remote add --mirror=fetch secondary ssh://bruno@maboiteverte.fr:~/git/wp_yuzu-child.git
|
||||
|
||||
$ nano config
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = true
|
||||
ignorecase = true
|
||||
precomposeunicode = true
|
||||
[remote "origin"]
|
||||
url = ssh://bruno@clicclac.synology.me:42666/volume1/Repositories/wp_yuzu-child.git
|
||||
fetch = +refs/*:refs/*
|
||||
mirror = true
|
||||
[remote "secondary"]
|
||||
url = bruno@maboiteverte.fr:~/git/wp_yuzu-child.git
|
||||
fetch = +refs/*:refs/*
|
||||
```
|
||||
|
||||
On récupère les commits et refs du 1er dépôt (origin):
|
||||
|
||||
```bash
|
||||
$ git fetch origin
|
||||
|
||||
$ l
|
||||
total 20
|
||||
-rw-r--r-- 1 bruno staff 142 May 8 09:25 FETCH_HEAD <-
|
||||
-rw-r--r-- 1 bruno staff 23 May 8 09:13 HEAD
|
||||
-rw-r--r-- 1 bruno staff 357 May 8 09:18 config
|
||||
-rw-r--r-- 1 bruno staff 73 May 8 09:13 description
|
||||
drwxr-xr-x 14 bruno staff 448 May 8 09:13 hooks
|
||||
drwxr-xr-x 3 bruno staff 96 May 8 09:13 info
|
||||
drwxr-xr-x 4 bruno staff 128 May 8 09:13 objects
|
||||
-rw-r--r-- 1 bruno staff 105 May 8 09:13 packed-refs
|
||||
drwxr-xr-x 4 bruno staff 128 May 8 09:13 refs
|
||||
|
||||
$ nano FETCH_HEAD
|
||||
e3bd4d1ce81a2a0c6f87f713ec7a84ae4327c87a not-for-merge branch 'master' of ssh://clicclac.synology.me:42666/volume1/Repositories/wp_yuzu-child
|
||||
```
|
||||
|
||||
On met à jour le second dépôt (avec local refs)
|
||||
|
||||
```bash
|
||||
$ git push secondary --all
|
||||
Enumerating objects: 42, done.
|
||||
Counting objects: 100% (42/42), done.
|
||||
Delta compression using up to 8 threads
|
||||
Compressing objects: 100% (24/24), done.
|
||||
Writing objects: 100% (42/42), 529.85 KiB | 88.31 MiB/s, done.
|
||||
Total 42 (delta 16), reused 42 (delta 16), pack-reused 0
|
||||
remote: % Total % Received % Xferd Average Speed Time Time Time Current
|
||||
remote: Dload Upload Total Spent Left Speed
|
||||
remote: 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
|
||||
To maboiteverte.fr:~/git/wp_yuzu-child.git
|
||||
* [new branch] master -> master
|
||||
```
|
||||
|
||||
On vérifie sur le second dépôt:
|
||||
|
||||
```bash
|
||||
bruno@localhost:~/git/wp_yuzu-child.git$ l
|
||||
total 40
|
||||
drwxr-xr-x 7 bruno psacln 4096 May 8 09:39 .
|
||||
drwxr-xr-x 5 bruno psacln 4096 May 8 08:47 ..
|
||||
drwxr-xr-x 2 bruno psacln 4096 May 8 08:47 branches
|
||||
-rw-r--r-- 1 bruno psacln 66 May 8 08:47 config
|
||||
-rw-r--r-- 1 bruno psacln 73 May 8 08:47 description
|
||||
-rw-r--r-- 1 bruno psacln 23 May 8 09:39 HEAD <-
|
||||
drwxr-xr-x 2 bruno psacln 4096 May 8 08:47 hooks
|
||||
drwxr-xr-x 2 bruno psacln 4096 May 8 08:47 info
|
||||
drwxr-xr-x 43 bruno psacln 4096 May 8 09:39 objects <-
|
||||
drwxr-xr-x 4 bruno psacln 4096 May 8 08:47 refs
|
||||
```
|
||||
|
||||
Les 2 dépôts ont maintenant les mêmes fichiers et historiques.
|
||||
|
||||
|
||||
|
||||
A partir de la, pour maintenir les 2 dépôts synchronisés:
|
||||
|
||||
- un nouveau commit est crée sur le 1er dépôt:
|
||||
|
||||
```bash
|
||||
$ git fetch origin
|
||||
$ git push secondary --all
|
||||
```
|
||||
|
||||
- un nouveau commit est crée sur le 2nd dépôt:
|
||||
|
||||
```bash
|
||||
$ git fetch secondary
|
||||
$ git push origin
|
||||
```
|
||||
|
||||
- les 2 dépôts sont modifiés:
|
||||
|
||||
```bash
|
||||
# mkdir ../workdir
|
||||
# git fetch origin
|
||||
# git --work-tree=../workdir/ checkout branch_name file_name1
|
||||
# git fetch secondary
|
||||
# git --work-tree=../workdir/ checkout branch_name file_name2
|
||||
# git push secondary
|
||||
# git push origin
|
||||
```
|
||||
|
||||
|
||||
|
||||
16
docs/Linux/users.md
Normal file
16
docs/Linux/users.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Users
|
||||
|
||||
#
|
||||
|
||||
### Ubuntu
|
||||
|
||||
| | |
|
||||
| -------------------------------------------------- | ---------------------------------------------- |
|
||||
| Ajouter un utilisateur | sudo useradd <username> |
|
||||
| | sudo adduser <username> (interactive frontend) |
|
||||
| Ajouter un utilisateur avec droit d'administration | sudo usermod -aG sudo <username> |
|
||||
| Supprimer un utilisateur | sudo userdel <username> |
|
||||
| | sudo deluser <username> (interactive frontend) |
|
||||
| Supprimer un utilisateur (et son dossier home) | sudo deluser --remove-home <username> |
|
||||
| | |
|
||||
|
||||
575
docs/Plesk/Gitea.md
Normal file
575
docs/Plesk/Gitea.md
Normal file
@@ -0,0 +1,575 @@
|
||||
# Gitea
|
||||
|
||||
|
||||
|
||||
[Gitea](https://gitea.io/en-us/)
|
||||
[Docs](https://docs.gitea.io/fr-fr/)
|
||||
[Forum](https://discourse.gitea.io)
|
||||
|
||||
### Installation
|
||||
|
||||
#### Créer le sous-domaine gitea:
|
||||
|
||||
Dans Plesk:
|
||||
|
||||
Sites Web et Domaines -> <u>Ajouter un sous-domaine</u>:
|
||||
|
||||
- Nom du sous-domaine: gitea.maboiteverte.fr
|
||||
- Racine du document: gitea.maboiteverte.fr
|
||||
- Cocher Protéger le domaine avec Let's Encrypt
|
||||
|
||||
Sites Web et Domaines -> gitea.maboiteverte.fr -> <u>Paramètres d'Apache et de Nginx</u> -> Directives supplémentaires pour HTTPS :
|
||||
|
||||
```
|
||||
<Proxy *>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Proxy>
|
||||
AllowEncodedSlashes NoDecode
|
||||
ServerName gitea.maboiteverte.fr
|
||||
ProxyPreserveHost On
|
||||
ProxyRequests off
|
||||
|
||||
# Note: no trailing slash after either /git or port
|
||||
|
||||
ProxyPass / http://localhost:3000/ nocanon
|
||||
ProxyPassReverse / http://localhost:3000/
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Créer un base MySQL dans le sous-domaine Gitea:
|
||||
|
||||
bdd: admin_gitea
|
||||
user/pwd: adm_gitea / 2X5$7isg
|
||||
|
||||
##### Régler les variables globales comme suit:
|
||||
|
||||
- innodb_default_row_format=dynamic
|
||||
- innodb_file_format=Barracuda
|
||||
- innodb_large_prefix=1
|
||||
|
||||
sinon on obtiendra l'erreur MySql/MariaDB: *issue: Error 1709: Index column size too large. The maximum column size is 767 bytes.*
|
||||
|
||||
Ajouter les fichiers de config MySQL:
|
||||
|
||||
```mysql
|
||||
$ nano /etc/mysql/mariadb.conf.d/gitea.cnf
|
||||
[mysqld]
|
||||
innodb_default_row_format=dynamic
|
||||
|
||||
$ nano /etc/mysql/mariadb.conf.d/nextcloud.cnf
|
||||
[mysqld]
|
||||
innodb_large_prefix=true
|
||||
innodb_file_format=barracuda
|
||||
innodb_file_per_table=1
|
||||
```
|
||||
|
||||
Sinon en ligne de commande (#root):
|
||||
|
||||
```mysql
|
||||
SET GLOBAL innodb_default_row_format=dynamic;
|
||||
```
|
||||
|
||||
Pour voir les variables:
|
||||
|
||||
```mysql
|
||||
SHOW VARIABLES LIKE 'innodb_%'
|
||||
```
|
||||
|
||||
Redémarrer MySQL:
|
||||
|
||||
```mysql
|
||||
$ systemctl restart mariadb
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Créer un user git:
|
||||
|
||||
```bash
|
||||
adduser \
|
||||
--system \
|
||||
--shell /bin/bash \
|
||||
--gecos 'Git Version Control' \
|
||||
--group \
|
||||
--disabled-password \
|
||||
--home /home/git \
|
||||
git
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Télécharger Gitea:
|
||||
|
||||
```bash
|
||||
VERSION=1.11.4
|
||||
sudo wget -O /tmp/gitea https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-linux-amd64
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### et l'installer:
|
||||
|
||||
```bash
|
||||
$ sudo mv /tmp/gitea /usr/local/bin
|
||||
$ sudo chmod +x /usr/local/bin/gitea
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Créer les répertoires et régler les permissions:
|
||||
|
||||
```bash
|
||||
$ mkdir -p /var/lib/gitea/{custom,data,log}
|
||||
$ chown -R git:git /var/lib/gitea/
|
||||
$ chmod -R 750 /var/lib/gitea/
|
||||
|
||||
$ mkdir /etc/gitea
|
||||
$ chown root:git /etc/gitea
|
||||
$ chmod 770 /etc/gitea
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Créer le service Gitea:
|
||||
|
||||
```bash
|
||||
$ sudo nano /etc/systemd/system/gitea.service
|
||||
```
|
||||
|
||||
https://github.com/go-gitea/gitea/blob/master/contrib/systemd/gitea.service
|
||||
|
||||
ou télécharger celui de Gitea:
|
||||
|
||||
```bash
|
||||
$ sudo wget https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service -P /etc/systemd/system/
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Démarrer le service Gitea:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl daemon-reload
|
||||
$ sudo systemctl enable --now gitea
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Vérifier son état:
|
||||
|
||||
```bash
|
||||
$ systemctl status gitea.service
|
||||
● gitea.service - Gitea
|
||||
Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: enabled)
|
||||
Active: active (running) since Sat 2020-05-09 07:20:30 CEST; 3h 7min ago
|
||||
Main PID: 2394 (gitea)
|
||||
Tasks: 8 (limit: 1099)
|
||||
CGroup: /system.slice/gitea.service
|
||||
└─2394 /usr/local/bin/gitea web -c /etc/gitea/app.ini
|
||||
|
||||
```
|
||||
|
||||
|
||||
Confirmer:
|
||||
|
||||
```bash
|
||||
$ gitea --version
|
||||
Gitea version 1.11.4 built with GNU Make 4.1, go1.13.9 : bindata, sqlite, sqlite_unlock_notify
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Ouvrir http://YOUR_DOMAIN_IR_IP:3000 dans le navigateur:
|
||||
|
||||
##### Database Settings:
|
||||
|
||||
- Database Type: MySQL
|
||||
- Host: 127.0.0.1:3306
|
||||
- Username: adm_gitea
|
||||
- Password: xxx
|
||||
- Database Name: admin_gitea
|
||||
- utf8_general_ci
|
||||
|
||||
##### Applications General Settings:
|
||||
|
||||
- Site Title: Enter your organization name.
|
||||
- Repository Root Path: Leave the default /home/git/gitea-repositories.
|
||||
- Git LFS Root Path: Leave the default /var/lib/gitea/data/lfs.
|
||||
- Run As Username: git
|
||||
- SSH Server Domain: gitea.maboiteverte.fr
|
||||
- SSH Port: 22, change it if SSH is listening on other Port
|
||||
- Gitea HTTP Listen Port: 3000
|
||||
- Gitea Base URL: https://gitea.maboiteverte.fr
|
||||
- Log Path: Leave the default /var/lib/gitea/log
|
||||
|
||||
##### Server and other services settings:
|
||||
|
||||
cocher:
|
||||
|
||||
- Disable Self-registration
|
||||
- Enable Require Sign in to view pages
|
||||
|
||||
##### Admin Account Settings:
|
||||
|
||||
on crée un compte administrateur pour Gitea.
|
||||
|
||||
#### Sécuriser le fichier de config:
|
||||
|
||||
```bash
|
||||
$ sudo chmod 750 /etc/gitea
|
||||
$ sudo chmod 640 /etc/gitea/app.ini
|
||||
```
|
||||
|
||||
Configurer les notifications emails:
|
||||
|
||||
```bash
|
||||
$sudo nano /etc/gitea/app.ini
|
||||
|
||||
# Ajouter:
|
||||
[mailer]
|
||||
ENABLED = true
|
||||
HOST = ssl0.ovh.net:465
|
||||
FROM = bruno@clicclac.info
|
||||
USER = bruno@clicclac.info
|
||||
PASSWD = xxx
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Fichier de config app.ini:
|
||||
|
||||
```ini
|
||||
APP_NAME = Gitea: Git with a cup of tea
|
||||
RUN_USER = git
|
||||
RUN_MODE = prod
|
||||
|
||||
[oauth2]
|
||||
JWT_SECRET = pR6yqgc-yBWVDDH83xZknCKmm6OkOYe1-lQF6w4QZCM
|
||||
|
||||
[security]
|
||||
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1ODkwMzkxMDF9.0ndONUH1YHloYbEJjuMEuOfvmHaQ86xigzQWv8E0BZY
|
||||
INSTALL_LOCK = true
|
||||
SECRET_KEY = vD6g09GpvXk0iuM6U1uwcFc2fm5xykkLvYmib88Er7OZOwlSMdp1MjrmNkot6KZz
|
||||
|
||||
[database]
|
||||
DB_TYPE = mysql
|
||||
HOST = 127.0.0.1:3306
|
||||
NAME = admin_gitea
|
||||
USER = adm_gitea
|
||||
PASSWD = 2X5$7isg
|
||||
SSL_MODE = disable
|
||||
CHARSET = utf8mb4
|
||||
PATH = /var/lib/gitea/data/gitea.db
|
||||
|
||||
[repository]
|
||||
ROOT = /home/git/gitea-repositories
|
||||
|
||||
[server]
|
||||
SSH_DOMAIN = gitea.maboiteverte.fr
|
||||
DOMAIN = gitea.maboiteverte.fr
|
||||
HTTP_PORT = 3000
|
||||
ROOT_URL = https://gitea.maboiteverte.fr:3000/
|
||||
DISABLE_SSH = false
|
||||
SSH_PORT = 22
|
||||
LFS_START_SERVER = true
|
||||
LFS_CONTENT_PATH = /var/lib/gitea/data/lfs
|
||||
LFS_JWT_SECRET = it_832yGFx-X9yLKg2otEiG7qyNa12p3C7S8VZbRVeM
|
||||
OFFLINE_MODE = false
|
||||
|
||||
[mailer]
|
||||
ENABLED = true
|
||||
HOST = ssl0.ovh.net:465
|
||||
FROM = bruno@clicclac.info
|
||||
USER = bruno@clicclac.info
|
||||
PASSWD = dt7ek7wA6
|
||||
|
||||
[service]
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
ENABLE_NOTIFY_MAIL = false
|
||||
DISABLE_REGISTRATION = false
|
||||
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
|
||||
ENABLE_CAPTCHA = false
|
||||
REQUIRE_SIGNIN_VIEW = false
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||
DEFAULT_ENABLE_TIMETRACKING = true
|
||||
NO_REPLY_ADDRESS = noreply.maboiteberte.fr
|
||||
|
||||
[picture]
|
||||
DISABLE_GRAVATAR = false
|
||||
ENABLE_FEDERATED_AVATAR = true
|
||||
|
||||
[openid]
|
||||
ENABLE_OPENID_SIGNIN = true
|
||||
ENABLE_OPENID_SIGNUP = true
|
||||
|
||||
[session]
|
||||
PROVIDER = file
|
||||
|
||||
[log]
|
||||
MODE = file
|
||||
LEVEL = info
|
||||
ROOT_PATH = /var/lib/gitea/log
|
||||
|
||||
|
||||
```
|
||||
|
||||
Redémarrer Gitea:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl restart gitea
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Mettre à jour Gitea:
|
||||
|
||||
Arrêter le service:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl stop gitea
|
||||
```
|
||||
|
||||
Télécharger la dernière version:
|
||||
|
||||
```bash
|
||||
VERSION=<THE_LATEST_GITEA_VERSION>
|
||||
wget -O /tmp/gitea https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-linux-amd64
|
||||
sudo mv /tmp/gitea /usr/local/bin
|
||||
sudo chmod +x /usr/local/bin/gitea
|
||||
```
|
||||
|
||||
Redémarrer le service:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl restart gitea
|
||||
```
|
||||
|
||||
|
||||
|
||||
*Configurer SSL pour le sous-domaine pour Gitea:*
|
||||
|
||||
Avoir un sous-domaine pour Gitea
|
||||
https://gitea.maboiteverte.fr
|
||||
|
||||
|
||||
```bash
|
||||
DOMAIN=gitea.maboiteverte.fr
|
||||
[server]
|
||||
PROTOCOL=https
|
||||
ENABLE_LETSENCRYPT=true
|
||||
LETSENCRYPT_ACCEPTTOS=true
|
||||
LETSENCRYPT_DIRECTORY=https
|
||||
LETSENCRYPT_EMAIL=bruno@clicclac.info
|
||||
```
|
||||
|
||||
```bash
|
||||
cd /etc/gitea
|
||||
mkdir keys
|
||||
chown root:git keys/
|
||||
```
|
||||
|
||||
```bash
|
||||
root@localhost:/opt/psa/var/modules/letsencrypt/etc/live/gitea.maboiteverte.fr# cp privkey.pem /etc/gitea/keys/privkey.pem
|
||||
root@localhost:/opt/psa/var/modules/letsencrypt/etc/live/gitea.maboiteverte.fr# cp fullchain.pem /etc/gitea/keys/fullchain.pem
|
||||
```
|
||||
|
||||
```bash
|
||||
chown -R root:git /etc/gitea/keys
|
||||
```
|
||||
|
||||
Certifcats pour le domaine gitea.maboiteverte.fr
|
||||
|
||||
```bash
|
||||
/opt/psa/var/modules/sslit/etc/live/gitea.maboiteverte.fr/cert.pem
|
||||
/opt/psa/var/modules/sslit/etc/live/gitea.maboiteverte.fr/chain.pem
|
||||
/opt/psa/var/modules/sslit/etc/live/gitea.maboiteverte.fr/fullchain.pem
|
||||
/opt/psa/var/modules/sslit/etc/live/gitea.maboiteverte.fr/privkey.pem
|
||||
|
||||
/opt/psa/var/modules/letsencrypt/etc/live/gitea.maboiteverte.fr/cert.pem
|
||||
/opt/psa/var/modules/letsencrypt/etc/live/gitea.maboiteverte.fr/chain.pem
|
||||
/opt/psa/var/modules/letsencrypt/etc/live/gitea.maboiteverte.fr/fullchain.pem
|
||||
/opt/psa/var/modules/letsencrypt/etc/live/gitea.maboiteverte.fr/privkey.pem
|
||||
```
|
||||
|
||||
This directory contains your keys and certificates.
|
||||
|
||||
`privkey.pem` : the private key for your certificate.
|
||||
`fullchain.pem`: the certificate file used in most server software.
|
||||
`chain.pem` : used for OCSP stapling in Nginx >=1.3.7.
|
||||
`cert.pem` : will break many server configurations, and should not be used without reading further documentation (see link below).
|
||||
|
||||
We recommend not moving these files. For more information, see the Certbot
|
||||
User Guide at https://certbot.eff.org/docs/using.html#where-are-my-certificates .
|
||||
|
||||
A ajouter à l'app.ini
|
||||
|
||||
```ini
|
||||
SSLCertificateFile /opt/psa/var/modules/letsencrypt/etc/live/gitea.maboiteverte.fr/cert.pem
|
||||
SSLCertificateKeyFile /opt/psa/var/modules/letsencrypt/etc/live/gitea.maboiteverte.fr/privkey.pem
|
||||
SSLCertificateChainFile /opt/psa/var/modules/letsencrypt/etc/live/gitea.maboiteverte.fr/chain.pem
|
||||
# /opt/psa/var/modules/letsencrypt/etc/live/gitea.maboiteverte.fr/fullchain.pem
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Dépots
|
||||
|
||||
```bash
|
||||
#ssh: git@gitea.maboiteverte.fr:bruno/yuzu-child_mbv.git
|
||||
#https: https://gitea.maboiteverte.fr:3000/bruno/yuzu-child_mbv.git
|
||||
|
||||
git remote add gitea https://gitea.maboiteverte.fr:3000/bruno/yuzu-child_mbv.git
|
||||
git remote add gitea git@gitea.maboiteverte.fr:bruno/yuzu-child_mbv.git
|
||||
git push -u gitea master
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Sécuriser Gitea:
|
||||
|
||||
```bash
|
||||
sudo chmod 750 /etc/gitea
|
||||
sudo chmod 640 /etc/gitea/app.ini
|
||||
```
|
||||
|
||||
#### Empêcher l'indexation des pages de Gitea:
|
||||
|
||||
```bash
|
||||
root@localhost:/etc/gitea# mkdir custom
|
||||
root@localhost:/etc/gitea# cd custom/
|
||||
root@localhost:/etc/gitea/custom# nano robots.txt
|
||||
|
||||
# Ajouter les deux lignes suivantes pour interdire l'indexation des pages du site :
|
||||
|
||||
User-agent: *
|
||||
Disallow: /
|
||||
|
||||
root@localhost:/etc/gitea/custom# cd ..
|
||||
root@localhost:/etc/gitea# chown -R root:git custom/
|
||||
sudo service gitea restart
|
||||
```
|
||||
|
||||
#### Une fois les utilisateurs ajoutés, désactiver le formulaire d'inscription pour minimiser les tentatives de spam.
|
||||
|
||||
```bash
|
||||
sudo nano /etc/gitea/app.ini
|
||||
|
||||
# Passer false à true pour désactiver l'inscription.
|
||||
|
||||
DISABLE_REGISTRATION = true
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Push and create
|
||||
|
||||
Il est possible de pousser et créer un dépôt, même si celui-ci n'existe pas encore sur Gitea (ssh obligatoire).
|
||||
|
||||
```bash
|
||||
# On ajoute le dépôt distant (creator-child_mbv.git) qui n'existe pas encore:
|
||||
git remote add gitea git@gitea.maboiteverte.fr:bruno/creator-child_mbv.git
|
||||
|
||||
# Push to create n'est pas permis pour les organisations
|
||||
|
||||
# On pousse le dépot local
|
||||
git push -u gitea master
|
||||
Enumerating objects: 236, done.
|
||||
Counting objects: 100% (236/236), done.
|
||||
Delta compression using up to 8 threads
|
||||
Compressing objects: 100% (232/232), done.
|
||||
Writing objects: 100% (236/236), 670.57 KiB | 6.77 MiB/s, done.
|
||||
Total 236 (delta 85), reused 0 (delta 0), pack-reused 0
|
||||
remote: Resolving deltas: 100% (85/85), done.
|
||||
remote: . Processing 1 references
|
||||
remote: Processed 1 references in total
|
||||
To gitea.maboiteverte.fr:bruno/creator-child_mbv.git
|
||||
|
||||
* [new branch] master -> master
|
||||
Branch 'master' set up to track remote branch 'master' from 'gitea'.
|
||||
|
||||
# Le dépôt distant creator-child_mbv.git a bien été crée.
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Backup / Restore
|
||||
|
||||
#### Backup:
|
||||
|
||||
```bash
|
||||
su git
|
||||
/usr/local/bin/gitea dump -c /etc/gitea/app.ini
|
||||
|
||||
# Crée une archive dans le home de git:
|
||||
/home/git/gitea-dump-1589130582.zip
|
||||
```
|
||||
|
||||
#### Restore:
|
||||
|
||||
https://docs.gitea.io/en-us/backup-and-restore/#restore-command-restore
|
||||
|
||||
|
||||
|
||||
#### Transférér un dépot vers une organisation:
|
||||
|
||||
Dépot -> paramètres -> Zone de danger -> Changer de propriétaire
|
||||
|
||||
|
||||
|
||||
### Personnaliser:
|
||||
|
||||
https://docs.gitea.io/en-us/customizing-gitea/
|
||||
|
||||
#### Ajouter un lien dans la barre de navigation:
|
||||
|
||||
```bash
|
||||
# Ajouter un fichier extra_links.tmpl
|
||||
|
||||
$ nano /var/lib/gitea/custom/templates/custom/extra_links.tmpl
|
||||
|
||||
<a class="item" href="https://maboiteverte.fr">maboiteverte.fr</a>
|
||||
|
||||
# Redémarrer Gitea
|
||||
$ sudo service gitea restart
|
||||
```
|
||||
|
||||
#### Ajouter un lien dans la barre de navigation inférieure:
|
||||
|
||||
```bash
|
||||
# Ajouter un fichier extra_links_footer.tmpl
|
||||
|
||||
$ nano /var/lib/gitea/custom/templates/custom/extra_links_footer.tmpl
|
||||
|
||||
<a class="item" href="{{AppSubUrl}}/privacy.html">Privacy Policy</a>
|
||||
|
||||
$ cd /var/lib/gitea/custom/public
|
||||
privacy.html
|
||||
|
||||
# Redémarrer Gitea
|
||||
$ sudo service gitea restart
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Liens
|
||||
|
||||
https://wiki.visionduweb.fr/index.php?title=Installer_un_serveur_Git_avec_Gitea#Copier_les_certificats_SSL_de_Let.27s_Encrypt_vers_le_r.C3.A9pertoire_keys_cr.C3.A9.C3.A9_pour_Gitea
|
||||
https://charlesreid1.github.io/setting-up-a-self-hosted-github-clone-with-gitea.html
|
||||
https://www.howtoforge.com/tutorial/how-to-install-gitea-with-https-on-debian-10/
|
||||
https://clouding.io/hc/en-us/articles/360011461459-How-to-Install-Gitea-Git-Service-on-Ubuntu-18-04
|
||||
https://linuxize.com/post/how-to-install-gitea-on-ubuntu-18-04/
|
||||
https://computingforgeeks.com/how-to-install-gitea-git-service-on-ubuntu/
|
||||
https://golb.hplar.ch/2018/06/self-hosted-git-server.html
|
||||
|
||||
https://mike42.me/blog/2019-05-how-to-integrate-gitea-and-jenkins
|
||||
https://wiki.evolix.org/HowtoGitea
|
||||
|
||||
Webhook
|
||||
|
||||
https://blog.samuel.domains/blog/tutorials/static-websites-automatic-deployment-with-gitea-an-example-with-jekyllhttps://support.gitkraken.com/integrations/authentication/
|
||||
https://organicdesign.nz/Gitea
|
||||
42
docs/Plesk/git.md
Normal file
42
docs/Plesk/git.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Repo git dans un domaine
|
||||
|
||||
|
||||
|
||||
#### Créer un dépôt:
|
||||
|
||||
1. Aller sur le <u>Domaine</u> -> <u>Git</u>
|
||||
2. Cliquer sur <u>Ajouter un dépot git</u>
|
||||
3. Sélectionner <u>Dépôt local sur votre poste de travail</u>
|
||||
4. <u>Dépôt Git dans Plesk</u>: rentrer le nom du dépôt *wp_yuzu-child.git*
|
||||
5. <u>Votre site Web</u>: choisir *Non déploiement*
|
||||
|
||||
|
||||
|
||||
Le dépôt est alors crée. Son url est:
|
||||
|
||||
- ssh: bruno@maboiteverte.fr:~/git/wp_yuzu-child.git
|
||||
- https: https://bruno@maboiteverte.fr/plesk-git/wp_yuzu-child.git
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
bruno@localhost:~/git$ l
|
||||
total 20
|
||||
drwxr-xr-x 5 bruno psacln 4096 May 8 08:47 .
|
||||
drwx--x--- 15 bruno psaserv 4096 May 7 17:35 ..
|
||||
drwxr-xr-x 7 bruno psacln 4096 May 8 08:25 batch.git
|
||||
drwxr-xr-x 7 bruno psacln 4096 May 7 20:13 mkdocs.git
|
||||
drwxr-xr-x 7 bruno psacln 4096 May 8 08:47 wp_yuzu-child.git
|
||||
```
|
||||
|
||||
Il s'agit d'un dépôt --bare
|
||||
|
||||
```bash
|
||||
bruno@localhost:~/git/wp_yuzu-child.git$ nano config
|
||||
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = true
|
||||
```
|
||||
|
||||
@@ -102,3 +102,11 @@ Réparer les permissions d'un site:
|
||||
plesk repair fs example.com
|
||||
```
|
||||
|
||||
|
||||
|
||||
[git](git.md)
|
||||
|
||||
[Ghost](Ghost.md)
|
||||
|
||||
[nextcloud](nextcloud.md)
|
||||
|
||||
|
||||
31
docs/Windows/commandes.md
Normal file
31
docs/Windows/commandes.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Commandes
|
||||
|
||||
|
||||
|
||||
| No | Use this command | To do this |
|
||||
| ---- | ---------------- | ----------------------------------------- |
|
||||
| 1 | appwiz.cpl | Open Programs and Features |
|
||||
| 2 | compmgmt | Open Computer Management |
|
||||
| 3 | control | Open Control Panel |
|
||||
| 4 | cleanmgr | Open Disk Cleanup |
|
||||
| 5 | devmgmt | Open Device Manager |
|
||||
| 6 | diskmgmt | Open Disk Management |
|
||||
| 7 | eventvwr | Open Event Viewer |
|
||||
| 8 | hdwwiz | Start Add Hardware Wizard |
|
||||
| 9 | mmc | Open Microsoft Management Console |
|
||||
| 10 | msconfig | Open System Configuration |
|
||||
| 11 | msinfo32 | Open System Information |
|
||||
| 12 | mstsc | Open Remote Desktop Connection |
|
||||
| 13 | netplwiz | Open Advanced User Accounts Control Panel |
|
||||
| 14 | ncpa.cpl | Open Network Connections |
|
||||
| 15 | perfmon | Open Performance Monitor |
|
||||
| 16 | sysdm.cpl | Open System Properties |
|
||||
| 17 | resmon | Open Resoure Monitor |
|
||||
| 18 | rstrui | Start System Restore Wizard |
|
||||
| 19 | services.msc | Open Windows Services |
|
||||
| 20 | sdclt | Open Backup and Restore (Windows 7) |
|
||||
| 21 | slui | Open Windows Activation |
|
||||
| 22 | taskmgr | Open Task Manager |
|
||||
| 23 | taskschd | Open Task Scheduler |
|
||||
| 24 | wf | Open Windows Defender Firewall settings |
|
||||
| 25 | winver | Show Windows version |
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
[Windows Terminal](Terminal.md)
|
||||
|
||||
[WSL (Windows Sub Linux)](wsl.md)
|
||||
WSL (Windows Sub Linux) [Installer](wsl.md) - [Personnaliser](wsl_2.md)
|
||||
|
||||
[Trucs](trucs.md)
|
||||
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
# WSL
|
||||
# Installer WSL
|
||||
|
||||
|
||||
|
||||
### WSL 2 (installation)
|
||||
|
||||
Nécessite une <u>insider build</u> (31/03/2020)
|
||||
Nécessite au minimum la build 2004 (une <u>insider build</u> au 31/03/2020)
|
||||
Aller à Fonctionnalités de Windows:
|
||||
|
||||
- installer <u>Plateforme d'ordinateur virtuel</u> (Virtual Machine Platform)
|
||||
- installer <u>Sous-système Windows pour Linux</u> (Windows Subsystem for Linux)
|
||||
|
||||
Activer la virtualisation dans le BIOS.
|
||||
|
||||
- Asus: Advanced -> Configuration Processeur -> Virtualisation Techno: Intel (VMY) Virtualisation Technology
|
||||
- Gigabyte:
|
||||
|
||||
Pour voir, si elle est active, aller dans le Gestionnaire de taches -> onglet Performance
|
||||
|
||||
Pour Parallels Desktop, aller dans Configuration -> Matériel -> CPU et mémoire -> Paramètres avancés, et cocher <u>Activer la virtualisation imbriquée</u>.
|
||||
|
||||
Aller sur le Microsoft Store et installer une distrib Linux.
|
||||
@@ -198,11 +205,6 @@ cat ~/.ssh/id_rsa.pub | clip.exe
|
||||
|
||||
|
||||
|
||||
### VScode et wsl:
|
||||
|
||||
Afficher la palette de commande (Ctrl+Maj+P) et entrer <u>Remote-WSL: New Window</u>
|
||||
Depuis le terminal, taper `code .` ou `code-insiders .`
|
||||
|
||||
Lancer des commandes Linux depuis l'Invite de commandes ou Powershell:
|
||||
|
||||
```
|
||||
@@ -221,16 +223,6 @@ C:\Users\enzo2>wsl ls -la "/mnt/c/Program Files"
|
||||
|
||||
|
||||
|
||||
###Changer les couleurs pour **ls**:
|
||||
```
|
||||
LS_COLORS="ow=01;36;40" && export LS_COLORS
|
||||
```
|
||||
|
||||
cd utilise les couleurs ls.
|
||||
|
||||
```bash
|
||||
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
```
|
||||
|
||||
### =>[La suite (configurer wsl)](wsl2.md)<=
|
||||
296
docs/Windows/wsl_2.md
Normal file
296
docs/Windows/wsl_2.md
Normal file
@@ -0,0 +1,296 @@
|
||||
# Personnaliser WSL
|
||||
|
||||
|
||||
|
||||
### PowerShell
|
||||
|
||||
#### Installer git:
|
||||
|
||||
```powershell
|
||||
PS choco install git.install --params "/GitAndUnixToolsOnPath /NoGitLfs /NoAutoCrlf"
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer Posh-Git and Oh-My-Posh:
|
||||
|
||||
https://github.com/JanDeDobbeleer/oh-my-posh?WT.mc_id=-blog-scottha
|
||||
|
||||
```powershell
|
||||
PS Install-Module posh-git -Scope CurrentUser
|
||||
PS Install-Module oh-my-posh -Scope CurrentUser
|
||||
```
|
||||
|
||||
Si PowerShell a besoin de NuGet, il propose de l'installer:
|
||||
|
||||
```powershell
|
||||
PS Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
```
|
||||
|
||||
|
||||
|
||||
```powershell
|
||||
Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Configuration de PowerShell:
|
||||
|
||||
Exécuter "notepad $PROFILE" et ajouter à la fin:
|
||||
|
||||
```powershell
|
||||
Import-Module posh-git
|
||||
Import-Module oh-my-posh
|
||||
Set-Theme Paradox
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer les polices:
|
||||
|
||||
Depuis WSL (linux)
|
||||
|
||||
```bash
|
||||
|
||||
# clone
|
||||
git clone https://github.com/powerline/fonts.git --depth=1
|
||||
# install
|
||||
cd fonts
|
||||
./install.sh
|
||||
# clean-up a bit
|
||||
cd ..
|
||||
rm -rf fonts
|
||||
```
|
||||
|
||||
Depuis PowerShell
|
||||
|
||||
```powershell
|
||||
# clone
|
||||
git clone https://github.com/powerline/fonts.git --depth=1
|
||||
# install
|
||||
cd fonts
|
||||
.\install.ps1
|
||||
#clean up
|
||||
cd ..
|
||||
rd /S /Q fonts
|
||||
```
|
||||
|
||||
|
||||
|
||||
### WSL
|
||||
|
||||
#### Installer zsh:
|
||||
|
||||
```bash
|
||||
$ sudo apt-get install zsh curl git
|
||||
|
||||
$ chsh -s $(which zsh)
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer antibody:
|
||||
|
||||
```bash
|
||||
$ curl -sfL git.io/antibody | sudo sh -s - -b /usr/local/bin
|
||||
[sudo] password for bruno:
|
||||
getantibody/antibody info checking GitHub for latest tag
|
||||
getantibody/antibody info found version: 6.0.1 for v6.0.1/Linux/x86_64
|
||||
getantibody/antibody info installed /usr/local/bin/antibody
|
||||
```
|
||||
|
||||
On restaure .zshrc .zsh_plugins.txt .dircolors
|
||||
|
||||
```bash
|
||||
$ curl https://clicclac.info/backup/zsh_win10.tar.gz | tar -xzv
|
||||
```
|
||||
|
||||
On met à jour les plugins antibody
|
||||
|
||||
```bash
|
||||
$ antibody bundle < ~/.zsh_plugins.txt > ~/.zsh_plugins.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer z plugin:
|
||||
|
||||
```bash
|
||||
$ cd /usr/local/etc/profile.d/z/
|
||||
|
||||
#Créer les dossiers profile.d et z si ils n'existent pas.
|
||||
|
||||
#Cloner le répertoire
|
||||
git clone https://github.com/rupa/z.git
|
||||
```
|
||||
|
||||
Ajouter la ligne suivante au .zshrc
|
||||
|
||||
```bash
|
||||
. /usr/local/etc/profile.d/z/z.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
### SSH
|
||||
|
||||
#### Générer une paire de clé ssh sous Windows:
|
||||
|
||||
```powershell
|
||||
PS ssh-keygen
|
||||
Generating public/private rsa key pair.
|
||||
Enter file in which to save the key (C:\Users\bruno/.ssh/id_rsa):
|
||||
Created directory 'C:\Users\bruno/.ssh'.
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Copier les clés dans wsl:
|
||||
|
||||
```bash
|
||||
$ cp -r /mnt/c/Users/<username>/.ssh ~/.ssh
|
||||
|
||||
# Corriger les autorisations:
|
||||
$ chmod 700 ~/.ssh
|
||||
$ chmod 600 ~/.ssh/*
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Installer keychain dans wsl:
|
||||
|
||||
```bash
|
||||
$ sudo apt install keychain
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Copier la clé sur le serveur:
|
||||
|
||||
```bash
|
||||
cat ~/.ssh/id_rsa.pub | ssh bruno@maboiteverte.fr 'cat>> ~/.ssh/authorized_keys'
|
||||
cat ~/.ssh/id_rsa.pub | ssh sentier@sur-le-sentier.fr 'cat>> ~/.ssh/authorized_keys'
|
||||
cat ~/.ssh/id_rsa.pub | ssh -p42666 bruno@clicclac.synology.me 'cat>> ~/.ssh/authorized_keys'
|
||||
```
|
||||
|
||||
Si il n'y a qu'une seule clé sur le serveur (scp écrase authorized_keys)
|
||||
|
||||
```bash
|
||||
scp -P42666 C:\Users\bruno\.ssh\id_rsa.pub bruno@clicclac.synology.me:~/.ssh/authorized_keys
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Ne plus demander la passphrase ssh:
|
||||
|
||||
https://medium.com/@glsorre/windows-subsystem-for-linux-never-prompt-your-ssh-passphrase-again-353db7c931ab
|
||||
|
||||
<u>Installer CredentialManager:</u>
|
||||
|
||||
```powershell
|
||||
PS Install-Module -Name CredentialManager
|
||||
```
|
||||
|
||||
<u>Copier les 2 fichiers suivants dans</u> `/home/[YOUR_WSL_USERNAME]/wslu/`
|
||||
|
||||
*keychain.ps1:*
|
||||
|
||||
```powershell
|
||||
$credentials = Get-StoredCredential -Target sshpassphrase
|
||||
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($credentials.Password)
|
||||
$passphrase = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
|
||||
C:\Windows\System32\wsl.exe -u [YOUR_WSL_USERNAME] -d [YOUR_DISTRIBUTION] /home/[YOUR_WSL_USERNAME]/wslu/keychain.sh $passphrase
|
||||
```
|
||||
|
||||
*keychain.sh:*
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
SSH_ASKPASS_SCRIPT=/tmp/ssh-askpass-script
|
||||
cat > ${SSH_ASKPASS_SCRIPT} <<EOL
|
||||
#!/bin/bash
|
||||
echo "$1"
|
||||
EOL
|
||||
chmod u+x ${SSH_ASKPASS_SCRIPT}
|
||||
export DISPLAY="0"
|
||||
export SSH_ASKPASS=${SSH_ASKPASS_SCRIPT}
|
||||
/usr/bin/keychain --clear id_rsa
|
||||
rm ${SSH_ASKPASS_SCRIPT}
|
||||
```
|
||||
|
||||
<u>Ouvrir dans le Gestionnaire d'identification:</u>
|
||||
|
||||
*Panneaux de configuration -> Gestionnaire d'identification -> Information d'identification Windows -> Ajouter des informations d'identification génériques*
|
||||
|
||||
- Adresse Internet ou réseau: sshpassphrase *(le mot passphrase)*
|
||||
- Nom d'utilisateur: sshpassphrase *(le mot passphrase)*
|
||||
- Mot de passe: <sshpassphrase> *(la passphrase)*
|
||||
|
||||
<u>Ouvrir le Planificateur de taches:</u>
|
||||
|
||||
*Panneaux de configuration -> Outils d'administration -> Planificateur de taches -> Créer une tache de base*
|
||||
|
||||
- Général:
|
||||
|
||||
- Mettre un nom: Launch Keychain
|
||||
|
||||
- Configuré pour Windows 10
|
||||
- Déclencheur:
|
||||
- quand j'ouvre une session
|
||||
|
||||
- Action: démarrer un programme
|
||||
- Programme/script: powershell
|
||||
- Ajouter des arguments: -File C:\Users\bruno\wslu\keychain.ps1
|
||||
|
||||
|
||||
|
||||
### VS Code
|
||||
|
||||
#### Avoir VisualCode en français:
|
||||
|
||||
Rechercher 'French language' dans les extensions
|
||||
|
||||
####
|
||||
|
||||
#### VScode et wsl:
|
||||
|
||||
Afficher la palette de commande (Ctrl+Maj+P) et entrer <u>Remote-WSL: New Window</u>
|
||||
Depuis le terminal, taper `code .` ou `code-insiders .`
|
||||
|
||||
La commande `code` est dispo depuis le terminal. Si elle ne l'est pas, vérifier que VS Code est dans le `PATH`.
|
||||
|
||||
Sinon ajouter la ligne suivante au `.zshrc`
|
||||
|
||||
```bash
|
||||
# VS Code
|
||||
export PATH="/mnt/c/Program Files/Microsoft VS Code/bin:$PATH"
|
||||
```
|
||||
|
||||
####
|
||||
|
||||
###Changer les couleurs pour **ls**:
|
||||
|
||||
```
|
||||
LS_COLORS="ow=01;36;40" && export LS_COLORS
|
||||
```
|
||||
|
||||
cd utilise les couleurs ls.
|
||||
|
||||
```bash
|
||||
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Fin
|
||||
|
||||
```bash
|
||||
$ uname --release
|
||||
4.19.84-microsoft-standard
|
||||
|
||||
# 08-08-2020
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user