昔から su コマンドを何気に使用しているのだが、理解が曖昧だったので覚え書き。
例えば oracleユーザで試してみる。
su oracle echo $ORACLE_BASE ← 環境変数が設定されていないので何も表示されない
ハイフン(-) または(-l)付きの場合は、ログインするユーザのログインシェルを読み込む。
su - oracle echo $ORACLE_BASE /u01/app/oracle
改めて納得。
昔から su コマンドを何気に使用しているのだが、理解が曖昧だったので覚え書き。
例えば oracleユーザで試してみる。
su oracle echo $ORACLE_BASE ← 環境変数が設定されていないので何も表示されない
ハイフン(-) または(-l)付きの場合は、ログインするユーザのログインシェルを読み込む。
su - oracle echo $ORACLE_BASE /u01/app/oracle
改めて納得。
Redmineをアップグレードしてみたが、画面上では下記メール送信のエラー。
hostname was not match with the server certificate
ポイントは、enable_starttls_auto: false を付け足すこと。
まあ、それぞれの環境のsmtpサーバの設定によるのだけどね。
production: email_delivery: delivery_method: :smtp smtp_settings: address: "smtp.whoocus" port: 25 authentication: :none enable_starttls_auto: false domain: 'whoocus.com'
Mac において、WinSCPのようなツールが見当たらないので、コマンドラインにてリモートホストへファイル転送する。
scp ファイル名 ユーザ名@リモートホスト名:転送先ディレクトリ名 password : xxxxxx
サーバからファイルを取得することも可能。
scp ユーザ名@リモートホスト名:転送元ディレクトリ名/ファイル名 . password : xxxxxx
ruby1.9.3のインストールには、下記ライブラリが必要らしいので、yumでインストール。
無くてもインストールできるのだが、gem等のコマンドを使用する場合に必須。
libyaml-devel
zlib-devel
httpd-devel
openssl-devel
curl-devel
yum install libyaml-devel yum install zlib-devel yum install httpd-devel yum install openssl-devel yum install curl-devel
Ruby1.9.3の最新版をダウンロード。
wget http://core.ring.gr.jp/archives/lang/ruby/ruby-1.9.3-p286.tar.gz
インストールディレクトリを指定したいので、–prefixオプションでインストール先を指定する。しないとデフォルトは、確か/usr/bin/だったはず…。
tar xvzf ruby-1.9.3-p286.tar.gz cd ruby-1.9.3-p286 ./configure --prefix /usr/local/ruby193 make make install
インストール完了したら、動作を確認してみる。
ruby -v ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
成功。
久しぶりにサーバ構築することとなり、CentOS5.8にMySQL5.5をインストールしようとする。
以前の記事から、既に1年以上が経って、もはやその通りに動作していないことに気付く。
再度覚え書きとする。
■yum レポジトリの追加
wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-10.ius.el5.noarch.rpm wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-5-4.noarch.rpm rpm -Uvh epel-release-5-4.noarch.rpm 警告: epel-release-5-4.noarch.rpm: ヘッダ V4 DSA signature: NOKEY, key ID 9cd4953f 準備中... ########################################### [100%] 1:epel-release ########################################### [100%] rpm -Uvh ius-release-1.0-10.ius.el5.noarch.rpm 警告: ius-release-1.0-10.ius.el5.noarch.rpm: ヘッダ V4 DSA signature: NOKEY, key ID 9cd4953f 準備中... ########################################### [100%] 1:ius-release ########################################### [100%]
■ius,epelからのインストール。
yum --enablerepo=ius,epel install mysql Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.oss.eznetsols.org * epel: ftp.iij.ad.jp * extras: ftp.oss.eznetsols.org * ius: archive.linux.duke.edu * updates: ftp.oss.eznetsols.org epel | 3.7 kB 00:00 epel/primary_db | 3.8 MB 00:00 ius | 2.2 kB 00:00 ius/primary_db | 166 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql.i386 0:5.0.95-1.el5_7.1 set to be updated ---> Package mysql.x86_64 0:5.0.95-1.el5_7.1 set to be updated --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================== Package Arch Version Repository Size ===================================================================================================== Installing: mysql i386 5.0.95-1.el5_7.1 updates 4.9 M mysql x86_64 5.0.95-1.el5_7.1 updates 4.9 M Transaction Summary ===================================================================================================== Install 2 Package(s) Upgrade 0 Package(s) Total download size: 9.8 M
残念ながら、5.0のままなので、No!!
Is this ok [y/N]: N Exiting on user Command Complete!
■再度バージョン指定して実行。
yum --enablerepo=ius,epel install mysql55 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.oss.eznetsols.org * epel: ftp.iij.ad.jp * extras: ftp.oss.eznetsols.org * ius: archive.linux.duke.edu * updates: ftp.oss.eznetsols.org Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql55.x86_64 0:5.5.28-2.ius.el5 set to be updated --> Processing Dependency: mysql55-libs = 5.5.28-2.ius.el5 for package: mysql55 --> Processing Dependency: mysqlclient15 for package: mysql55 --> Running transaction check ---> Package mysql55-libs.x86_64 0:5.5.28-2.ius.el5 set to be updated ---> Package mysqlclient15.x86_64 0:5.0.92-3.ius.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================== Package Arch Version Repository Size ===================================================================================================== Installing: mysql55 x86_64 5.5.28-2.ius.el5 ius 11 M Installing for dependencies: mysql55-libs x86_64 5.5.28-2.ius.el5 ius 1.1 M mysqlclient15 x86_64 5.0.92-3.ius.el5 ius 1.7 M Transaction Summary ===================================================================================================== Install 3 Package(s) Upgrade 0 Package(s) Total download size: 14 M Is this ok [y/N]: y Downloading Packages: (1/3): mysql55-libs-5.5.28-2.ius.el5.x86_64.rpm | 1.1 MB 00:01 (2/3): mysqlclient15-5.0.92-3.ius.el5.x86_64.rpm | 1.7 MB 00:00 (3/3): mysql55-5.5.28-2.ius.el5.x86_64.rpm | 11 MB 00:02 ----------------------------------------------------------------------------------------------------- Total 2.4 MB/s | 14 MB 00:05 警告: rpmts_HdrFromFdno: ヘッダ V4 DSA signature: NOKEY, key ID 9cd4953f ius/gpgkey | 1.3 kB 00:00 Importing GPG key 0x9CD4953F "IUS Community Project <coredev@iuscommunity.org>" from /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : mysqlclient15 1/3 Installing : mysql55-libs 2/3 Installing : mysql55 3/3 Installed: mysql55.x86_64 0:5.5.28-2.ius.el5 Dependency Installed: mysql55-libs.x86_64 0:5.5.28-2.ius.el5 mysqlclient15.x86_64 0:5.0.92-3.ius.el5 Complete!
mysql-server55 が足りなかったようだ。
yum --enablerepo=ius,epel install mysql55-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.oss.eznetsols.org * epel: ftp.iij.ad.jp * extras: ftp.oss.eznetsols.org * ius: archive.linux.duke.edu * updates: ftp.oss.eznetsols.org Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql55-server.x86_64 0:5.5.28-2.ius.el5 set to be updated --> Processing Dependency: perl-DBD-MySQL for package: mysql55-server --> Running transaction check ---> Package perl-DBD-MySQL.x86_64 0:3.0007-2.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================== Package Arch Version Repository Size ===================================================================================================== Installing: mysql55-server x86_64 5.5.28-2.ius.el5 ius 12 M Installing for dependencies: perl-DBD-MySQL x86_64 3.0007-2.el5 base 148 k Transaction Summary ===================================================================================================== Install 2 Package(s) Upgrade 0 Package(s) Total download size: 12 M Is this ok [y/N]: y Downloading Packages: (1/2): perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm | 148 kB 00:00 (2/2): mysql55-server-5.5.28-2.ius.el5.x86_64.rpm | 12 MB 00:03 ----------------------------------------------------------------------------------------------------- Total 2.9 MB/s | 12 MB 00:04 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : perl-DBD-MySQL 1/2 Installing : mysql55-server 2/2 Installed: mysql55-server.x86_64 0:5.5.28-2.ius.el5 Dependency Installed: perl-DBD-MySQL.x86_64 0:3.0007-2.el5 Complete!
上手くいったようだ。結果として /usr/bin/以下にインストールされているようだ。
■MySQL Serverの起動
# /etc/rc.d/init.d/mysqld start MySQL データベースを初期化中: Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h 127.0.0.1 password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script! [ OK ] mysqld を起動中: [ OK ]
■MySQL Serverの自動起動設定
chkconfig mysqld on chkconfig --list mysqld mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
結論から言うと、プロキシのせいでインストールがこける。
直接ダウンロードして、下記のようにインストールしようと思ってもダメ。
$ sudo gem install /usr/local/src/rails-3.2.8.gem ERROR: http://rubygems.org/ does not appear to be a repository ERROR: Error installing /usr/local/src/rails-3.2.8.gem: rails requires activesupport (= 3.2.8, runtime)
環境変数にプロキシの場所をしていしてもダメ。
$ export http_proxy=http://proxy:8888/
ダメな理由はわからないのだが、どうやら gemコマンド自身にも、プロキシ設定するオプションがあるようだ。
$ sudo gem install --remote rails -p http://proxy:8888/
Ruby の gem にせよ、Java の Maven にせよ、git にせよ。
インストールや依存関係の管理は便利なのだが、サーバ環境による設定は難しい。というより、知らないと時間をようしてしまう。この辺は、カンを働かせていかないとなぁ。
何度もやっているのだが、たまにしか行わないために覚え書き。
まずは、httpd設定ファイルへの設定。
http://xxx.xxx.xxx/hoge へアクセスする場合の設定となる。
$ mv /etc/httpd/conf.d/ $ vi hoge.conf <Location /hoge> AuthType Basic AuthName "Whoocus" AuthUserFile /etc/httpd/auth_file/.hoge_passwd_file # パスワードファイルの場所 Require valid-user </Location>
そして、パスワードファイルの作成
新規にパスワードファイルを作成する場合は -c オプションを付加する。
$ htpasswd -c /etc/httpd/auth_file/.hoge_passwd_file whoocus New password: ***** Re-type new password: *****
Webサーバの再起動。
$ /etc/rc.d/init.d/httpd restart
これでBasic認証の設定完了。
RedmineがRuby1.9では動作しなかったので、放っておいて早1年。やはり、Redmineは必要なので、Redmine2.0バージョンをインストールしてみることとした。
いろいろエラーに悩まされ、表題のエラー。
adapter を単純にmysql ⇒ mysql2 と書き直せばよい。
Gemfileの修正(ほぼコメントアウト)と、database.yml の修正で何とかなった。
zabbixをインストール中に、下記のエラーに出くわした。
php53-common-5.3.3-7.el5_8.x86_64 from installed has depsolving problems --> php53-common conflicts with php-common Error: php53-common conflicts with php-common You could try using --skip-broken to work around the problem You could try running: package-cleanup --problems package-cleanup --dupes rpm -Va --nofiles --nodigest
この場合、下記等 を試したが、どうしてもダメ。
yum clean all
アンインストールしようとしたが、そんなもの無いと叱られる。
yum erase php-common Package(s) php-common available, but not installed.
どうやら、昔、手動でphpがインストールされていたので、競合していたようだ。
仕方ないので、古いphpを手動でアンインストールした。
その後、再度 yum にて php をインストールしなおした。
何とかなった。
新規ユーザの.bashrc や .bash_profile 共通記述ファイル。
全ユーザへ共通パスを通す場合に便利。
vi /etc/skel/.bashrc vi /etc/skel/.bash_profile