| | 1 | = EPICS Base Install = |
| | 2 | |
| | 3 | == 準備 == |
| | 4 | EPICS コンパイルに必要なパッケージをインストールする(screen, emacs, tcsh などは趣味の問題なので必須ではない) |
| | 5 | {{{ |
| | 6 | [root@centos-rpi2 ~]# yum install --skip-broken which gcc gcc-c++ make wget bind-utils perl perl-devel readline-devel screen emacs lsof telnet tcsh |
| | 7 | }}} |
| | 8 | |
| | 9 | --skip-broken を指定する必用があった。 |
| | 10 | (GtkなどのXwindow 関連パッケージを先に入れておけば出ないのかもしれないし、ARM用だからなのかもしれない。未調査。) |
| | 11 | |
| | 12 | == re2c をパッケージで入れようとしたが == |
| | 13 | いつものように EPEL追加してインストールしようとしたが.... |
| | 14 | 参考:https://wiki.centos.org/SpecialInterestGroup/AltArch/Arm32#head-f2a772703b3caa90cc284e01bc87423ce9a87bcd の手順に従って |
| | 15 | {{{ |
| | 16 | # vi /etc/yum.repos.d/epel.repo |
| | 17 | |
| | 18 | [epel] |
| | 19 | name=Epel rebuild for armhfp |
| | 20 | baseurl=https://armv7.dev.centos.org/repodir/epel-pass-1/ |
| | 21 | enabled=0 |
| | 22 | gpgcheck=0 |
| | 23 | |
| | 24 | }}} |
| | 25 | としておいて、 |
| | 26 | {{{ |
| | 27 | yum --enablerepo=epel install re2c |
| | 28 | }}} |
| | 29 | とする ---> この方式ではインストールできなかった。 |
| | 30 | |
| | 31 | == re2c をソースからインストール == |
| | 32 | https://sourceforge.net/projects/re2c/files/ からソースをダウンロードして、configure, make, make install したのみ。/usr/localにインストールした。 |
| | 33 | |
| | 34 | == EPICS == |
| | 35 | http://cerldev.kek.jp/trac/EpicsUsersJP/wiki/epics/install/epics_base |
| | 36 | と同じ方針で |
| | 37 | ユーザー作成 |
| | 38 | {{{ |
| | 39 | # useradd -s /bin/bash epics |
| | 40 | # passwd epics |
| | 41 | }}} |
| | 42 | |
| | 43 | {{{ |
| | 44 | [root@centos-rpi2 /]# cd opt/ |
| | 45 | [root@centos-rpi2 opt]# ls |
| | 46 | [root@centos-rpi2 opt]# mkdir epics |
| | 47 | [root@centos-rpi2 opt]# chown epics:epics epics |
| | 48 | }}} |
| | 49 | |
| | 50 | あとは epics ユーザーで作業 |
| | 51 | {{{ |
| | 52 | [epics@centos-rpi2 ~]$ cd /opt/epics/ |
| | 53 | [epics@centos-rpi2 epics]$ mkdir R315.5 arc |
| | 54 | [epics@centos-rpi2 epics]$ cd arc/ |
| | 55 | [epics@centos-rpi2 arc]$ wget https://www.aps.anl.gov/epics/download/base/base-3.15.5.tar.gz |
| | 56 | [epics@centos-rpi2 arc]$ /opt/epics/R315.5 |
| | 57 | [epics@centos-rpi2 R315.5]$ gzip -dc ../arc/base-3.15.5.tar.gz | tar xvf - |
| | 58 | [epics@centos-rpi2 R315.5]$ mv base-3.15.5 base |
| | 59 | [epics@centos-rpi2 R315.5]$ cd base |
| | 60 | }}} |
| | 61 | |
| | 62 | {{{ |
| | 63 | [epics@centos-rpi2 base]$ export EPICS_HOST_ARCH=linux-arm |
| | 64 | [epics@centos-rpi2 base]$ export LANG=C |
| | 65 | [epics@centos-rpi2 base]$ make |
| | 66 | }}} |
| | 67 | |
| | 68 | 約30分でmake終了した。 |
| | 69 | |
| | 70 | == EPICS Application 作成 == |
| | 71 | {{{ |
| | 72 | export EPICS_HOST_ARCH=linux-arm |
| | 73 | PATH=$PATH:$HOME/.local/bin:$HOME/bin |
| | 74 | PATH=$PATH:/opt/epics/R315.5/base/bin/$EPICS_HOST_ARCH |
| | 75 | |
| | 76 | export PATH |
| | 77 | }}} |
| | 78 | |
| | 79 | {{{ |
| | 80 | [epics@centos-rpi2 ~]$ mkdir -p app/example |
| | 81 | [epics@centos-rpi2 ~]$ cd app/example/ |
| | 82 | [epics@centos-rpi2 example]$ makeBaseApp.pl -l |
| | 83 | Valid application types are: |
| | 84 | example |
| | 85 | caClient |
| | 86 | support |
| | 87 | caServer |
| | 88 | ioc |
| | 89 | Valid iocBoot types are: |
| | 90 | ioc |
| | 91 | example |
| | 92 | |
| | 93 | [epics@centos-rpi2 example]$ makeBaseApp.pl -t example example |
| | 94 | [epics@centos-rpi2 example]$ makeBaseApp.pl -i -t example example |
| | 95 | Using target architecture linux-arm (only one available) |
| | 96 | The following applications are available: |
| | 97 | example |
| | 98 | What application should the IOC(s) boot? |
| | 99 | The default uses the IOC's name, even if not listed above. |
| | 100 | Application name? <---------- enter 押すのみ |
| | 101 | [epics@centos-rpi2 example]$ |
| | 102 | }}} |
| | 103 | |
| | 104 | {{{ |
| | 105 | [epics@centos-rpi2 example]$ make |
| | 106 | make -C ./configure install |
| | 107 | make[1]: ディレクトリ `/home/epics/app/example/configure' に入ります |
| | 108 | perl -CSD /opt/epics/R315.5/base/bin/linux-arm/makeMakefile.pl O.linux-arm ../.. |
| | 109 | mkdir O.Common |
| | 110 | make -C O.linux-arm -f ../Makefile TOP=../.. \ |
| | 111 | ...................................... |
| | 112 | perl -CSD /opt/epics/R315.5/base/bin/linux-arm/convertRelease.pl -t /home/epics/app/example envPaths |
| | 113 | make[2]: ディレクトリ `/home/epics/app/example/iocBoot/iocexample' から出ます |
| | 114 | make[1]: ディレクトリ `/home/epics/app/example/iocBoot' から出ます |
| | 115 | [epics@centos-rpi2 example]$ |
| | 116 | [epics@centos-rpi2 example]$ cd iocBoot/iocexample/ |
| | 117 | [epics@centos-rpi2 iocexample]$ ls |
| | 118 | Makefile README envPaths st.cmd |
| | 119 | [epics@centos-rpi2 iocexample]$ chmod +x st.cmd |
| | 120 | [epics@centos-rpi2 iocexample]$ ./st.cmd |
| | 121 | #!../../bin/linux-arm/example |
| | 122 | ## You may have to change example to something else |
| | 123 | ## everywhere it appears in this file |
| | 124 | < envPaths |
| | 125 | epicsEnvSet("IOC","iocexample") |
| | 126 | epicsEnvSet("TOP","/home/epics/app/example") |
| | 127 | epicsEnvSet("EPICS_BASE","/opt/epics/R315.5/base") |
| | 128 | cd "/home/epics/app/example" |
| | 129 | ## Register all support components |
| | 130 | dbLoadDatabase "dbd/example.dbd" |
| | 131 | example_registerRecordDeviceDriver pdbbase |
| | 132 | ## Load record instances |
| | 133 | dbLoadTemplate "db/user.substitutions" |
| | 134 | dbLoadRecords "db/dbSubExample.db", "user=epics" |
| | 135 | ## Set this to see messages from mySub |
| | 136 | #var mySubDebug 1 |
| | 137 | ## Run this to trace the stages of iocInit |
| | 138 | #traceIocInit |
| | 139 | cd "/home/epics/app/example/iocBoot/iocexample" |
| | 140 | iocInit |
| | 141 | Starting iocInit |
| | 142 | ############################################################################ |
| | 143 | ## EPICS R3.15.5 |
| | 144 | ## EPICS Base built Jun 1 2017 |
| | 145 | ############################################################################ |
| | 146 | iocRun: All initialization complete |
| | 147 | ## Start any sequence programs |
| | 148 | #seq sncExample, "user=epics" |
| | 149 | epics> dbl |
| | 150 | epics:xxxExample |
| | 151 | epics:compressExample |
| | 152 | epics:calcExample |
| | 153 | epics:calcExample1 |
| | 154 | epics:calc1 |
| | 155 | epics:calcExample2 |
| | 156 | epics:calc2 |
| | 157 | epics:calcExample3 |
| | 158 | epics:calc3 |
| | 159 | epics:aSubExample |
| | 160 | epics:subExample |
| | 161 | epics:aiExample |
| | 162 | epics:aiExample1 |
| | 163 | epics:ai1 |
| | 164 | epics:aiExample2 |
| | 165 | epics:ai2 |
| | 166 | epics:aiExample3 |
| | 167 | epics:ai3 |
| | 168 | }}} |
| | 169 | |
| | 170 | IOCの起動はOK. dbpr などで値を確認。 |
| | 171 | |
| | 172 | |
| | 173 | === firewall 設定 === |
| | 174 | デフォルトではfirewallが有効になっている。SELinuxまで含め、全部無効にする手はあるが、CentOS7の流儀を知る良い機会と思ってポートを開ける方法を調べる。 |
| | 175 | |
| | 176 | 参考:http://qiita.com/haminiku/items/56fcb578d86abcd0b571 |
| | 177 | |
| | 178 | |
| | 179 | 設定確認 |
| | 180 | {{{ |
| | 181 | [root@centos-rpi2 ~]# systemctl status firewalld |
| | 182 | ● firewalld.service - firewalld - dynamic firewall daemon |
| | 183 | Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) |
| | 184 | Active: active (running) since 木 1970-01-01 09:00:12 JST; 47 years 4 months ago |
| | 185 | Docs: man:firewalld(1) |
| | 186 | Main PID: 235 (firewalld) |
| | 187 | CGroup: /system.slice/firewalld.service |
| | 188 | mq235 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid |
| | 189 | |
| | 190 | 1月 01 09:00:08 centos-rpi2 systemd[1]: Starting firewalld - dynamic firew.... |
| | 191 | 1月 01 09:00:12 centos-rpi2 systemd[1]: Started firewalld - dynamic firewa.... |
| | 192 | Hint: Some lines were ellipsized, use -l to show in full. |
| | 193 | |
| | 194 | }}} |
| | 195 | |
| | 196 | 稼働状況の確認 |
| | 197 | {{{ |
| | 198 | [root@centos-rpi2 services]# firewall-cmd --list-all |
| | 199 | public (active) |
| | 200 | target: default |
| | 201 | icmp-block-inversion: no |
| | 202 | interfaces: eth0 |
| | 203 | sources: |
| | 204 | services: dhcpv6-client ssh |
| | 205 | ports: |
| | 206 | protocols: |
| | 207 | masquerade: no |
| | 208 | forward-ports: |
| | 209 | sourceports: |
| | 210 | icmp-blocks: |
| | 211 | rich rules: |
| | 212 | }}} |
| | 213 | 上にも記述されているが、サービスのみリストすると |
| | 214 | {{{ |
| | 215 | [root@centos-rpi2 ~]# firewall-cmd --list-services --zone=public --permanent |
| | 216 | dhcpv6-client ssh |
| | 217 | }}} |
| | 218 | 利用可能なサービスの一覧は以下のコマンドで参照可能 |
| | 219 | {{{ |
| | 220 | [root@centos-rpi2 services]# firewall-cmd --get-services |
| | 221 | RH-Satellite-6 amanda-client ..... xmpp-client xmpp-local xmpp-server |
| | 222 | }}} |
| | 223 | コマンドラインで指定しても良いが、epics用の設定ファイルを作る方針とする。 |
| | 224 | {{{ /usr/lib/firewalld/services }}} ディレクトリにサービスごとの定義ファイルがある。 |
| | 225 | ここからコピーして使用 |
| | 226 | {{{ |
| | 227 | [root@centos-rpi2 ~]# cd /usr/lib/firewalld/services |
| | 228 | [root@centos-rpi2 services]# cp amanda-client.xml epics.xml |
| | 229 | [root@centos-rpi2 services]# vi epics.xml |
| | 230 | 以下のように編集 |
| | 231 | |
| | 232 | <?xml version="1.0" encoding="utf-8"?> |
| | 233 | <service> |
| | 234 | <short>EPICS</short> |
| | 235 | <description>EPICS Control System port</description> |
| | 236 | <port protocol="tcp" port="5064"/> |
| | 237 | <port protocol="tcp" port="5065"/> |
| | 238 | <port protocol="udp" port="5064"/> |
| | 239 | <port protocol="udp" port="5065"/> |
| | 240 | </service> |
| | 241 | }}} |
| | 242 | |
| | 243 | サービス追加 |
| | 244 | {{{ |
| | 245 | [root@centos-rpi2 services]# firewall-cmd --add-service=epics --zone=public --permanent |
| | 246 | success |
| | 247 | [root@centos-rpi2 services]# |
| | 248 | [root@centos-rpi2 services]# firewall-cmd --list-services --zone=public --permanent |
| | 249 | dhcpv6-client epics ssh |
| | 250 | [root@centos-rpi2 services]# firewall-cmd --reload |
| | 251 | }}} |
| | 252 | 念のため一覧表示してみて、epics がpublic ゾーンで有効になっていることを確認 |
| | 253 | {{{ |
| | 254 | [root@centos-rpi2 services]# firewall-cmd --list-all-zones |
| | 255 | public (active) |
| | 256 | target: default |
| | 257 | icmp-block-inversion: no |
| | 258 | interfaces: eth0 |
| | 259 | sources: |
| | 260 | services: dhcpv6-client epics ssh |
| | 261 | ports: |
| | 262 | protocols: |
| | 263 | masquerade: no |
| | 264 | forward-ports: |
| | 265 | sourceports: |
| | 266 | icmp-blocks: |
| | 267 | rich rules: |
| | 268 | |
| | 269 | }}} |
| | 270 | |
| | 271 | == EPICS Client == |
| | 272 | {{{ |
| | 273 | [epics@centos-rpi2 ~]$ camonitor epics:ai1 |
| | 274 | epics:ai1 2017-06-01 17:59:22.096207 8 HIHI MAJOR |
| | 275 | epics:ai1 2017-06-01 17:59:23.096240 9 HIHI MAJOR |
| | 276 | epics:ai1 2017-06-01 17:59:24.096190 0 LOLO MAJOR |
| | 277 | .... |
| | 278 | |
| | 279 | }}} |
| | 280 | O.K.! 外部ホストであるノートPCクライアントからも値が取れることを確認した。 |
| | 281 | |
| | 282 | {{{ |
| | 283 | [epics@centos-rpi2 ~]$ netstat -an | grep 5064 |
| | 284 | tcp 0 0 0.0.0.0:5064 0.0.0.0:* LISTEN |
| | 285 | udp 0 0 0.0.0.0:5064 0.0.0.0:* |
| | 286 | |
| | 287 | }}} |
| | 288 | |