# 環境構築用(for Linux) # Conda & CIAO :::info macOS 個人的にzshは苦手なのでbashに置き換える。 またターミナルを開いた時に読み込まれるのがbash_profileらしいので、こちらに設定を書き込んでいく。 ::: :::info 最近のmacはCPUがintel製のものとmac製のものがあるらしい。これによってダウンロードするもののバージョンが変わったりするので注意。 ::: ```bash= cd mkdir mylib cd mylib #minicondaをdownload curl -o get_conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh #dpwnload bash get_conda.sh #PATH  .profileに以下を書き込む(macなら.bash_profileとか.zshrcとか適宜変える) export PATH="/$HOME/miniconda3/bin:$PATH" #condaをactivate conda activate base #ciaoをdownload conda create -n ciao-4.16 -c https://cxc.cfa.harvard.edu/conda/ciao \ -c conda-forge ciao pyciao sherpa ds9 ciao-contrib caldb_main marx python=3.11 source activate ciao-4.16 #スモークテスト cd $ASCDS_INSTALL/ bash test/smoke/bin/run_smoke_tests.sh #なんかわからんけど、すべて(ciao-4.16) #homeで実行 conda install -n ciao-4.16 -c conda-forge jupyter astropy scipy conda install -n ciao-4.16 -c https://cxc.cfa.harvard.edu/conda/ciao -c conda-forge acis_bkg_evt pip3 install bash_kernel ``` ```bash= cat <<EOF >> ~/.bashrc ``` を使うと次のEOFまでの文章を書き込めるらしい。 スモークテストの結果 ds9がFAILになってるのはたぶん大丈夫そう。 ```bash= Requested test suite includes 37 tests [1/37] Running test ahelp-smoke001 ... PASS [2/37] Running test dm-smoke001 ... PASS [3/37] Running test dm-smoke002 ... PASS [4/37] Running test dm-smoke003 ... PASS [5/37] Running test dm-smoke004 ... PASS [6/37] Running test dm-smoke005 ... PASS [7/37] Running test dm-smoke006 ... PASS [8/37] Running test dm-smoke007 ... PASS [9/37] Running test ds9-smoke001 ... FAIL Review /tmp/smoke.fujiwara/ds9-smoke001/diff.log for details [10/37] Running test ipython-smoke001 ... PASS [11/37] Running test ipython-smoke002 ... PASS [12/37] Running test obsvis-smoke001 ... PASS [13/37] Running test sherpa-smoke001 ... PASS [14/37] Running test tools-ape-smoke001 ... PASS [15/37] Running test tools-arfcorr-smoke001 ... PASS [16/37] Running test tools-asphist-smoke001 ... PASS [17/37] Running test tools-asphist-smoke002 ... PASS [18/37] Running test tools-csmooth-smoke001 ... PASS [19/37] Running test tools-dmcoords-smoke001 ... PASS [20/37] Running test tools-dmcoords-smoke002 ... PASS [21/37] Running test tools-dme-smoke001 ... PASS [22/37] Running test tools-dme-smoke002 ... PASS [23/37] Running test tools-dmstat-smoke001 ... PASS [24/37] Running test tools-dmstat-smoke002 ... PASS [25/37] Running test tools-dmstat-smoke003 ... PASS [26/37] Running test tools-hpe-smoke001 ... PASS [27/37] Running test tools-mkacisrmf-smoke001 ... PASS [28/37] Running test tools-mkacisrmf-smoke002 ... PASS [29/37] Running test tools-mkacisrmf-smoke003 ... PASS [30/37] Running test tools-mkwarf-smoke001 ... PASS [31/37] Running test tools-mkwarf-smoke002 ... PASS [32/37] Running test tools-tcm-smoke001 ... PASS [33/37] Running test tools-tgdetect-smoke001 ... PASS [34/37] Running test tools-tge2-smoke001 ... PASS [35/37] Running test tools-tge-smoke001 ... PASS [36/37] Running test tools-tre-smoke001 ... PASS [37/37] Running test tools-wav-smoke001 ... PASS 37 smoke tests run: 36 PASSED, 1 FAILED, 0 SKIPPED !! CIAO MAY HAVE FAILED TO INSTALL PROPERLY !! Please check https://cxc.harvard.edu/ciao/bugs/smoke.html for a list of known issues before contacting the Help Desk. ``` # heasoft :::info 参考にしたサイト 吉武さんメモ https://hackmd.io/@ystl/Skamh2XDB#%E3%81%BE%E3%81%9A%E3%81%AF%E3%83%80%E3%82%A6%E3%83%B3%E3%83%AD%E3%83%BC%E3%83%89 環境の前提条件 https://heasarc.gsfc.nasa.gov/lheasoft/linux.html anacondaでheasoft https://qiita.com/yamadasuzaku/items/57829c607f6d5f15ce94 https://qiita.com/yamadasuzaku/items/8c6ddc4cf37fbb8ac8ed x86_64-pc-linux-gnu-libc2.35がない問題 https://www.heal.phy.saitama-u.ac.jp/~terada/web_archive/cosmic.riken.jp/suzaku/help/guide/fstep_web/node14.html#sub.inst.bin ::: 以下やったこと Macはここから https://qiita.com/yusuke_s_yusuke/items/b6154c79900e718214b3 :::danger 足らないものは全て ```bash= conda install XXX ``` で解決!!! ::: ```bash= #吉武さんのメモに従ってheasoft-6.32.1src.tar.gzをmyPCにダウンロード。 cd mylib #heasoft-6.32.1src.tar.gzを~/mylibに移動 # https://heasarc.gsfc.nasa.gov/docs/software/lheasoft/download.html mv ~/Download/heasoft-6.32.1src.tar.gz ~/mylib #環境変数設定、.bashrcとかに書き込むのではなく、コマンドラインに打つだけでいいらしい。以下これを打ったterminalを使う。 # pathは適宜書き換えて!! export CC=/usr/bin/gcc export CXX=/usr/bin/g++ export FC=/usr/bin/gfortran export PERL=/usr/bin/perl PYTHON=/home/fujiwara/anaconda3/bin/python3 #export FC=/opt/homebrew/bin/gfortran Mac silicon #export FC=/usr/local/bin/gfortran Mac intel #export PYTHON=/Users/fujiwarakanta/anaconda3/bin/python3 Mac #conda deactivate #mac brew install gcc #which gfortran #にパスをを通す #export PYTHON=/usr/bin/python3 #export #↑pathは適時自分のものに変える #(base)でapt-installされたものはcondaに入る #/opt/anacondas/python3 #解凍 tar xvf heasoft* #pathを通してビルドとインストール export PATH="/usr/bin:$PATH" #new! cd $HOME/mylib/heasoft-6.32.1/BULID_DIR ./configure  make  #結構時間かかる make install   cat <<EOF >> ~/.bashrc export HEADAS=/home/fujiwara/mylib/soft/heasoft-6.35.1/x86_64-pc-linux-gnu-libc2.35 source $HEADAS/headas-init.sh EOF source ~/.bashrc #xspec準備 .xspecを生成する xspec #出力変更 vim ~/.xspec/Xspec.init # この長い設定ファイルの143行目あたりにあるPLOTTING DEVICEの右辺を/null -> /XWINDOW or /XSERVERに書き換える #最後にxspecと打って黒いウィンドウが出てきたら成功 ``` :::warning 2025/04/10 ./configureの時に ```bash= export PATH="/usr/bin:$PATH" export PYTHON=/home/fujiwara/anaconda3/bin/python3 ``` としてもpythonのPATHが書きかわらない時がある。 exportでPYTHONを変更しても、システムの環境変数PATHが変更されていないかららしい。(よくわからない) ```bash= export PATH=/home/fujiwara/anaconda3/bin:$PATH ``` で書き換えると、うまく./configureできた。 ::: # cfitsio 中谷さんからもらったスクリプト ```bash= #cfitsio_version="4.2.0" cfitsio_version="4.3.1" mkdir $HOME/mylib/soft/cfitsio -p \ && cd $HOME/mylib/soft/cfitsio/ \ && wget http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-${cfitsio_version}.tar.gz \ && tar xvf cfitsio-${cfitsio_version}.tar.gz \ && cd cfitsio-${cfitsio_version} \ && ./configure && make && make install #最後の一行でエラー"C compiler ..." export CC=/usr/bin/gcc export CXX=/usr/bin/g++ export FC=/usr/bin/gfortran export PERL=/usr/bin/perl export PYTHON=$HOME/anaconda3/bin/python3 cd $HOME/mylib/heasoft-6.32.1/BUILD_DIR/ make clean ; ./configure && make && make install ``` # sas :::danger 最初sasをダウンロードしたときにSAS_PERLがないみたいなエラーが出たのでperlをダウンロードした。 またsasもインストールしたもののバージョンがpapagenaと合わなかったのでバージョンを確認してインストールしなおした。 ::: 以下実行したこと ```bash= #perlのinstall wget -O - https://install.perlbrew.pl | bash cat <<EOF >> ~/.profile #SAS_PERL export SAS_PERL=~/perl5/perlbrew/bin/perlbrew EOF source .profile ________________________________________________ #以下sasのinstall cd mylib/soft mkdir sas cd sas #papagenaのPCのversionを"lsb_release -a"でチェックしてそれに合うsasをダウンロード #でないとsasと打った時に変なエラーが出る! # wget https://sasdev-xmm.esac.esa.int/pub/sas/21.0.0/Linux/Ubuntu20.04/sas_21.0.0-Ubuntu20.04.tgz wget https://sasdev-xmm.esac.esa.int/pub/sas/21.0.0/macOS/12.6/sas_21.0.0-macOS-12.6.tgz ここまでやった ================================ #解凍など tar xvf sas_21.0.0-Ubuntu20.04.tgz ./install.sh cat <<EOF >> ~/.bashrc export SAS_DIR=~/mylib/soft/sas/xmmsas_20230412_1735 alias sas="source $SAS_DIR/setsas.sh" export SAS_CCFPATH=$CALDB/data/xmm/ccf export SAS_VERBOSITY=3 export SAS_SUPPRESS_WARNING=3 export SAS_IMAGEVIEWER=ds9 export LHEASOFT=$HEADAS EOF source ~/.bashrc ``` sasとうちこんで ```bash= sasversion:- Executing (routine): sasversion -w 1 -V 4 sasversion:- sasversion (sasversion-1.3) [xmmsas_20230412_1735-21.0.0] started: 2023-12-19T02:31:06.000 sasversion:- XMM-Newton SAS release and build information: SAS release: xmmsas_20230412_1735-21.0.0 Compiled on: Sun Apr 16 21:03:02 CEST 2023 Compiled by: sasbuild@sasbld01n.iuser.lan Platform : Ubuntu20.04 SAS-related environment variables that are set: SAS_DIR = /home/fujiwara/mylib/soft/sas/xmmsas_20230412_1735 SAS_PATH = /home/fujiwara/mylib/soft/sas/xmmsas_20230412_1735 SAS_CCFPATH = /home/fujiwara/hea/caldb/data/xmm/ccf sasversion:- sasversion (sasversion-1.3) [xmmsas_20230412_1735-21.0.0] ended: 2023-12-19T02:31:06.000 Do not forget to define SAS_CCFPATH, SAS_CCF and SAS_ODF ``` が出てきたらOK!SAS_CCFPATH, SAS_CCF and SAS_ODFは吉武さんスクリプトに従ったらちゃんと定義できるみたいなので最後の一文は無視していい。 :::warning 一回データがうまくいかなかったのですべてを削除して入れなおした。その際、./install.shでusr/binのpythonではsasをインストールできないみたいに怒られたので ```bash= PYTHON=/home/fujiwara/anaconda3/bin/python3 ``` を打ってから./install.shを実行した。 また、./install.shに失敗したらtar xvf sas_21.0.0-Ubuntu20.04.tgzからやり直さなければならない。 ::: # その他 ## 公開鍵認証 初めて鍵を作るとき ```bash= ssh-keygen -t rsa -b 4096 ``` これで .ssh/にid_rsa、id_rsa.pubができる id_rsaが秘密鍵、id_rsa_pubが公開鍵 公開鍵を接続したいPCの~/.ssh/authorized_keysに書きこむ 書き込めない場合は以下のコマンドで送信 ```bash= ssh-copy-id -i ~/.ssh/id_rsa.pub [ホスト名] #リモートへ公開鍵を転送する ``` 最後にリモートPCにショートカットを書き込む ```bash= #@~/.ssh/config Host susanna HostName 10.226.164.999 User fujiwara Forwardx11 yes IdentityFile ~/.ssh/id_rsa ``` ::: ```bash= ssh ホスト名 ``` でSSH接続完了! ![image](https://hackmd.io/_uploads/ryg92zxk1l.png) ![image](https://hackmd.io/_uploads/BJvES_fk1e.png) suzakuも粗いけどできた