Changes between Version 18 and Version 19 of epics/Archiver Appliance インストールメモ


Ignore:
Timestamp:
09/06/24 14:09:10 (7 months ago)
Author:
Shuei Yamada
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • epics/Archiver Appliance インストールメモ

    v18 v19  
    1616* あらかじめdnfでインストールしておくもの
    1717 * gcc
     18 * patch
    1819 * zenity
    1920* AAインストール後の運用については[[wiki:Archiver Appliance 運用メモ|Archiver Appliance 運用メモ]]を参照のこと
     
    7071
    7172= MySQLのセットアップ =
    72 == uid, gid ==
    73 mysql:mysqlが27:27になっている(mysqlをインストールする際に作られる?)のを、既存のマシンにあわせて38099:38099にする。
    74 mysqlが使うディレクトリのownerも変えておく:
    75 {{{
    76 # chown 38099:38099 /var/lib/mysql
    77 # chown 38099:38099 /var/run/mysql
    78 }}}
    79 
    8073== dbを置くディレクトリ ==
    81 dbは/svrdbに置く。NFSサーバがexportしているディレクトリを/svrdbにマウントする。
     74AlmaLinux9標準のディレクトリのままにする場合はこの手順は飛ばしてよい。
     75制御計算機ではdbは/svrdbに置く。NFSサーバがexportしているディレクトリを/svrdbにマウントする。
    8276{{{
    8377jkjds01.ccr.jkcont:/svrdb    /svrdb    nfs  bg,intr,soft,timeo=10,retrans=15,nfsvers=3 0 0
     
    8781# mkdir /svrdb
    8882# mount /svrdb
    89 # mkdir /svrdb/mysql5.1/jkjarchiver-ap
    90 # chown 38099:38099 /svrdb/mysql5.1/jkjarchiver-ap
    91 }}}
    92 
    93 == /etc/my.cnf ==
    94 * SL6の場合
    95  MySQLの設定ファイルをリポジトリからコピーして使う。
    96 {{{
     83# mkdir /svrdb/mariadb10.5/jkjarchiver-ap
     84# chown mysql:mysql /svrdb/mariadb10.5/jkjarchiver-ap
     85}}}
     86
     87== MariaDBの設定 ==
     88* /etc/my.cnf.d/mariadb-server.cnfを書き換える
     89  * MariaDBのテーブルを置くディレクトリ
     90  * MySQL 5.3あたりからutf8mb4 (4-bytes unicode)がデフォルトになった。このままだとカラムサイズが767バイトを超えるので、3-bytes unicodeを使う
     91    * いまはutf8はutf8mb3の別名だが、そのうちutf8mb4の別名になる
     92    * カラムサイズを768バイト以上にする方法もある(らしい)
     93{{{
     94...
    9795[mysqld]
    9896#datadir=/var/lib/mysql
    99 #socket=/var/lib/mysql/mysql.sock
    100 #user=mysql
     97datadir=/svrdb/mariadb10.5/jkjarchiver-ap
     98...
    10199# Disabling symbolic-links is recommended to prevent assorted security risks
    102 #symbolic-links=0
    103 
    104 #datadir=/localdata/mysql
    105 #socket=/localdata/mysql/mysql.sock
    106 datadir=/svrdb/mysql5.1/jkjarchiver-ap/
    107 socket=/var/lib/mysql/mysql.sock
    108 user=mysql
    109100symbolic-links=0
    110 character-set-server = utf8
     101
     102# Use utf8 (3-bytes unicode) to avoid 767-bytes problem.
     103# Column size will exceed 767-bytes when the default charset, utf8mb4 (4-bytes unicode) is used.
     104character-set-server = utf8mb3
     105collation-server     = utf8_general_ci
     106
     107#
    111108innodb_flush_log_at_trx_commit = 1
    112 
    113 [mysqld_safe]
    114 log-error=/var/log/mysqld.log
    115 pid-file=/var/run/mysqld/mysqld.pid
    116 }}}
    117 
    118 * Rasibianのmariadbの場
    119  /etc/mysql/mariadb.conf.d/50-server.cnfでdatadirを適宜書き換える。
    120  debian由来のmariadbでは、デフォルトの文字コードがutf8mb(4-bytes unicode)になっているために767バイト制限に引っかかってテーブルを作れない。次のファイルを書き換えてutf8 (3-bytes unicode)を使うようにする。
    121  * /etc/mysql/mariadb.conf.d/50-server.cnf
    122 {{{
    123 ...
    124 [mysqld]
    125 ...
    126 character-set-server  = utf8
    127 collation-server      = utf8_general_ci
    128 ...
    129 }}}
    130  * /etc/mysql/mariadb.conf.d/50-mysql-clients.cnf
     109}}}
     110
     111* /etc/my.cnf.d/mysql-clients.cnfも書き換える
    131112{{{
    132113...
    133114[mysql]
    134 ...
    135115default-character-set = utf8
    136116...
    137117}}}
    138  * /etc/mysql/mariadb.conf.d/50-clients.cnf
    139   * AAはmysqlクライアントなので、mariadbクライアント向けの設定は変えなくてもよい
    140118
    141119== logrotate ==
    142 /etc/logrotate.d/mysqld に手順が書いてある。後回し。
     120/etc/logrotate.d/mariadb に手順が書いてある。後回し。
    143121
    144122== mysqlサーバ自動起動の設定 ==
    145 * SL6の場合
    146 MySQLをインストールしても自動起動しない。自動起動するように設定する
    147 {{{
    148 # cd /etc/rd.c/ini.d
    149 # /sbin/chkconfig  --level 3 mysqld on
    150 # /sbin/chkconfig  --level 4 mysqld on
    151 # /sbin/chkconfig  --level 5 mysqld on
     123MariaDBをインストールしても自動起動しない。自動起動するように設定する
     124{{{
     125# systemctl enable mariadb
    152126}}}
    153127
    154128== MySQLサーバの起動 ==
    155 * SL6のrpmパッケージでMySQLをインストールした場合
    156 MySQLサーバの初回起動時に(dbが存在しなければ)dbを作ってくれる。
    157 {{{
    158 # /etc/rc.d/init.d/mysqld start
    159 MySQL データベースを初期化中:  Installing MySQL system tables...
    160 
    161 Filling help tables...
    162 OK
    163 
    164 To start mysqld at boot time you have to copy
    165 support-files/mysql.server to the right place for your system
    166 
    167 PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    168 To do so, start the server, then issue the following commands:
    169 
    170 /usr/bin/mysqladmin -u root password 'new-password'
    171 /usr/bin/mysqladmin -u root -h jkjarchiver-ap.mr.jkcont password 'new-password'
    172 
    173 Alternatively you can run:
    174 /usr/bin/mysql_secure_installation
    175 
    176 which will also give you the option of removing the test
    177 databases and anonymous user created by default.  This is
    178 strongly recommended for production servers.
    179 
    180 See the manual for more instructions.
    181 
    182 You can start the MySQL daemon with:
    183 cd /usr ; /usr/bin/mysqld_safe &
    184 
    185 You can test the MySQL daemon with mysql-test-run.pl
    186 cd /usr/mysql-test ; perl mysql-test-run.pl
    187 
    188 Please report any problems with the /usr/bin/mysqlbug script!
    189 
    190                                                            [  OK  ]
    191 mysqld を起動中:                                           [  OK  ]
    192 }}}
    193 
    194 * Raspbianのmariadbの場合
    195 datadirを標準のものから変えた場合は明示的にdbを作る必要がある。
    196 {{{
    197 systemctl stop mariadb
    198 mysql_install_db --user=mysql --datadir=/localdata/mysql
    199 systemctl start mariadb
     129MariaDBの回起動時に(dbが存在しなければ)dbを作ってくれる。
     130{{{
     131# systemctl start mariadb
    200132}}}
    201133
    202134== /usr/bin/mysql_secure_installation ==
    203 MySQLの初期設定を行う。質問をよく読む。Yes/Noの質問には全てYで答える。
     135MySQLの初期設定を行う。質問をよく読む。質問をよく読んでか答える
    204136
    205137{{{
    206138# /usr/bin/mysql_secure_installation
    207 
    208 
    209 
    210 
    211 NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
    212       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
    213 
    214 
    215 In order to log into MySQL to secure it, we'll need the current
    216 password for the root user.  If you've just installed MySQL, and
    217 you haven't set the root password yet, the password will be blank,
    218 so you should just press enter here.
    219 
    220 Enter current password for root (enter for none):
    221 OK, successfully used password, moving on...
    222 
    223 Setting the root password ensures that nobody can log into the MySQL
    224 root user without the proper authorisation.
    225 
    226 Set root password? [Y/n] Y
    227 New password:
    228 Re-enter new password:
    229 Password updated successfully!
    230 Reloading privilege tables..
    231  ... Success!
    232 
    233 
    234 By default, a MySQL installation has an anonymous user, allowing anyone
    235 to log into MySQL without having to have a user account created for
    236 them.  This is intended only for testing, and to make the installation
    237 go a bit smoother.  You should remove them before moving into a
    238 production environment.
    239 
    240 Remove anonymous users? [Y/n] y
    241  ... Success!
    242 
    243 Normally, root should only be allowed to connect from 'localhost'.  This
    244 ensures that someone cannot guess at the root password from the network.
    245 
    246 Disallow root login remotely? [Y/n] y
    247  ... Success!
    248 
    249 By default, MySQL comes with a database named 'test' that anyone can
    250 access.  This is also intended only for testing, and should be removed
    251 before moving into a production environment.
    252 
    253 Remove test database and access to it? [Y/n] y
    254  - Dropping test database...
    255  ... Success!
    256  - Removing privileges on test database...
    257  ... Success!
    258 
    259 Reloading the privilege tables will ensure that all changes made so far
    260 will take effect immediately.
    261 
    262 Reload privilege tables now? [Y/n] y
    263  ... Success!
    264 
    265 Cleaning up...
    266 
    267 
    268 
    269 All done!  If you've completed all of the above steps, your MySQL
    270 installation should now be secure.
    271 
    272 Thanks for using MySQL!
    273 }}}
     139}}}
     140* Enter current password for root (enter for none): ← ルートのパスワード を入力する
     141* Switch to unix_socket authentication [Y/n] ← n
     142* Change the root password? [Y/n] ← n
     143* Remove anonymous users? [Y/n] ← y
     144* Disallow root login remotely? [Y/n] ← nが安全だが状況に応じて
     145* Remove test database and access to it? [Y/n] ← いらないのでy
     146* Reload privilege tables now? [Y/n] ← y
    274147
    275148== schemaの作成 ==
    276149DB(archappl), ユーザー(archappl)とパスワード(archappl)を作る。
    277 
     150suでrootになってから作業する
    278151{{{
    279152% mysql -u root -p
    280153Enter password:
    281 Welcome to the MySQL monitor.  Commands end with ; or \g.
    282 Your MySQL connection id is 14
    283 Server version: 5.1.73 Source distribution
    284 
    285 Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    286 
    287 Oracle is a registered trademark of Oracle Corporation and/or its
    288 affiliates. Other names may be trademarks of their respective
    289 owners.
     154Welcome to the MariaDB monitor.  Commands end with ; or \g.
     155Your MariaDB connection id is 14
     156Server version: 10.5.22-MariaDB MariaDB Server
     157
     158Copyright (c) 2000, 2018, Oracle, MariaDB Corporation AB and others.
    290159
    291160Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    292161
    293162mysql> CREATE DATABASE IF NOT EXISTS archappl;
    294 Query OK, 1 row affected (0.00 sec)
     163Query OK, 1 row affected (0.001 sec)
    295164
    296165mysql> GRANT ALL PRIVILEGES ON archappl.* TO 'archappl'@'localhost' IDENTIFIED BY 'archappl';
    297 Query OK, 0 rows affected (0.00 sec)
    298 }}}
    299 
     166Query OK, 0 rows affected (0.002 sec)
     167}}}
    300168== テーブルの作成 ==
    301169AA用のテーブルはAAのインストールスクリプト(後述)が作ってくれる。
     
    304172
    305173インストールスクリプトを走せると、
    306 1. MySQLのテーブル
     1741. MariaDBのテーブル
    3071751. Tomcatのデプロイ
    3081761. アプライアンスの設定ファイルの作成
     
    314182{{{
    315183# mkdir -p /opt/archappl
     184# chown epics:epics /opt/archappl
    316185}}}
    317186
     
    349218HIHI等のメタフィールドは保存しない。pvPolicyDict\["archiveFields"\]は空のarrayにしておく。
    350219
     220== JAVA_HOME ==
     221JAVA_HOMEを設定してく
     222{{{
     223% export JAVA_HOME=/usr/lib/jvm/java-17
     224}}}
     225
    351226== インストールスクリプト ==
    352227予めインストール先のディレクトリを作っておく。epicsアカウントで書き込めるようにownerを変更しておく:
     
    354229# mkdir -p /opt/archappl
    355230# chown epics.epics /opt/archappl
     231}}}
     232
     233インストールスクリプトはpython2向けに書かれているので、python3でも動くように[]パッチをあてる
     234{{{
     235cd ~epics/archappl/workspace
     236curl https://cerldev.kek.jp/trac/EpicsUsersJP/attachment/wiki/epics/Archiver%20Appliance%20%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%83%A1%E3%83%A2/install_scripts_python3.patch
     237patch -p0 < install_script_python3.patch
    356238}}}
    357239
     
    363245* apache-tomcat-x.y.z.tar.gz の所在
    364246* mysql-connector-java-x.y.z-bin.jar の所在
     247* 環境変数ARCHAPPL_APPLIANCESが設定されていない場合、先に進むかどうか → Yesを答えると自動的に設定してくれる
    365248* mysqlサーバに接続するためのmysqlコマンドに渡す引き数 → ここでは--user=archappl --password=archappl --database=archappl
    366249* ポリシーファイル(policies.py)の所在
     
    375258...
    376259Setting TOMCAT_HOME to the mgmt webapp in /opt/archappl/mgmt
    377 Setting TOMCAT_HOME to /opt/archappl/apache-tomcat-8.5.16
     260Setting TOMCAT_HOME to /opt/archappl/apache-tomcat-9.0.33
    378261Calling deploy release with /opt/archappl/deployRelease.sh /home/epics/archappl/workspace
    379262Deploying a new release from /home/epics/archappl/workspace onto /opt/archappl