人気ブログランキング | 話題のタグを見る

What Would Jesus Do?

s3cmd 1.0.1をインストール

現在yumでs3cmdコマンドをインストールすると、
バージョン 0.9.9.91がインストールされます。

CentOS6で0.9.9.91を利用しますと、
下記のWarningがでます。

/usr/lib/python2.6/site-packages/S3/Utils.py:17: DeprecationWarning: the sha module is deprecated; use the hashlib module instead

このWarningは、1.0.1をインストールして回避できます。

s3cmdはここからダウンロードできます。

インストールは解凍後、
python setup.py install
となります。

Warningが気になる場合は、インストールをしてみてはどうでしょうか



# by cimacoppi | 2012-01-06 13:49 | Linux

MySQL5.1をソースからコンパイル

今回は、MySQL5.1系のソースからのコンパイル方法を書きます。

まずは、ncurses-devel をインスールです。

yum install ncurses-devel

MySQLはここからSource Codeを指定してダウンロードします。

今回は/usr/local/mysql にインストールします。

innodbを利用する場合は、オプションでinnobaseを指定します。

./configure --prefix=/usr/local/mysql --with-plugins=innobase
make
make install

インストール後データを初期化します。
/usr/local/mysql/bin/mysql_install_db


起動スクリプトは
/usr/local/mysql/share/mysql/mysql.server
となりますので、これをmysqlとして
/etc/rc.d/init.d/
にコピーします。

my.confのサンプルは
/usr/local/mysql/share/mysql/

my-small.cnf
my-medium.cnf
などがありますので、
サーバのスペックに合わせて利用可能となります。

後はいつものように
/etc/rc.d/init.d/mysql start
で起動します。



# by cimacoppi | 2012-01-05 22:22 | Linux

複数のユーザ秘密鍵をスクリプトで作成

ssh-keygenコマンドで秘密鍵の作成を行いますが、
複数のユーザの秘密鍵を作成する時、少し大変な場合があります。

そんな場合は、コマンドの組み合わせで実行すると、
簡単に作成できます。

まずは、スクリプトの作成です。
今回は test1 test2 test3 test4 test5ユーザの、
秘密鍵を作成します。

vi test.sh

su - test1 -c "ssh-keygen -N password;cat .ssh/id_rsa.pub >> .ssh/authorized_keys;chmod 600 .ssh/authorized_keys"
su - test2 -c "ssh-keygen -N password;cat .ssh/id_rsa.pub >> .ssh/authorized_keys;chmod 600 .ssh/authorized_keys"
su - test3 -c "ssh-keygen -N password;cat .ssh/id_rsa.pub >> .ssh/authorized_keys;chmod 600 .ssh/authorized_keys"
su - test4 -c "ssh-keygen -N password;cat .ssh/id_rsa.pub >> .ssh/authorized_keys;chmod 600 .ssh/authorized_keys"
su - test5 -c "ssh-keygen -N password;cat .ssh/id_rsa.pub >> .ssh/authorized_keys;chmod 600 .ssh/authorized_keys"

上記スクリプトを実行すると、
[root@cimacoppi 0104]# ./test.sh
Generating public/private rsa key pair.
Enter file in which to save the key (/home/test1/.ssh/id_rsa):
Created directory '/home/test1/.ssh'.
Your identification has been saved in /home/test1/.ssh/id_rsa.
Your public key has been saved in /home/test1/.ssh/id_rsa.pub.
The key fingerprint is:
6c:85:70:c8:7a:0e:a1:81:87:d1:c1:f5:57:47:b9:bf
Generating public/private rsa key pair.
Enter file in which to save the key (/home/test2/.ssh/id_rsa):
Created directory '/home/test2/.ssh'.
Your identification has been saved in /home/test2/.ssh/id_rsa.
Your public key has been saved in /home/test2/.ssh/id_rsa.pub.
The key fingerprint is:
41:80:f9:60:73:00:fb:a2:72:6a:9b:c8:b4:13:19:5e
Generating public/private rsa key pair.
Enter file in which to save the key (/home/test3/.ssh/id_rsa):
Created directory '/home/test3/.ssh'.
Your identification has been saved in /home/test3/.ssh/id_rsa.
Your public key has been saved in /home/test3/.ssh/id_rsa.pub.
The key fingerprint is:
e6:32:b4:8a:ae:fa:6f:ff:6c:5f:80:19:3e:7b:e0:b6
Generating public/private rsa key pair.
Enter file in which to save the key (/home/test4/.ssh/id_rsa):
Created directory '/home/test4/.ssh'.
Your identification has been saved in /home/test4/.ssh/id_rsa.
Your public key has been saved in /home/test4/.ssh/id_rsa.pub.
The key fingerprint is:
11:c6:10:df:f7:51:73:39:62:99:ec:af:25:25:ae:dd
Generating public/private rsa key pair.
Enter file in which to save the key (/home/test5/.ssh/id_rsa):
Created directory '/home/test5/.ssh'.
Your identification has been saved in /home/test5/.ssh/id_rsa.
Your public key has been saved in /home/test5/.ssh/id_rsa.pub.
The key fingerprint is:
2f:1e:79:88:c8:cf:f6:75:c7:c0:98:ce:96:5f:4c:c1

となります。
Enter file in which to save the key の後にEnterを押下します。

後は、id_rsaファイルをダウンロードとなります。

これでかなり時間短縮ができそうです。



# by cimacoppi | 2012-01-04 17:45

sudoで一般ユーザでapacheを起動する

通常一般ユーザでは、apacheの起動を、
することができません。

一般ユーザでapacheの起動などをしたい場合は、
sudoを利用します。

今回はsampleグループに属している、
ユーザにapache起動権限を付与します。

sudoのエディタとしてvisudoがありますのでこれを利用します。

visudoコマンドを実行して、
最終行に下記を追加します。

%sample ALL=NOPASSWD: /sbin/service httpd start

保存後実際に実行してみます。

[root@cimacoppi ~]# su - sample
[sample@cimacoppi ~]$ sudo /sbin/service httpd start
httpd を起動中:

[sample@cimacoppi ~]$ ps -efw | grep httpd
root 15419 1 0 15:03 ? 00:00:03 /usr/sbin/httpd
apache 15422 15419 0 15:03 ? 00:00:00 /usr/sbin/httpd
apache 15423 15419 0 15:03 ? 00:00:00 /usr/sbin/httpd
apache 15424 15419 0 15:03 ? 00:00:00 /usr/sbin/httpd
apache 15425 15419 0 15:03 ? 00:00:00 /usr/sbin/httpd
apache 15426 15419 0 15:03 ? 00:00:00 /usr/sbin/httpd
apache 15427 15419 0 15:03 ? 00:00:00 /usr/sbin/httpd
apache 15428 15419 0 15:03 ? 00:00:00 /usr/sbin/httpd
apache 15429 15419 0 15:03 ? 00:00:00 /usr/sbin/httpd
sample 25578 24862 0 15:10 pts/0 00:00:00 grep httpd

apacheが起動していることがわかります。

root権限を渡せない環境の場合は、非常に便利なコマンドです。



# by cimacoppi | 2012-01-04 15:12 | Linux

nagiosで時間を指定して監視をする

監視をしているサーバで、メンテナンスなどで、
特定の時間帯だけアラートメールを受信したくない場合があります。
そんな場合nagiosでは、アラートを通知する時間帯を、
設定することが可能です。

設定ファイルは、
timeperiods.cfg
になります。
例えば、毎日1:00~23:00で、アラート通知を受信したい場合は、

define timeperiod{
timeperiod_name test_hour
alias  test HOUR
use  test_hour
sunday 01:00-23:00
monday 01:00-23:00
tuesday 01:00-23:00
wednesday 01:00-23:00
thursday 01:00-23:00
friday  01:00-23:00
saturday 01:00-23:00
}

となります。

そして上記の設定を
define serviceに記述します。

記述方法は
notification_period test_hour

となります。



# by cimacoppi | 2011-12-22 01:51 | Linux

クラウド・ノイズ
by cimacoppi

検索

最新の記事

mod_line_editを..
at 2012-12-14 22:25
nagiosでOracleの..
at 2012-12-13 12:25
s3cmdでmultipar..
at 2012-12-06 15:59
tcpservr をssl化する
at 2012-03-10 21:50
telnetコマンドでpop..
at 2012-03-06 15:59

最新のトラックバック

ファン

ブログジャンル

画像一覧