総数:40 今日:1 昨日:0
Memorandums
CPE:customer-premises equipment
| name | description |
| OpenACS | Java + JBoss/Tomcat + EJB/MySQL で構成され、固有のビジネス・ロジックは JavaScript を使って定義出来るというユニークなアプリケーション。 仮想マシンのイメージも配布されておりすぐに試すことも可能なんですが、ここ数年は開発活動がほぼ停止しているところが気になります。 |
| GenieACS | GenieACS が面白いのは上位システム側 API (North Bound Interface)、CWMP インタフェース (South Bound Interface)、UI アプリケーションがそれぞれ分離・モジュール化されているところ。 NBI の RESTful な API だけを使ってユーザ・インタフェースは独自に実装する、ということも可能なんです。 ミドルウェアには Node.js, MongoDB, Redis, Ruby On Rails を採用(クールですけど少し気後れしますね・・・)。 |
http://netbuffalo.doorblog.jp/archives/4794185.html
https://genieacs.com/docs/
https://gist.github.com/si458/d3095c47339fad72ffaf5222dd7dbf49
sudo apt-get install -y build-essential git curl software-properties-common zlib1g-dev tmux libsqlite3-dev
~$ curl -L -o install_Nodejs8.x_LTS_Carbon_repo.sh https://deb.nodesource.com/setup_8.x ~$ chmod a+x install_Nodejs8.x_LTS_Carbon_repo.sh ~$ sudo bash ~# ./install_Nodejs8.x_LTS_Carbon_repo.sh
## Installing the NodeSource Node.js 8.x LTS Carbon repo...
## Populating apt-get cache...
+ apt-get update
ヒット:1 http://jp.archive.ubuntu.com/ubuntu bionic InRelease
取得:2 http://jp.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
取得:3 http://jp.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
ヒット:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
163 kB を 1秒 で取得しました (200 kB/s)
パッケージリストを読み込んでいます... 完了
## Confirming "bionic" is supported...
+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_8.x/dists/bionic/Release'
## Adding the NodeSource signing key to your keyring...
+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
OK
## Creating apt sources list file for the NodeSource Node.js 8.x LTS Carbon repo...
+ echo 'deb https://deb.nodesource.com/node_8.x bionic main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_8.x bionic main' >> /etc/apt/sources.list.d/nodesource.list
## Running `apt-get update` for you...
+ apt-get update
ヒット:1 http://jp.archive.ubuntu.com/ubuntu bionic InRelease
取得:2 http://jp.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
取得:3 https://deb.nodesource.com/node_8.x bionic InRelease [4,595 B]
取得:4 http://jp.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
ヒット:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
取得:6 https://deb.nodesource.com/node_8.x bionic/main i386 Packages [765 B]
取得:7 https://deb.nodesource.com/node_8.x bionic/main amd64 Packages [766 B]
169 kB を 1秒 で取得しました (217 kB/s)
パッケージリストを読み込んでいます... 完了
## Run `sudo apt-get install -y nodejs` to install Node.js 8.x LTS Carbon and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
~# exit
~$ sudo apt-get install -y nodejs
パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下のパッケージが新たにインストールされます: nodejs アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 114 個。 13.5 MB のアーカイブを取得する必要があります。 この操作後に追加で 64.3 MB のディスク容量が消費されます。 取得:1 https://deb.nodesource.com/node_8.x bionic/main amd64 nodejs amd64 8.15.1-1nodesource1 [13.5 MB] 13.5 MB を 1秒 で取得しました (11.9 MB/s) 以前に未選択のパッケージ nodejs を選択しています。 (データベースを読み込んでいます ... 現在 174322 個のファイルとディレクトリがインストールされています。) .../nodejs_8.15.1-1nodesource1_amd64.deb を展開する準備をしています ... nodejs (8.15.1-1nodesource1) を展開しています... nodejs (8.15.1-1nodesource1) を設定しています ... man-db (2.8.3-2ubuntu0.1) のトリガを処理しています ...
You may also need development tools to build native addons:
~$ sudo apt-get install gcc g++ make
To install the Yarn package manager, run:
~$ sudo bash ~# curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - ~# echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list ~# exit ~$ sudo apt-get update ~$ sudo apt-get install yarn
パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下のパッケージが新たにインストールされます: yarn アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 114 個。 836 kB のアーカイブを取得する必要があります。 この操作後に追加で 4,997 kB のディスク容量が消費されます。 取得:1 https://dl.yarnpkg.com/debian stable/main amd64 yarn all 1.15.2-1 [836 kB] 836 kB を 0秒 で取得しました (2,993 kB/s) 以前に未選択のパッケージ yarn を選択しています。 (データベースを読み込んでいます ... 現在 177807 個のファイルとディレクトリがインストールされています。) .../archives/yarn_1.15.2-1_all.deb を展開する準備をしています ... yarn (1.15.2-1) を展開しています... yarn (1.15.2-1) を設定しています ...
https://docs.mongodb.com/manual/tutorial/install-mongodb-enterprise-on-ubuntu/
~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
Executing: /tmp/apt-key-gpghome.McrPLHdynv/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 gpg: 鍵68818C72E52529D4: 公開鍵"MongoDB 4.0 Release Signing Key <packaging@mongodb.com>"をインポートしました gpg: 処理数の合計: 1 gpg: インポート: 1
~$ sudo bash ~# echo "deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu bionic/mongodb-enterprise/4.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-enterprise.list ~# exit
~$ sudo apt-get update
~$ sudo apt-get install -y mongodb-enterprise
パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下の追加パッケージがインストールされます: mongodb-enterprise-mongos mongodb-enterprise-server mongodb-enterprise-shell mongodb-enterprise-tools snmp 以下のパッケージが新たにインストールされます: mongodb-enterprise mongodb-enterprise-mongos mongodb-enterprise-server mongodb-enterprise-shell mongodb-enterprise-tools snmp アップグレード: 0 個、新規インストール: 6 個、削除: 0 個、保留: 67 個。 68.3 MB のアーカイブを取得する必要があります。 この操作後に追加で 288 MB のディスク容量が消費されます。 取得:1 http://jp.archive.ubuntu.com/ubuntu bionic-updates/main amd64 snmp amd64 5.7.3+dfsg-1.8ubuntu3.1 [158 kB] 取得:2 http://repo.mongodb.com/apt/ubuntu bionic/mongodb-enterprise/4.0/multiverse amd64 mongodb-enterprise-shell amd64 4.0.6 [9,840 kB] 取得:3 http://repo.mongodb.com/apt/ubuntu bionic/mongodb-enterprise/4.0/multiverse amd64 mongodb-enterprise-server amd64 4.0.6 [16.0 MB] 取得:4 http://repo.mongodb.com/apt/ubuntu bionic/mongodb-enterprise/4.0/multiverse amd64 mongodb-enterprise-mongos amd64 4.0.6 [8,904 kB] 取得:5 http://repo.mongodb.com/apt/ubuntu bionic/mongodb-enterprise/4.0/multiverse amd64 mongodb-enterprise-tools amd64 4.0.6 [33.4 MB] 取得:6 http://repo.mongodb.com/apt/ubuntu bionic/mongodb-enterprise/4.0/multiverse amd64 mongodb-enterprise amd64 4.0.6 [3,540 B] 68.3 MB を 9秒 で取得しました (7,315 kB/s) 以前に未選択のパッケージ mongodb-enterprise-shell を選択しています。 (データベースを読み込んでいます ... 現在 174673 個のファイルとディレクトリがインストールされています。) .../0-mongodb-enterprise-shell_4.0.6_amd64.deb を展開する準備をしています ... mongodb-enterprise-shell (4.0.6) を展開しています... 以前に未選択のパッケージ snmp を選択しています。 .../1-snmp_5.7.3+dfsg-1.8ubuntu3.1_amd64.deb を展開する準備をしています ... snmp (5.7.3+dfsg-1.8ubuntu3.1) を展開しています... 以前に未選択のパッケージ mongodb-enterprise-server を選択しています。 .../2-mongodb-enterprise-server_4.0.6_amd64.deb を展開する準備をしています ... mongodb-enterprise-server (4.0.6) を展開しています... 以前に未選択のパッケージ mongodb-enterprise-mongos を選択しています。 .../3-mongodb-enterprise-mongos_4.0.6_amd64.deb を展開する準備をしています ... mongodb-enterprise-mongos (4.0.6) を展開しています... 以前に未選択のパッケージ mongodb-enterprise-tools を選択しています。 .../4-mongodb-enterprise-tools_4.0.6_amd64.deb を展開する準備をしています ... mongodb-enterprise-tools (4.0.6) を展開しています... 以前に未選択のパッケージ mongodb-enterprise を選択しています。 .../5-mongodb-enterprise_4.0.6_amd64.deb を展開する準備をしています ... mongodb-enterprise (4.0.6) を展開しています... snmp (5.7.3+dfsg-1.8ubuntu3.1) を設定しています ... mongodb-enterprise-server (4.0.6) を設定しています ... システムユーザー `mongodb' (UID 122) を追加しています... 新しいユーザー `mongodb' (UID 122) をグループ `nogroup' に追加しています... ホームディレクトリ `/home/mongodb' を作成しません。 グループ `mongodb' (GID 127) を追加しています... 完了。 ユーザー `mongodb' をグループ `mongodb' に追加しています... ユーザ mongodb をグループ mongodb に追加 完了。 mongodb-enterprise-shell (4.0.6) を設定しています ... mongodb-enterprise-tools (4.0.6) を設定しています ... man-db (2.8.3-2ubuntu0.1) のトリガを処理しています ... mongodb-enterprise-mongos (4.0.6) を設定しています ... mongodb-enterprise (4.0.6) を設定しています ...
Although you can specify any available version of MongoDB, apt-get upgrades the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin the version of MongoDB at the currently installed version, issue the following command sequence:
~$ sudo bash ~# echo "mongodb-enterprise hold" | dpkg --set-selections ~# echo "mongodb-enterprise-server hold" | dpkg --set-selections ~# echo "mongodb-enterprise-shell hold" | dpkg --set-selections ~# echo "mongodb-enterprise-mongos hold" | dpkg --set-selections ~# echo "mongodb-enterprise-tools hold" | dpkg --set-selections ~# exit
どこにinstallされたかみてみる
~$ which mongod /usr/bin/mongod
設定ファイルの中身
~$ cat /etc/mongod.conf
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
| data files | /var/lib/mongodb |
| log files | /var/log/mongodb |
If you change the user that runs the MongoDB process,
you must also modify the permission to the /var/lib/mongodb and /var/log/mongodb directories
to give this user access to these directories.
~$ sudo service mongod start
Verify that the mongod process has started successfully
by checking the contents of the log file at /var/log/mongodb/mongod.log
for a line reading
[initandlisten] waiting for connections on port 27017
27017 is the default port the standalone mongod listens on.
~$ sudo service mongod stop
~$ sudo service mongod restart
Start a mongo shell on the same host machine as the mongod.
You can run the mongo shell without any command-line options
to connect to a mongod
that is running on your localhost with default port 27017:
~$ mongo
https://github.com/genieacs/genieacs/archive/v1.1.3.tar.gz
genieacs-1.1.3.tar.gz を homeにstoreしたとする。
~$ tar xzpf genieacs-1.1.3.tar.gz
~$ mv genieacs-1.1.3/ genieacs/
https://github.com/libxmljs/libxmljs/commit/e6d44d3d0d6417bf1685aa7cc35e6a3eb63a0662
~$ cd genieacs/ ~/genieacs$ npm install ~/genieacs$ npm audit fix
Before proceeding, find and review the file “config.json” in “config” directory where GenieACS is downloaded.
~/genieacs$ ls -la config/ 合計 24 drwxrwxr-x 2 tr069_server tr069_server 4096 3月 17 17:04 . drwxrwxr-x 8 tr069_server tr069_server 4096 3月 17 17:05 .. -rw-rw-r-- 1 tr069_server tr069_server 196 10月 24 04:48 auth-sample.js -rw-rw-r-- 1 tr069_server tr069_server 298 10月 24 04:48 config-sample.json -rw-r--r-- 1 tr069_server tr069_server 298 3月 17 17:04 config.json -rw-rw-r-- 1 tr069_server tr069_server 937 10月 24 04:48 ext-sample.js
~/genieacs$ cat config/config.json
{
"MONGODB_CONNECTION_URL" : "mongodb://127.0.0.1/genieacs",
"CWMP_INTERFACE" : "0.0.0.0",
"CWMP_PORT" : 7547,
"CWMP_SSL" : false,
"NBI_INTERFACE" : "0.0.0.0",
"NBI_PORT" : 7557,
"FS_INTERFACE" : "0.0.0.0",
"FS_PORT" : 7567,
"FS_HOSTNAME" : "acs.example.com",
"DEBUG" : false
}
Finally, run the following (from bin directory if installing from source):
~genieacs$ cd bin/ ~genieacs/bin$ ./genieacs-cwmp
This is the service that the CPEs will communicate with.
It listens to port 7547 by default (see config/config.json).
Configure the ACS URL of your devices accordingly (e.g. http://acs.example.com:7547/).
~genieacs/bin$ ./genieacs-nbi
This is the northbound interface module.
It exposes a REST API on port 7557 by default.
This must be running for the GUI front end to work.
~genieacs/bin$ ./genieacs-fs
This is the file server from which the CPEs will download firmware images and such.
Make sure to set the config option FS_HOSTNAME to your server’s hostname or IP.
Note: For production deployment it’s advised to run those as background services.
For further details about installation and configuration, refer to the wiki.
https://github.com/genieacs/genieacs/wiki
The front end component (genieacs-gui) is built with Ruby on Rails.
Install Ruby (2.2.2 or newer) and Bundler.
Clone the git repository:
git clone https://github.com/genieacs/genieacs-gui.git
Once that is done, create configuration files by copying the provided templates.
cd genieacs-gui cp config/graphs-sample.json.erb config/graphs.json.erb cp config/index_parameters-sample.yml config/index_parameters.yml cp config/summary_parameters-sample.yml config/summary_parameters.yml cp config/parameters_edit-sample.yml config/parameters_edit.yml cp config/parameter_renderers-sample.yml config/parameter_renderers.yml cp config/roles-sample.yml config/roles.yml cp config/users-sample.yml config/users.yml
Now install the required gems by typing (while in the project directory):
bundle
You’re now good to go. Start the application server:
rails s
Make sure the back end is running as the GUI depends on it.
管理画面を表示しようとする http://192.168.3.14:3000/
エラー発生
Directly inheriting from ActiveRecord::Migration is not supported.
https://blog.mrym.tv/archives/148
解決法はmigrationのファイルを修正する事だった。
class AddSessionsTable < ActiveRecord::Migration ↓ こう変更する class AddSessionsTable < ActiveRecord::Migration[5.1]
これで再度db:migrateを行ったところ、無事テーブルが作成された。
~/genieacs-gui$ ./bin/rails db:migrate
See genieacs-gui’s wiki for more details.
https://github.com/genieacs/genieacs-gui/wiki
Ubuntu18.04にRuby on Railsを入れたい(知識編)
RubyとRailsをUbuntu18.04にインストールする手順
https://www.ruby-lang.org/ja/documentation/
https://github.com/rbenv/rbenv-installer
rbenv-installer scriptを取得する
~/Downloads$ wget -q https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer
The rbenv-installer script idempotently installs or updates rbenv on your system.
If Homebrew is detected, installation will proceed using brew install/upgrade.
Otherwise, rbenv is installed under ~/.rbenv.
Additionally, ruby-build is also installed if rbenv install is not already available.
rbenv-installer scriptを実行する
~/Downloads$ chmod a+x rbenv-installer ~/Downloads$ mv rbenv-installer rbenv-installer.sh ~/Downloads$ ./rbenv-installer.sh
Installing rbenv with git... Initialized empty Git repository in /home/tr069_server/.rbenv/.git/ Updating origin remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (4/4), done. remote: Total 2695 (delta 0), reused 1 (delta 0), pack-reused 2691 Receiving objects: 100% (2695/2695), 488.76 KiB | 1.43 MiB/s, done. Resolving deltas: 100% (1699/1699), done. From https://github.com/rbenv/rbenv * [new branch] master -> origin/master * [new tag] v0.1.0 -> v0.1.0 * [new tag] v0.1.1 -> v0.1.1 * [new tag] v0.1.2 -> v0.1.2 * [new tag] v0.2.0 -> v0.2.0 * [new tag] v0.2.1 -> v0.2.1 * [new tag] v0.3.0 -> v0.3.0 * [new tag] v0.4.0 -> v0.4.0 * [new tag] v1.0.0 -> v1.0.0 * [new tag] v1.1.0 -> v1.1.0 * [new tag] v1.1.1 -> v1.1.1 Branch 'master' set up to track remote branch 'master' from 'origin'. Already on 'master' make: ディレクトリ '/home/tr069_server/.rbenv/src' に入ります gcc -fPIC -c -o realpath.o realpath.c gcc -shared -Wl,-soname,../libexec/rbenv-realpath.dylib -o ../libexec/rbenv-realpath.dylib realpath.o make: ディレクトリ '/home/tr069_server/.rbenv/src' から出ます Installing ruby-build with git... Cloning into '/home/tr069_server/.rbenv/plugins/ruby-build'... remote: Enumerating objects: 35, done. remote: Counting objects: 100% (35/35), done. remote: Compressing objects: 100% (20/20), done. remote: Total 9681 (delta 12), reused 33 (delta 10), pack-reused 9646 Receiving objects: 100% (9681/9681), 2.05 MiB | 2.55 MiB/s, done. Resolving deltas: 100% (6327/6327), done. Running doctor script to verify installation... Checking for `rbenv' in PATH: not found You seem to have rbenv installed in `/home/tr069_server/.rbenv/bin', but that directory is not present in PATH. Please add it to PATH by configuring your `~/.bashrc', `~/.zshrc', or `~/.config/fish/config.fish'.
実行後、~/配下に.rbenvディレクトリが生成されており、rbenvとrbenv-buildがインストールされます。
そして、PATHに.rbenv/binを追加します。 追加の仕方は、.bashrcに下記を追加します。
PATH=$PATH:/home/(ユーザー)/.rbenv/bin
次にrbenv-doctorを実行します。
After the installation, a separate rbenv-doctor script is run to verify the success of the installation and to detect common issues.
You can run rbenv-doctor on your machine separately to verify the state of your install:
~/Downloads$ wget -q https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor ~/Downloads$ chmod a+x rbenv-doctor ~/Downloads$ mv rbenv-doctor rbenv-doctor.sh ~/Downloads$ ./rbenv-doctor.sh
Checking for `rbenv' in PATH: /home/tr069_server/.rbenv/bin/rbenv Checking for rbenv shims in PATH: not found The directory `/home/tr069_server/.rbenv/shims' must be present in PATH for rbenv to work. Please run `rbenv init' and follow the instructions. Checking `rbenv install' support: /home/tr069_server/.rbenv/plugins/ruby-build/bin/rbenv-install (ruby-build 20190314-2-g5a7c1e4) Counting installed Ruby versions: none There aren't any Ruby versions installed under `/home/tr069_server/.rbenv/versions'. You can install Ruby versions like so: rbenv install 2.2.4 Checking RubyGems settings: OK Auditing installed plugins: OK
エラー1
Checking for rbenv shims in PATH: not found
エラー2
Counting installed Ruby versions: none
1つ目は、rbenv init をしていないことが理由なので実行してみると、.bashrcに
eval "$(rbenv init -)"
を追加するようにアドバイスが出ます。
なので、追加してsourceコマンドもしくはターミナルを再起動します。
再起動後、.rbenv配下にshimsフォルダが追加されPATHにも追加されました。
2つ目は、まだRubyをインストールしていないことが理由なので、次項で説明します。
インストールできるバージョンを確認します。
~$ rbenv install -l
2.6.2が安定版とのことなので
~$ rbenv install 2.6.2
Downloading ruby-2.6.2.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.2.tar.bz2 Installing ruby-2.6.2... BUILD FAILED (Ubuntu 18.04 using ruby-build 20190314-2-g5a7c1e4) Inspect or clean up the working tree at /tmp/ruby-build.20190318222844.4467 Results logged to /tmp/ruby-build.20190318222844.4467.log Last 10 log lines: installing capi-docs: /home/tr069_server/.rbenv/versions/2.6.2/share/doc/ruby The Ruby openssl extension was not compiled. The Ruby readline extension was not compiled. ERROR: Ruby install aborted due to missing extensions Try running `apt-get install -y libssl-dev libreadline-dev` to fetch missing dependencies. Configure options used: --prefix=/home/tr069_server/.rbenv/versions/2.6.2 LDFLAGS=-L/home/tr069_server/.rbenv/versions/2.6.2/lib CPPFLAGS=-I/home/tr069_server/.rbenv/versions/2.6.2/include
libssl-dev libreadline-dev が ないとのこと
sudo apt-get install -y libssl-dev libreadline-dev
再度 ruby 2.6.2をinstall
~$ rbenv install 2.6.2 Installing ruby-2.6.2... Installed ruby-2.6.2 to /home/tr069_server/.rbenv/versions/2.6.2
下記を実行して使用するRubyのバージョンを設定します。
~$ rbenv global
設定されていることを下記で確認します。
~$ rbenv version 2.6.2 (set by /home/tr069_server/.rbenv/version)
~$ ruby -v ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-linux]
~$ Downloads/rbenv-doctor.sh Checking for `rbenv' in PATH: /home/tr069_server/.rbenv/bin/rbenv Checking for rbenv shims in PATH: OK Checking `rbenv install' support: /home/tr069_server/.rbenv/plugins/ruby-build/bin/rbenv-install (ruby-build 20190314-2-g5a7c1e4) Counting installed Ruby versions: 1 versions Checking RubyGems settings: OK Auditing installed plugins: OK
rbenvとrubyをインストールできたことを確認できました。
Railsとは、Rubyプログラミング言語で書かれたWebアプリケーションフレームワークです。
これをインストールするのですが、その前にSQLiteがインストールされている必要があります。
まずSQLiteをインストールします。
~$ sudo apt-get install -y sqlite3 libsqlite3-dev パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 libsqlite3-dev はすでに最新バージョン (3.22.0-1) です。 提案パッケージ: sqlite3-doc 以下のパッケージが新たにインストールされます: sqlite3 アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 65 個。 751 kB のアーカイブを取得する必要があります。 この操作後に追加で 2,477 kB のディスク容量が消費されます。 取得:1 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 sqlite3 amd64 3.22.0-1 [751 kB] 751 kB を 0秒 で取得しました (1,785 kB/s) 以前に未選択のパッケージ sqlite3 を選択しています。 (データベースを読み込んでいます ... 現在 186792 個のファイルとディレクトリがインストールされています。) .../sqlite3_3.22.0-1_amd64.deb を展開する準備をしています ... sqlite3 (3.22.0-1) を展開しています... sqlite3 (3.22.0-1) を設定しています ... man-db (2.8.3-2ubuntu0.1) のトリガを処理しています ...
バージョンを確認
~$ sqlite3 --version 3.22.0 2018-01-22 18:45:57 0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2alt1
下記を実行しRailsのインストールをします。
~$ gem install rails
Fetching tzinfo-1.2.5.gem Fetching concurrent-ruby-1.1.5.gem Fetching thread_safe-0.3.6.gem Fetching rails-dom-testing-2.0.3.gem Fetching activesupport-5.2.2.1.gem Fetching crass-1.0.4.gem Fetching i18n-1.6.0.gem Fetching loofah-2.2.3.gem Fetching rails-html-sanitizer-1.0.4.gem Fetching nokogiri-1.10.1.gem Fetching erubi-1.8.0.gem Fetching mini_portile2-2.4.0.gem Fetching actionview-5.2.2.1.gem Fetching builder-3.2.3.gem Fetching activerecord-5.2.2.1.gem Fetching rack-2.0.6.gem Fetching rack-test-1.1.0.gem Fetching actionpack-5.2.2.1.gem Fetching activemodel-5.2.2.1.gem Fetching mini_mime-1.0.1.gem Fetching arel-9.0.0.gem Fetching websocket-extensions-0.1.3.gem Fetching globalid-0.4.2.gem Fetching activejob-5.2.2.1.gem Fetching actionmailer-5.2.2.1.gem Fetching nio4r-2.3.1.gem Fetching actioncable-5.2.2.1.gem Fetching mimemagic-0.3.3.gem Fetching websocket-driver-0.7.0.gem Fetching mail-2.7.1.gem Fetching sprockets-3.7.2.gem Fetching activestorage-5.2.2.1.gem Fetching method_source-0.9.2.gem Fetching thor-0.20.3.gem Fetching rails-5.2.2.1.gem Fetching railties-5.2.2.1.gem Fetching marcel-0.3.3.gem Fetching sprockets-rails-3.2.1.gem Successfully installed concurrent-ruby-1.1.5 Successfully installed thread_safe-0.3.6 Successfully installed tzinfo-1.2.5 HEADS UP! i18n 1.1 changed fallbacks to exclude default locale. But that may break your application. Please check your Rails app for 'config.i18n.fallbacks = true'. If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be 'config.i18n.fallbacks = [I18n.default_locale]'. If not, fallbacks will be broken in your app by I18n 1.1.x. For more info see: https://github.com/svenfuchs/i18n/releases/tag/v1.1.0 Successfully installed i18n-1.6.0 Successfully installed activesupport-5.2.2.1 Successfully installed mini_portile2-2.4.0 Building native extensions. This could take a while... Successfully installed nokogiri-1.10.1 Successfully installed rails-dom-testing-2.0.3 Successfully installed crass-1.0.4 Successfully installed loofah-2.2.3 Successfully installed rails-html-sanitizer-1.0.4 Successfully installed erubi-1.8.0 Successfully installed builder-3.2.3 Successfully installed actionview-5.2.2.1 Successfully installed rack-2.0.6 Successfully installed rack-test-1.1.0 Successfully installed actionpack-5.2.2.1 Successfully installed activemodel-5.2.2.1 Successfully installed arel-9.0.0 Successfully installed activerecord-5.2.2.1 Successfully installed mini_mime-1.0.1 Successfully installed mail-2.7.1 Successfully installed globalid-0.4.2 Successfully installed activejob-5.2.2.1 Successfully installed actionmailer-5.2.2.1 Building native extensions. This could take a while... Successfully installed nio4r-2.3.1 Successfully installed websocket-extensions-0.1.3 Building native extensions. This could take a while... Successfully installed websocket-driver-0.7.0 Successfully installed actioncable-5.2.2.1 Successfully installed mimemagic-0.3.3 Successfully installed marcel-0.3.3 Successfully installed activestorage-5.2.2.1 Successfully installed method_source-0.9.2 Successfully installed thor-0.20.3 Successfully installed railties-5.2.2.1 Successfully installed sprockets-3.7.2 Successfully installed sprockets-rails-3.2.1 Successfully installed rails-5.2.2.1 Parsing documentation for concurrent-ruby-1.1.5 Installing ri documentation for concurrent-ruby-1.1.5 Parsing documentation for thread_safe-0.3.6 Installing ri documentation for thread_safe-0.3.6 Parsing documentation for tzinfo-1.2.5 Installing ri documentation for tzinfo-1.2.5 Parsing documentation for i18n-1.6.0 Installing ri documentation for i18n-1.6.0 Parsing documentation for activesupport-5.2.2.1 Installing ri documentation for activesupport-5.2.2.1 Parsing documentation for mini_portile2-2.4.0 Installing ri documentation for mini_portile2-2.4.0 Parsing documentation for nokogiri-1.10.1 Installing ri documentation for nokogiri-1.10.1 Parsing documentation for rails-dom-testing-2.0.3 Installing ri documentation for rails-dom-testing-2.0.3 Parsing documentation for crass-1.0.4 Installing ri documentation for crass-1.0.4 Parsing documentation for loofah-2.2.3 Installing ri documentation for loofah-2.2.3 Parsing documentation for rails-html-sanitizer-1.0.4 Installing ri documentation for rails-html-sanitizer-1.0.4 Parsing documentation for erubi-1.8.0 Installing ri documentation for erubi-1.8.0 Parsing documentation for builder-3.2.3 Installing ri documentation for builder-3.2.3 Parsing documentation for actionview-5.2.2.1 Installing ri documentation for actionview-5.2.2.1 Parsing documentation for rack-2.0.6 Installing ri documentation for rack-2.0.6 Parsing documentation for rack-test-1.1.0 Installing ri documentation for rack-test-1.1.0 Parsing documentation for actionpack-5.2.2.1 Installing ri documentation for actionpack-5.2.2.1 Parsing documentation for activemodel-5.2.2.1 Installing ri documentation for activemodel-5.2.2.1 Parsing documentation for arel-9.0.0 Installing ri documentation for arel-9.0.0 Parsing documentation for activerecord-5.2.2.1 Installing ri documentation for activerecord-5.2.2.1 Parsing documentation for mini_mime-1.0.1 Installing ri documentation for mini_mime-1.0.1 Parsing documentation for mail-2.7.1 Installing ri documentation for mail-2.7.1 Parsing documentation for globalid-0.4.2 Installing ri documentation for globalid-0.4.2 Parsing documentation for activejob-5.2.2.1 Installing ri documentation for activejob-5.2.2.1 Parsing documentation for actionmailer-5.2.2.1 Installing ri documentation for actionmailer-5.2.2.1 Parsing documentation for nio4r-2.3.1 Installing ri documentation for nio4r-2.3.1 Parsing documentation for websocket-extensions-0.1.3 Installing ri documentation for websocket-extensions-0.1.3 Parsing documentation for websocket-driver-0.7.0 Installing ri documentation for websocket-driver-0.7.0 Parsing documentation for actioncable-5.2.2.1 Installing ri documentation for actioncable-5.2.2.1 Parsing documentation for mimemagic-0.3.3 Installing ri documentation for mimemagic-0.3.3 Parsing documentation for marcel-0.3.3 Installing ri documentation for marcel-0.3.3 Parsing documentation for activestorage-5.2.2.1 Installing ri documentation for activestorage-5.2.2.1 Parsing documentation for method_source-0.9.2 Installing ri documentation for method_source-0.9.2 Parsing documentation for thor-0.20.3 Installing ri documentation for thor-0.20.3 Parsing documentation for railties-5.2.2.1 Installing ri documentation for railties-5.2.2.1 Parsing documentation for sprockets-3.7.2 Installing ri documentation for sprockets-3.7.2 Parsing documentation for sprockets-rails-3.2.1 Installing ri documentation for sprockets-rails-3.2.1 Parsing documentation for rails-5.2.2.1 Installing ri documentation for rails-5.2.2.1 Done installing documentation for concurrent-ruby, thread_safe, tzinfo, i18n, activesupport, mini_portile2, nokogiri, rails-dom-testing, crass, loofah, rails-html-sanitizer, erubi, builder, actionview, rack, rack-test, actionpack, activemodel, arel, activerecord, mini_mime, mail, globalid, activejob, actionmailer, nio4r, websocket-extensions, websocket-driver, actioncable, mimemagic, marcel, activestorage, method_source, thor, railties, sprockets, sprockets-rails, rails after 37 seconds 38 gems installed
versionを確認
~$ rails --version Rails 5.2.2.1
~$ gem install bundler
Fetching bundler-2.0.1.gem Successfully installed bundler-2.0.1 Parsing documentation for bundler-2.0.1 Installing ri documentation for bundler-2.0.1 Done installing documentation for bundler after 2 seconds 1 gem installed