2014年2月28日金曜日

CentOS 6.5 に yum で webminをインストール

yum で webminをインストールしてみます。
こちら(Using the Webmin YUM repository)に詳しく書いてあります。




[user@localhost ~]$ vim /etc/yum.repos.d/webmin.repo
[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1

gpg-keyの取得とinstall
[user@localhost ~]$ wget http://www.webmin.com/jcameron-key.asc
[user@localhost ~]$ rpm --import jcameron-key.asc
webminのinstall
[user@localhost ~]$ yum install webmin
webminはデフォルトで10000番ポートを利用します。 ポートを閉じている場合はiptables等で10000番を開放してください。

2014年2月25日火曜日

CentOS 6.5 に yum で最新のPHP をinstall する。

既存のリポジトリだとPHPは5.3.3-27となっています。
ここでは5.5をinstallしてみたいと思います。

リポジトリを追加


EPELのrepositoryを追加
[user@localhost ~]$ rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm を取得中
警告: /var/tmp/rpm-tmp.SSssDq: ヘッダ V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
準備中...                ########################################### [100%]
   1:epel-release           ########################################### [100%]
remiのrepositoryを追加
[user@localhost ~]$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
http://rpms.famillecollet.com/enterprise/remi-release-6.rpm を取得中
警告: /var/tmp/rpm-tmp.u3YZaw: ヘッダ V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
準備中...                ########################################### [100%]
   1:remi-release           ########################################### [100%]
php 5.5はremi-php55というrepoです。
[user@localhost ~]$ yum install --enablerepo=remi-php55 php php-devel php-mbstring php-mcrypt php-mysql php-phpunit-PHPUnit php-pecl-xdebug
以下のようにphp 5.5.9がインストールされました。
[user@localhost ~]$ php -v
PHP 5.5.9 (cli) (built: Feb 18 2014 14:51:38) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

vagrant で box 追加後SSH接続する

boxは以下にまとめられています。
http://www.vagrantbox.es/

今回はCentOSを例に導入してみます。



boxを導入

[user@localhost ~]$ vagrant box add CentOS01 https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box
Downloading box from URL: https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box
Extracting box...te: 981k/s, Estimated time remaining: --:--:--)
Successfully added box 'CentOS01' with provider 'virtualbox'!
[user@localhost ~]$ vagrant init CentOS01                                                                                                                                                                         
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
[user@localhost ~]$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'CentOS01'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] Mounting shared folders...
[default] -- /vagrant
ここで追加したboxに対しSSHを行おうとすると、怒られる。
[user@localhost ~]$ vagrant ssh                                                                                                                                                                                   
`ssh` binary could not be found. Is an SSH client installed?
んー。
[user@localhost ~]$ ss
ss          ssh-keygen  sshd        ssltap
sshコマンドがない。ので導入します。ssh コマンドはopenssh-clientsで導入出来ます。
[user@localhost ~]$ yum install openssh-clients
これでSSH接続出来るようになりました。
[user@localhost ~]$ 
vagrant ssh
[vagrant@vagrant-centos65 ~]$ pwd
/home/vagrant

CentOS 6.5 に yum の localinstall で vagrant を導入

rpm -Uvh もいいですが、今回は yum の localinstall を試してみます。

vagrantを取得

最新のvagrantは以下を参照 http://www.vagrantup.com/downloads
[user@localhost ~]$ wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.4.3_i686.rpm

yum で localinstall

[user@localhost ~]$ yum localinstall vagrant_1.4.3_i686.rpm                                                                                                                                                       
Loaded plugins: downloadonly, fastestmirror
Setting up Local Package Process
Examining vagrant_1.4.3_i686.rpm: 1:vagrant-1.4.3-1.i686
Marking vagrant_1.4.3_i686.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
Resolving Dependencies
--> Running transaction check
---> Package vagrant.i686 1:1.4.3-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
 Package                                        Arch                                        Version                                             Repository                                                  Size
=================================================================================================================================================================================================================
Installing:
 vagrant                                        i686                                        1:1.4.3-1                                           /vagrant_1.4.3_i686                                         48 M

Transaction Summary
=================================================================================================================================================================================================================
Install       1 Package(s)

Total size: 48 M
Installed size: 48 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 1:vagrant-1.4.3-1.i686                                                                                                                                                                        1/1 
  Verifying  : 1:vagrant-1.4.3-1.i686                                                                                                                                                                        1/1 

Installed:
  vagrant.i686 1:1.4.3-1                                                                                                                                                                                         

Complete!

2014年2月24日月曜日

CentOS 6.5 にVirtualboxをインストール

Xenや、VMWareではなくて今回はVirtualBoxをCentOSにインストールしてみます。 

yumリポジトリにVirtualBoxリポジトリを追加

[user@localhost ~]$ sudo vi /etc/yum.repos.d/virtualbox.repo

[virtualbox]
name=RHEL/CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/rhel/$releasever/$basearch
enabled=0
gpgcheck=1
gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc

キーを取得

[user@localhost ~]$ wget http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
[user@localhost ~]$ sudo rpm --import oracle_vbox.asc
[user@localhost ~]$ rm -r oracle_vbox.asc

インストール

[user@localhost ~]$ yum --enablerepo=virtualbox install VirtualBox
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
virtualbox                                                                                                                        |  951 B     00:00     
virtualbox/primary                                                                                                                | 5.7 kB     00:00     
virtualbox                                                                                                                                         22/22
Setting up Install Process
No package VirtualBox available.
Error: Nothing to do

見つからない・・・。ので検索してみる。


[user@localhost ~]$ yum --enablerepo=virtualbox search VirtualBox

Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
================================================================ N/S Matched: VirtualBox ================================================================
VirtualBox-3.2.i686 : Oracle VM VirtualBox
VirtualBox-4.0.i686 : Oracle VM VirtualBox
VirtualBox-4.1.i686 : Oracle VM VirtualBox
VirtualBox-4.2.i686 : Oracle VM VirtualBox
VirtualBox-4.3.i686 : Oracle VM VirtualBox

  Name and summary matches only, use "search all" for everything.

最新版を指定してインストール


[user@localhost ~]$ yum --enablerepo=virtualbox install VirtualBox-4.3.i686                                                                                 
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
Setting up Install Process

~依存関係は省略~

================================================================================
 Package              Arch       Version                 Repository        Size
================================================================================
Reinstalling:
 VirtualBox-4.3       i686       4.3.6_91406_el6-1       virtualbox        72 M

Transaction Summary
================================================================================
Reinstall     1 Package(s)

Total download size: 72 M
Installed size: 146 M
Is this ok [y/N]: y
Downloading Packages:
VirtualBox-4.3-4.3.6_91406_el6-1.i686.rpm                |  72 MB     03:06     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : VirtualBox-4.3-4.3.6_91406_el6-1.i686                        1/1 

Creating group 'vboxusers'. VM users must be member of that group!

No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.

Stopping VirtualBox kernel modules [  OK  ]
Recompiling VirtualBox kernel modules [  OK  ]
Starting VirtualBox kernel modules [  OK  ]
  Verifying  : VirtualBox-4.3-4.3.6_91406_el6-1.i686                        1/1 

Installed:
  VirtualBox-4.3.i686 0:4.3.6_91406_el6-1                                       

Complete!

バージョンを確認


[user@localhost ~]$ vboxmanage -v
4.3.6r91406
ただ、vboxmanage -vで時に以下のようなメッセージが表示される
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (2.6.32-431.el6.i686) or it failed to
         load. Please recompile the kernel module and install it by

           sudo /etc/init.d/vboxdrv setup

         You will not be able to start VMs until this problem is fixed.
こんな時は恐らく、gcc、kernel-develいずれか(もしくはどちらも)がインストールされていない事が原因でrecompileが出来ない状態です。 以下のようにgcc、kernel-develをインストール後、再起動してから、VirtualBoxをreinstallしてみてください。

[user@localhost ~]$ yum install kernel-devel gcc

~可能なら再起動~

[user@localhost ~]$ yum reinstall VirtualBox-4.3