ラベル yum の投稿を表示しています。 すべての投稿を表示
ラベル yum の投稿を表示しています。 すべての投稿を表示

2019年3月22日金曜日

curses.hが無いと言われる。

bwmon
http://bwmon.sourceforge.net/
という、昔からある帯域モニターをインストールしようとしたときの事。

bwmon.c:3:20: 致命的エラー: curses.h: そのようなファイルやディレクトリはありません

うーん。
どうもライブラリがないと言う事らしい。

ググると、
https://teratail.com/questions/46889
とのことで、ググらなくても大丈夫らしい。これは使える。
テンプレは

yum provides \*/ライブラリ名
(円マークはバックスラッシュ)

実行結果は

# yum provides \*/curses.h
読み込んだプラグイン:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.fairway.ne.jp
 * extras: mirror.fairway.ne.jp
 * updates: mirror.fairway.ne.jp
extras/7/x86_64/filelists_db                                                                                                                                                                             | 235 kB  00:00:00
updates/7/x86_64/filelists_db                                                                                                                                                                            | 2.6 MB  00:00:00
ncurses-devel-5.9-14.20130511.el7_4.i686 : Development files for the ncurses library
リポジトリー        : base
一致          :
ファイル名    : /usr/include/ncurses/curses.h
ファイル名    : /usr/include/ncursesw/curses.h
ファイル名    : /usr/include/curses.h



ncurses-devel-5.9-14.20130511.el7_4.x86_64 : Development files for the ncurses library
リポジトリー        : base
一致          :
ファイル名    : /usr/include/ncurses/curses.h
ファイル名    : /usr/include/ncursesw/curses.h
ファイル名    : /usr/include/curses.h



ncurses-devel-5.9-14.20130511.el7_4.x86_64 : Development files for the ncurses library
リポジトリー        : @base
一致          :
ファイル名    : /usr/include/ncurses/curses.h
ファイル名    : /usr/include/curses.h
ファイル名    : /usr/include/ncursesw/curses.h

とのことで、「ncurses-devel」を入れれば良いよ、ということを教えてくれる。
ただ、ググる癖が付いてしまったので、次はこのyumの書き方をググりそうな気がする・・・。

2017年7月6日木曜日

ntpを設定するのと、squidプロキシを噛ませてyum出来るようにする

最近ファイルスタンプのずれが気になるという声が「やっと」聞けたので、ntpを設定していこうと思い立った。
もののついでに、SSLプロキシがはまったせいで、yumさえ出来なかったサーバプロキシの設定をしてyum出来るようにする。

まずゲートウェイサーバをNTPサーバにする。と言っても、外部NTPサーバと同期させるというだけである。
詳しいNTPについては
http://tech.ckme.co.jp/ntp.shtml

環境はcentos5~7、192.168.168.1がプロキシ兼NTPサーバとする。

yum install ntp
設定ファイルを編集
vi /etc/ntp.conf
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap <これをコピーして下で編集
restrict 192.168.168.0 mask 255.255.255.0 nomodify notrap

あと同ファイルで
server ntp.nict.jp#<<公開NTPサービス
server ntp1.jst.mfeed.ad.jp#<<公開NTPサービスに同期している会社の公開NTP
server ntp2.jst.mfeed.ad.jp
server ntp3.jst.mfeed.ad.jp
server 契約しているISPのNTPサービス
#server 0.centos.pool.ntp.org iburst#デフォルトのはコメントアウトして負荷を減らす
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
これで設定終了。

ntpdate ntp.nict.jp
で手動同期。

systemctl start ntpd
systemctl enable ntpd
で自動起動させる。

iptablesでFW機能をさせているので、iptablesにローカルから自機へのNTP問い合わせ許可設定をする
iptables -I INPUT -p udp --dport 123  -s $trusthost -d $mylanip -j ACCEPT
*$trusthostはローカルIP群、たとえば192.168.168.0/24、$mylanipは、LAN側のIP(この場合は192.168.168.1)。厳密にしないなら-sと-dは無くても良い。

次に、クライアント側設定。
プロキシを通すので、yumの設定ファイルにプロキシを追加
vi /etc/yum.conf

#proxy=http://PROXY-SERVER.ADDRESS:port
proxy=http://192.168.168.1:8080


プロキシの噛ませ方は、以下のページが詳しい
http://fj.hatenablog.jp/entry/2014/08/20/204554

で、サーバと同じようにyumでNTPを入れる

yum install ntp
設定ファイルを編集
vi /etc/ntp.conf
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap <これをコピーして下で編集
restrict 192.168.168.0 mask 255.255.255.0 nomodify notrap
更に、サーバはnictを登録したけど、クライアントはnictを参照させず、NTPサーバを参照させるので
server 192.168.168.1
とする。
ntpdate 192.168.168.1
で手動同期。

systemctl start ntpd
systemctl enable ntpd
で自動起動させる。

追記
上記でも良いけど、設定しながら「これってntpdateをcronで動かした方がリソース消費しなくね?」という事実に気付き、上記の設定ファイルの編集をせず、たとえば
vi /etc/cron.daily/ntpdate_update.sh
とかで新規ファイルを作って
#!/bin/sh
ntpdate 192.168.168.1
で保存し、
chmod +x ntpdate_update.sh
で実行権限付けて、デーモンは動かさないことにした。クライアントなんだから走らせ続ける意味はないわな。
まあ別に走らせても良いと言えばいいわけで(どうせローカル参照だし)、取り消し線で済ませておくことにする。

手動あわせしようとした際に出る「the NTP socket is in use, exiting」というエラーメッセージは、読んで字のごとく、「NTPソケットはもう使ってるから!」と言われている。
おとなしく
systemctl stop ntpd
なり
service ntpd stopなりでNTPを止めてから
再度実行して下さい。

備忘録
オレオレ証明書等ルート証明書をlinuxに読ませる場合
centos7
https://cloudpack.media/14148
/usr/share/pki/ca-trust-source/anchors
に証明書をコピーして
update-ca-trust extract
を実行

centos5~6
https://wp.kaz.bz/tech/2013/05/02/1651.html
/etc/pki/tls/certs/にコピーか、
/etc/pki/tls/certs/ca-bundle.crtに追記する。