Post

Ruby-jekyll-wikistatic-with-rvm-for-root

Ruby-jekyll-wikistatic-with-rvm-for-root

Ruby-jekyll-wikistatic-with-rvm-for-root

Installer Ruby 2.x sur Debian 8 (compilation)

Télécharger les sources ruby sur le site https://cache.ruby-lang.org/pub/ruby/

Prérequis

1
sudo apt install zlib1g-dev libssl-dev libreadline-dev libgdbm-dev openssl

Télchargement de la dernière version “stable”

1
wget https://cache.ruby-lang.org/pub/ruby/ruby-2.5.0.tar.gz

Décopression

1
tar xvfz ruby-2.5.0.tar.gz

Compilation

1
2
3
cd ruby-2.5.0
./configure
make

Installation

1
sudo make install

Vérifier

1
2
ruby --version
	ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

Install rvm for root

Step 1 – Installer RVM

Passaer en mode super utilisateur

1
sudo -s
1
2
3
4
5
6
7
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
echo 'export rvm_prefix="$HOME"' > /root/.rvmrc
echo 'export rvm_path="$HOME/.rvm"' >> /root/.rvmrc
curl -L get.rvm.io |rvm_path=/opt/rvm bash -s stable
source /root/.rvm/scripts/rvm
rvm requirements

Checking requirements for debian. Installing requirements for debian. Updating system….. Installing required packages: gawk, zlib1g-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgmp-dev, libgdbm-dev, libncurses5-dev, automake, libtool, bison, pkg-config, libffi-dev, libgmp-dev, libreadline6-dev, libssl-dev…………… Requirements installation successful.

1
2
3
4
5
### Step 2 – Liste des versions Ruby disponibles

	rvm list known | grep "\[ruby-"

[ruby-]1.8.6[-p420] [ruby-]1.8.7[-head] # security released on head [ruby-]1.9.1[-p431] [ruby-]1.9.2[-p330] [ruby-]1.9.3[-p551] [ruby-]2.0.0[-p648] [ruby-]2.1[.10] [ruby-]2.2[.7] [ruby-]2.3[.4] [ruby-]2.4[.1]

1
2
3
4
5
### Step 3 – Installer une version Ruby

	rvm install 2.4.1

Searching for binary rubies, this might take some time. No binary rubies available for: debian/8/x86_64/ruby-2.4.1. Continuing with compilation. Please read ‘rvm help mount’ to get more information on binary rubies. Checking requirements for debian. Requirements installation successful. Installing Ruby from source to: /root/.rvm/rubies/ruby-2.4.1, this may take a while depending on your cpu(s)… ruby-2.4.1 - #downloading ruby-2.4.1, this may take a while depending on your connection… % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 11.9M 100 11.9M 0 0 849k 0 0:00:14 0:00:14 –:–:– 968k ruby-2.4.1 - #extracting ruby-2.4.1 to /root/.rvm/src/ruby-2.4.1…. ruby-2.4.1 - #applying patch /root/.rvm/patches/ruby/2.4.1/random_c_using_NR_prefix.patch. ruby-2.4.1 - #configuring………………………………………………………… ruby-2.4.1 - #post-configuration.. ruby-2.4.1 - #compiling…………………………………………………………………….. ruby-2.4.1 - #installing……….. ruby-2.4.1 - #making binaries executable.. ruby-2.4.1 - #downloading rubygems-2.6.14 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 751k 100 751k 0 0 766k 0 –:–:– –:–:– –:–:– 766k No checksum for downloaded archive, recording checksum in user configuration. ruby-2.4.1 - #extracting rubygems-2.6.14…. ruby-2.4.1 - #removing old rubygems……… ruby-2.4.1 - #installing rubygems-2.6.14……………………… ruby-2.4.1 - #gemset created /root/.rvm/gems/ruby-2.4.1@global ruby-2.4.1 - #importing gemset /root/.rvm/gemsets/global.gems…………………………………….| ruby-2.4.1 - #generating global wrappers…….. ruby-2.4.1 - #gemset created /root/.rvm/gems/ruby-2.4.1 ruby-2.4.1 - #importing gemsetfile /root/.rvm/gemsets/default.gems evaluated to empty gem list ruby-2.4.1 - #generating default wrappers…….. ruby-2.4.1 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). Install of ruby-2.4.1 - #complete Ruby was built without documentation, to build it run: rvm docs generate-ri

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
### Step 4 – Configuration par défaut la version Ruby

	rvm use 2.4.1 --default
		Using /root/.rvm/gems/ruby-2.4.1

### Step 5 – Vérifier la version Ruby

	ruby --version
		ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

	which ruby
		/root/.rvm/rubies/ruby-2.4.1/bin/ruby

### Installation jekyll

	gem install jekyll

Done installing documentation for public_suffix, addressable, colorator, http_parser.rb, eventmachine, em-websocket, concurrent-ruby, i18n, rb-fsevent, ffi, rb-inotify, sass-listen, sass, jekyll-sass-converter, ruby_dep, listen, jekyll-watch, kramdown, liquid, mercenary, forwardable-extended, pathutil, rouge, safe_yaml, jekyll after 130 seconds 25 gems installed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
	jekyll --version
		jekyll 3.7.2

	which jekyll
		/root/.rvm/gems/ruby-2.4.1/bin/jekyll

Retour en mode utilisateur

	exit

Modifier le path

	export PATH=$PATH:/root/.rvm/rubies/ruby-2.4.1/bin:/root/.rvm/gems/ruby-2.4.1/bin

---


## Completely Removing RVM

There are times when you might find yourself needing to completely remove RVM from your system. You can easily do so with a few simple commands.

rm -rf ~/.rvm* sudo rm -rf /etc/rvm* sudo groupdel rvm sudo rm -rf /usr/local/rvm

1
2
3
You'll also need to remove the following line from your .bashrc file & reload load BASH

[[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm” # Load RVM function

1
2
3
If you're going from site-wide install back to a single user install, you'll also want to do the following:

sudo rm /etc/profile.d/rvm.sh sudo rm /usr/share/ruby-rvm ```


There is a function to add managers, however it requires that Mult-User is enabled from a super user installation.

From the RVM guided installation:

1
2
3
4
5
    After following above instructions for Multi-User.

    For each user that want to use RVM, an additional command needs to be run (once) for each user:

rvm user gemsets

but the Multi-User function should have been enabled first:

1
The (Multi-User) rvm function will be automatically configured for every user on the system if you install with sudo.

service

Author: @yuan3y

Date: 2017-09-29

Description: to make jekyll serve a system service and start on boot

#

Usage: place this file at /etc/systemd/system/jekyll.service

then run

sudo systemctl start jekyll.service

sudo systemctl enable jekyll.service

[Unit] Description=Jekyll service After=network.target

[Service] User=[my user name] Type=simple WorkingDirectory=[my jekyll source folder] ExecStart=/usr/local/bin/jekyll serve –watch –source “[my jekyll source folder]” Restart=on-abort SyslogIdentifier=jekyll

[Install] WantedBy=multi-user.target

Cet article est sous licence CC BY 4.0 par l'auteur.