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

Avr 20

Installation d’un terminal Retro

Installation d’un terminal Retro.

Distribution : Lubuntu 16.04 LTS

1/ Installation des paquets de développement.

util01@station01:~$ sudo apt-get install build-essential qmlscene qt5-qmake qt5-default qtdeclarative5-dev qml-module-qtquick-controls qtdeclarative5-qtquick2-plugin libqt5qml-graphicaleffects qml-module-qtquick-dialogs qtdeclarative5-localstorage-plugin qtdeclarative5-window-plugin

2/ Répertoire de travail.

util01@station01:~$ mkdir -p UTIL/RetroTerm
util01@station01:~$ cd UTIL/RetroTerm/

3/ Téléchargement du code source.

util01@station01:~/UTIL/RetroTerm$ git clone --recursive https://github.com/Swordfish90/cool-retro-term.git
util01@station01:~/UTIL/RetroTerm$ cd cool-retro-term/
util01@station01:~/UTIL/RetroTerm/cool-retro-term$ 

4/ Compilation.

util01@station01:~/UTIL/RetroTerm/cool-retro-term$ qmake && make

5/ Lancement du terminal Retro.

util01@station01:~/UTIL/RetroTerm/cool-retro-term$ ./cool-retro-term 

6/ Lien.

https://github.com/Swordfish90/cool-retro-term

Avr 18

[Qemu] Changement de résolution d’écran

[Qemu] Changement de résolution d’écran

Ouvrir :

/etc/default/grub

Chercher :

GRUB_GFXMODE

Remplacer par :

GRUB_GFXMODE=1024x768

Action :

# grub-mkconfig -o /boot/grub/grub.cfg

Liens :

https://askubuntu.com/questions/728664/stuck-at-800×600-display-resolution-ubuntu-14?rq=1
http://www.itzgeek.com/how-tos/mini-howtos/change-default-network-name-ens33-to-old-eth0-on-ubuntu-16-04.html

Avr 17

Mise-à-jour d’une instance Mastodon vers la version stable v1.2

Mise-à-jour d’une instance Mastodon vers la version stable v1.2

Sommaire

1/ Connexion au serveur.
2/ Arrêt des services Mastodon.
3/ Connexion à l’utilisateur mastodon.
4/ Sauvegarde de rbenv.
5/ Mise-à-jour de Ruby en 2.4.1
6/ Exportation de la base de donnée.
7/ Sauvegarde du répertoire live/, création de l’archive.
8/ Téléchargement de toute les modifications.
9/ Checkout de la branche stable v1.2.
10/ Vérification.
11/ Installation de rails.
12/ Mise-à-jour de Yarn.
13/ Mise-à-jour des assets et de la base de données.
14/ Démarrage des services.
15/ Liens.

Procédure

1/ Connexion au serveur.

[~] ➔ ssh admin@185.26.125.41
admin@185.26.125.41's password: 
...
admin@server01mas:~$ 

2/ Arrêt des services Mastodon.

admin@server01mas:~$ su
Password: 
root@server01mas:/home/admin# 
root@server01mas:/home/admin# systemctl stop mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service
root@server01mas:/home/admin# exit
exit
admin@server01mas:~$ 

3/ Connexion à l’utilisateur mastodon.

admin@server01mas:~$ su mastodon
Password: 
mastodon@server01mas:/home/admin$ cd
mastodon@server01mas:~$

4/ Sauvegarde de rbenv.

mastodon@server01mas:~$ tar cvfz rbenv.tar.gz .rbenv

5/ Mise-à-jour de Ruby en 2.4.1

mastodon@server01mas:~$ rm .rbenv/ -rf
mastodon@server01mas:~$
mastodon@server01mas:~$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
mastodon@server01mas:~$
mastodon@server01mas:~$ type rbenv
rbenv is a function
rbenv () 
{ 
    local command;
    command="$1";
    if [ "$#" -gt 0 ]; then
        shift;
    fi;
    case "$command" in 
        rehash | shell)
            eval "$(rbenv "sh-$command" "$@")"
        ;;
        *)
            command rbenv "$command" "$@"
        ;;
    esac
}
mastodon@server01mas:~$ 
mastodon@server01mas:~$ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Cloning into '/home/mastodon/.rbenv/plugins/ruby-build'...
remote: Counting objects: 7484, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 7484 (delta 5), reused 0 (delta 0), pack-reused 7467
Receiving objects: 100% (7484/7484), 1.51 MiB | 0 bytes/s, done.
Resolving deltas: 100% (4528/4528), done.
Checking connectivity... done.
mastodon@server01mas:~$
mastodon@server01mas:~$ rbenv install 2.4.1
Downloading ruby-2.4.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.bz2
Installing ruby-2.4.1...
Installed ruby-2.4.1 to /home/mastodon/.rbenv/versions/2.4.1
mastodon@server01mas:~$
mastodon@server01mas:~$ rbenv global 2.4.1
mastodon@server01mas:~$
mastodon@server01mas:~$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
mastodon@server01mas:~$

6/ Exportation de la base de donnée.

mastodon@server01mas:~$ pg_dump postgres > postgres.pgsql
mastodon@server01mas:~$
mastodon@server01mas:~$ ls -lh postgres.pgsql 
-rw-r--r-- 1 mastodon mastodon 902 Apr 17 10:08 postgres.pgsql
mastodon@server01mas:~$

7/ Sauvegarde du répertoire live/, création de l’archive.

mastodon@server01mas:~$ tar cvfz live.tar.gz live
mastodon@server01mas:~$
mastodon@server01mas:~$ ls -lh live.tar.gz 
-rw-r--r-- 1 mastodon mastodon 575M Apr 17 10:19 live.tar.gz
mastodon@server01mas:~$

8/ Téléchargement de toute les modifications.

mastodon@server01mas:~$ cd live
mastodon@server01mas:~/live$ git fetch --all
Fetching origin
remote: Counting objects: 4715, done.
remote: Total 4715 (delta 1801), reused 1801 (delta 1801), pack-reused 2913
Receiving objects: 100% (4715/4715), 1.60 MiB | 0 bytes/s, done.
Resolving deltas: 100% (3338/3338), completed with 411 local objects.
From https://github.com/Gargron/mastodon
   5f54981..64e1d51  master     -> origin/master
 * [new branch]      blackle-master -> origin/blackle-master
 * [new branch]      fix-admin-reset-password -> origin/fix-admin-reset-password
 * [new branch]      fix-recovery-codes-design -> origin/fix-recovery-codes-design
 * [new branch]      skylight   -> origin/skylight
 * [new branch]      yiskah-patch-1 -> origin/yiskah-patch-1
 * [new tag]         v1.1       -> v1.1
 * [new tag]         v1.1.1     -> v1.1.1
 * [new tag]         v1.1.2     -> v1.1.2
 * [new tag]         v1.2       -> v1.2
mastodon@server01mas:~/live$

9/ Checkout de la branche stable v1.2.

mastodon@server01mas:~/live$ git checkout tags/v1.2 -b v1.2
Switched to a new branch 'v1.2'
...
mastodon@server01mas:~/live$

10/ Vérification.

mastodon@server01mas:~/live$ git status
On branch v1.2
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	npm-debug.log
	vendor/bundle/

nothing added to commit but untracked files present (use "git add" to track)
mastodon@server01mas:~/live$ 

11/ Installation de rails.

mastodon@server01mas:~/live$ gem install rails
Fetching: i18n-0.8.1.gem (100%)
Successfully installed i18n-0.8.1
...
Fetching: rails-5.0.2.gem (100%)
Successfully installed rails-5.0.2
36 gems installed
mastodon@server01mas:~/live$
mastodon@server01mas:~/live$ bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Installing rake 12.0.0
Installing concurrent-ruby 1.0.5
...
Installing devise-two-factor 3.0.0
Bundle complete! 80 Gemfile dependencies, 135 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into ./vendor/bundle.
...
mastodon@server01mas:~/live$ 

12/ Mise-à-jour de Yarn.

mastodon@server01mas:~/live$ npm upgrade yarn
mastodon@server01mas:~/live
mastodon@server01mas:~/live$ yarn install
yarn install v0.21.3
[1/4] Resolving packages...
...
info To upgrade, run the following command:
$ npm upgrade --global yarn
Done in 38.32s.
mastodon@server01mas:~/live$ 

13/ Mise-à-jour des assets et de la base de données.

mastodon@server01mas:~/live$ RAILS_ENV=production bundle exec rails assets:clean
mastodon@server01mas:~/live$
mastodon@server01mas:~/live$ RAILS_ENV=production bundle exec rails assets:precompile
I, [2017-04-17T10:56:55.327575 #9089]  INFO -- : Writing /home/mastodon/live/public/assets/application_public-ff92fbfb31a9056b294415acf2190bf7a5ab47eb875ad7863ec82171915654bc.js
...
I, [2017-04-17T10:58:45.301179 #9089]  INFO -- : Writing /home/mastodon/live/public/assets/pghero/application-9bc22f0902dcd973784cb5dd4a5fd5f7437691f893fe23bef94cfb6ae256059b.css.gz
mastodon@server01mas:~/live$
mastodon@server01mas:~/live$ RAILS_ENV=production bundle exec rails db:migrate
Migrating to AddIndexOnMentionsStatusId (20170405112956)
== 20170405112956 AddIndexOnMentionsStatusId: migrating =======================
-- add_index(:mentions, :status_id)
   -> 0.6750s
...
-- add_column(:statuses, :language, :string, {:null=>false, :default=>"en"})
   -> 0.4539s
== 20170414132105 AddLanguageToStatuses: migrated (0.4541s) ===================
mastodon@server01mas:~/live$
mastodon@server01mas:~/live$ exit
exit
admin@server01mas:~$

14/ Démarrage des services.

admin@server01mas:~$ su
Password: 
root@server01mas:/home/admin# 
root@server01mas:/home/admin# systemctl start mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service
root@server01mas:/home/admin# 
root@server01mas:/home/admin# exit
exit
admin@server01mas:~$ 

15/ Liens.

https://angristan.fr/installer-instance-mastodon-debian-8/
https://jesuisadmin.fr/migration-dune-instance-mastodon/
https://www.citizenz.info/

Avr 16

Debian Desktop avec SPICE sous Libvirt

Debian Desktop avec SPICE sous Libvirt.

Sur le serveur :

1/ Liste des machines virtuelles disponibles.

root@server01virt:/home/admin# virsh list --all
setlocale: No such file or directory
 Id    Name                           State
----------------------------------------------------
 -     VM01                           shut off

2/ Edition du fichier de configuration d’une machine virtuelle : Configuration SPICE.

root@server01virt:/home/admin# virsh edit VM01

Chercher :

    <graphics type='vnc' port='-1' autoport='yes' passwd='Mot2Passe'/>
    <video>
      <model type='cirrus' vram='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>

Remplacer par :

    <graphics type='spice' port='5900' autoport='no' listen='0.0.0.0' passwd='Mot2Passe'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='qxl' ram='65536' vram='32768' vgamem='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>

3/ Démarrage de la machine virtuelle.

root@server01virt:/home/admin# virsh start VM01
Domain VM01 started

Sur la machine locale :

4/ Installation de l’application ‘Virt Viewer‘ sous Ubuntu.

[~] ➔ sudo apt-get install virt-viewer

5/ Affichage déporter de la machine virtuelle.

[~] ➔ remote-viewer spice://95.142.162.206:5900/VM01

6/ Lien :

https://www.server-world.info/en/note?os=Debian_8&p=kvm&f=7
https://www.mankier.com/1/remote-viewer#

Avr 16

Debian Desktop avec Libvirt

Debian Desktop avec Libvirt.

1/ Création d’un disque dur virtuel.

root@server01virt:/home/admin# qemu-img create vhda.raw 8G
Formatting 'vhda.raw', fmt=raw size=8589934592

2/ Installation d’une machine virtuelle Debian 8 Jessie.

root@server01virt:/home/admin# virt-install --name VM01 --vcpus 2 --memory 2048 --disk vhda.raw --network default --graphics vnc,password=Mot2Passe --location 'http://ftp.nl.debian.org/debian/dists/jessie/main/installer-amd64/'
WARNING  KVM acceleration not available, using 'qemu'
WARNING  Unable to connect to graphical console: virt-viewer not installed. Please install the 'virt-viewer' package.
WARNING  No console to launch for the guest, defaulting to --wait -1

Starting install...
Retrieving file linux...                                                                                              | 3.0 MB  00:00:00     
Retrieving file initrd.gz...                                                                                          |  14 MB  00:00:04     
Creating domain...                                                                                                    |    0 B  00:00:00     
Domain installation still in progress. Waiting for installation to complete.

3/ Création d’un tunnel ssh.

[~] ➔ ssh admin@95.142.162.206 -L 5900:localhost:5900
admin@95.142.162.206's password: 
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-21-lowlatency x86_64)
...
Last login: Sun Apr 16 00:48:59 2017 from 86.223.254.173
admin@server01virt:~$ 

4/ Installation du système Debian : Visualisation via VNC.

[~] ➔ vncviewer localhost:0

VNC Viewer Free Edition 4.1.1 for X - built Jul 31 2015 19:05:51
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.

Sun Apr 16 01:30:14 2017
 CConn:       connected to host localhost port 5900
 CConnection: Server supports RFB protocol version 3.8
 CConnection: Using RFB protocol version 3.8
Password: 
Sun Apr 16 01:30:18 2017
 TXImage:     Using default colormap and visual, TrueColor, depth 24.
 CConn:       Using pixel format depth 6 (8bpp) rgb222
 CConn:       Using ZRLE encoding

5/ Vérification.

root@server01virt:/home/admin# virsh list
setlocale: No such file or directory
 Id    Name                           State
----------------------------------------------------
 8     VM01                           running

6/ Lancement de la machine virtuelle.

root@server01virt:/home/admin# virsh start VM01
Domain VM01 started

7/ Lien.

https://raymii.org/s/articles/virt-install_introduction_and_copy_paste_distro_install_commands.html

Articles plus anciens «