<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Magic Web &#187; 構築（テスト環境）</title>
	<atom:link href="http://www.a-magic-web.com/server_linux/build/feed" rel="self" type="application/rss+xml" />
	<link>http://www.a-magic-web.com</link>
	<description></description>
	<lastBuildDate>Sat, 07 Aug 2010 05:57:45 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Apache,PHP,MySQLテストサーバー構築手順(beta)</title>
		<link>http://www.a-magic-web.com/server_linux/build/apachephpmysql_build_beta.html</link>
		<comments>http://www.a-magic-web.com/server_linux/build/apachephpmysql_build_beta.html#comments</comments>
		<pubDate>Sat, 27 Feb 2010 17:18:16 +0000</pubDate>
		<dc:creator>vohedge</dc:creator>
				<category><![CDATA[構築（テスト環境）]]></category>

		<guid isPermaLink="false">http://www.a-magic-web.com/?p=654</guid>
		<description><![CDATA[テストサーバーを作り直したので、メモを残します。テストサーバーは Vmware Server 上に仮想サーバーとして作成しました。物理環境でも手順は変わらないはず。手早く構築するために手順は最低限にしています。 テスト環境構築フロー - Vmware イメージ作成 - CentOS5.4 インストール - ネットワーク設定 - セキュリティ関係停止 - ユーザー作成 - FTP インストール - Apache インストール - Bind インストール - PHPインストール - MySQL インストール - Virtual ホスト設定 - phpMyadmin インストール Vmware ゲストOS作成 使用している Vmware Server は 1.x 系。2.x 系が使いづらかったのと、職場の環境が VMware Workstion とほぼ同じインターフェースなので。普通にゲスト OSを作成。 - Guset oprating system : [...]]]></description>
			<content:encoded><![CDATA[<p>テストサーバーを作り直したので、メモを残します。テストサーバーは Vmware Server 上に仮想サーバーとして作成しました。物理環境でも手順は変わらないはず。手早く構築するために手順は最低限にしています。</p>
<h3>テスト環境構築フロー</h3>
<blockquote><p>- Vmware イメージ作成<br />
- CentOS5.4 インストール<br />
- ネットワーク設定<br />
- セキュリティ関係停止<br />
- ユーザー作成<br />
- FTP インストール<br />
- Apache インストール<br />
- Bind インストール<br />
- PHPインストール<br />
- MySQL インストール<br />
- Virtual ホスト設定<br />
- phpMyadmin インストール</p></blockquote>
<h3>Vmware ゲストOS作成</h3>
<p>使用している Vmware Server は 1.x 系。2.x 系が使いづらかったのと、職場の環境が VMware Workstion とほぼ同じインターフェースなので。普通にゲスト OSを作成。</p>
<blockquote><p>- Guset oprating system : Linux で<br />
- Version : Red Hat Enterprise Linux 4<br />
- ネットワークは bridge でも NAT でも用途に合わせて<br />
- サイズは適当に10から20GB程度</p></blockquote>
<p>スナップショットを利用すると、後から仮想ディスクの容量を増やすことができなくなるため、多めに。</p>
<blockquote><p>- Allocate all disk now :</p></blockquote>
<p>ここにチェックを入れてしまうと、作成に時間がかかるのと、指定したサイズ分物理ディスクを使ってしまう。上で指定した10-20GB使われると困るので、オフにする。</p>
<h3>CentOS インストール</h3>
<p>GUI インストールで全てデフォルト。ネットワークも後で設定するのでそのまま。</p>
<h3>ネットワーク設定</h3>
<p>IP を変えると SSH などの接続も切れてしまうので、VMware のコンソールで直接操作。VMware のネットワーク設定を NAT にしている場合は、[Host] → [Virtual Network Settings] → [NAT] タブから、所属しているネットワーク、ゲートウェイ、サブネットマスクを確認。</p>
<div class="command">
<pre>[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.16.10
NETMASK=255.255.255.0
GATEWAY=192.168.16.2</pre>
</div>
<p>適用させるために、サービス再起動。</p>
<p>[root@localhost ~]# service network restart</p>
<h3>セキュリティ関係停止</h3>
<p>開発の時に邪魔になるセキュリティ関連の機能を停止します。</p>
<h4>iptables の停止</h4>
<div class="command">
<pre>[root@localhost ~]# service iptables status</pre>
</div>
<p>ステータスを確認して、なんかいっぱい出てきたら動いてる。動いてたら停止。</p>
<div class="command">
<pre>[root@localhost ~]# service iptables stop
ファイアウォールルールを適用中:                            [  OK  ]
チェインポリシーを ACCEPT に設定中filter                   [  OK  ]
iptables モジュールを取り外し中
[root@localhost ~]# chkconfig iptables off
[root@localhost ~]# chkconfig --list iptables
iptables        0:off   1:off   2:off   3:off   4:off   5:off   6:off</pre>
</div>
<h4>SElinux の停止</h4>
<p>getenforce が SELinux の状態確認で、Permisive が停止状態。自動起動の停止は sysconfig の selinux を編集する。</p>
<div class="command">
<pre>[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]# vi /etc/sysconfig/selinux
SELINUX=disabled</pre>
</div>
<h4>yum-updatesd の削除</h4>
<p><a href="http://centossrv.com/centos5-init.shtml">centossrv.com</a> によると、「デフォルトで1時間ごとにアップデートチェックを行うようになっており、手動によるパッケージインストールと競合するとインストールが失敗する」 とのことなので、早々に削除。</p>
<div class="command">
<pre>[root@localhost ~]# /etc/rc.d/init.d/yum-updatesd stop
yum-updates 停止中:                                      [  OK  ]
[root@localhost ~]# yum -y remove yum-updatesd</pre>
</div>
<h3>ユーザー作成</h3>
<p>作業用に root 以外のユーザーを作成。ユーザーの作成には、useradd コマンドを使用。passwd コマンドでパスワードを加えることで初めて使用できるようになる。</p>
<div class="command">
<pre>[root@centos ~]# useradd centos
[root@centos ~]# passwd centosChanging password for user centos.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.</pre>
</div>
<h3>FTP &#8211; vsftpd</h3>
<div class="command">
<pre>[root@centos ~]# yum -y install vsftpd</pre>
</div>
<p>設定は、アスキーモードでの転送と、ディレクトリの削除を可能にするだけ。</p>
<div class="command">
<pre>[root@centos ~]# vi /etc/vsftpd/vsftpd.conf
ascii_upload_enable=YES
ascii_download_enable=YES
ls_recurse_enable=YES</pre>
</div>
<p>起動、自動起動の設定。終わったら、FTPクライアントから接続してみる。</p>
<div class="command">
<pre>[root@centos ~]# /etc/rc.d/init.d/vsftpd start
[root@centos ~]# chkconfig vsftpd on
[root@localhost ~]# chkconfig --list vsftpd
vsftpd          0:off   1:off   2:off   3:off   4:off   5:off   6:off</pre>
</div>
<h3>Apache</h3>
<div class="command">
<pre>[root@centos ~]# yum -y install httpd</pre>
</div>
<p>設定は、CGI、SSI、.htaccess の許可のみ。Virtual host の設定は後から。</p>
<div class="command">
<pre>[root@centos ~]# vi /etc/httpd/conf/httpd.conf
&lt;Directory "/var/www/html"&gt;
Options Includes ExecCGI FollowSymLinks
AllowOverride All</pre>
</div>
<p>テストページの削除。</p>
<div class="command">
<pre>[root@centos ~]# rm -f /etc/httpd/conf.d/welcome.conf
[root@centos ~]# rm -f /var/www/error/noindex.html</pre>
</div>
<p>ドキュメントルートの所有者を作業用ユーザーに変更。</p>
<div class="command">
<pre>[root@localhost ~]# chown centos:centos /var/www/html</pre>
</div>
<p>起動、自動起動の設定。</p>
<div class="command">
<pre>[root@localhost ~]# service httpd start
httpd を起動中:                                            [  OK  ]
[root@centos ~]# chkconfig httpd on
[root@localhost ~]# chkconfig --list httpd
httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off</pre>
</div>
<p>テストしてみる。以下を実行して、ブラウザからサーバーのIPにアクセス。</p>
<div class="command">
<pre>[root@centos ~]# echo test &gt;&gt; /var/www/html/index.html</pre>
</div>
<h3>BIND</h3>
<p><a href="http://www.a-magic-web.com/server_linux/bind/bind-install.html">BIND インストールと設定</a></p>
<h3>PHPとMySQLとphpMyadminのインストール</h3>
<p><a href="http://www.a-magic-web.com/server_linux/mysql/mysql5-1_php5-3.html">CentOS5.4 に MySQL5.1,PHP5.3とphpMyAdmin</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.a-magic-web.com/server_linux/build/apachephpmysql_build_beta.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>開発環境スピード構築（自分手順 alpha 版）</title>
		<link>http://www.a-magic-web.com/server_linux/build/test_env_alpha01.html</link>
		<comments>http://www.a-magic-web.com/server_linux/build/test_env_alpha01.html#comments</comments>
		<pubDate>Wed, 13 May 2009 10:30:22 +0000</pubDate>
		<dc:creator>vohedge</dc:creator>
				<category><![CDATA[構築（テスト環境）]]></category>

		<guid isPermaLink="false">http://www.a-magic-web.com/server_linux/build/test_env_alpha01/</guid>
		<description><![CDATA[PHP で何か作る時に、ささっと開発・テスト環境を作る方法を模索しています。VMwareとCentOSでウェブ開発の環境をさっさと整える手順書(前編)を非常に参考にさせていただいています。自分用に少しカスタマイズしています。 使うのは、VMware server 1.x と CentOS (今のとこ 5.3) で、Apatch、PHP、PostgreSQL が動く環境を構築します。 CentOS のインストール VMware server はすでにインストールされているとして、VMware のゲスト OS として CentOS をインストールします。ポイントは以下の通り。 パーティションは切らず、デフォルトのレイアウトで IP はインストール後に設定するので、DHCP のまま 気分的に IPv6 は無効に 「システムクロックで UTC を使用」のチェックはオフにする 構成は （開発 &#8211; 開発ツール、ベースシステム &#8211; ベース、言語 &#8211; 日本語のサポート）のみで最小に インストールが完了して再起動したら、VMware のロゴが出たタイミングで CentOS の電源を落として、イメージをコピーしておく。なんかあってもすぐにここから始められる。 CentOS 初期設定 ネットワーク設定 IP を変えると SSH などの接続も切れてしまうので、VMware のコンソールで直接操作したほうが早い。 VMware の [Host] → [...]]]></description>
			<content:encoded><![CDATA[<p>PHP で何か作る時に、ささっと開発・テスト環境を作る方法を模索しています。<a href="http://labs.unoh.net/2006/11/vmwarecentos.html">VMwareとCentOSでウェブ開発の環境をさっさと整える手順書(前編)</a>を非常に参考にさせていただいています。自分用に少しカスタマイズしています。</p>
<p>使うのは、VMware server 1.x と CentOS (今のとこ 5.3) で、Apatch、PHP、PostgreSQL が動く環境を構築します。</p>
<h2>CentOS のインストール</h2>
<p>VMware server はすでにインストールされているとして、VMware のゲスト OS として CentOS をインストールします。ポイントは以下の通り。</p>
<ul>
<li>パーティションは切らず、デフォルトのレイアウトで </li>
<li>IP はインストール後に設定するので、DHCP のまま      <br />気分的に IPv6 は無効に </li>
<li>「システムクロックで UTC を使用」のチェックはオフにする </li>
<li>構成は （開発 &#8211; 開発ツール、ベースシステム &#8211; ベース、言語 &#8211; 日本語のサポート）のみで最小に </li>
</ul>
<p>インストールが完了して再起動したら、VMware のロゴが出たタイミングで CentOS の電源を落として、イメージをコピーしておく。なんかあってもすぐにここから始められる。</p>
<h2>CentOS 初期設定</h2>
<h3>ネットワーク設定</h3>
<p>IP を変えると SSH などの接続も切れてしまうので、VMware のコンソールで直接操作したほうが早い。</p>
<p>VMware の [Host] → [Virtual Network Settings] → [NAT] タブから、所属しているネットワーク、ゲートウェイ、サブネットマスクを確認して ifcfg-eth0 に入力する。</p>
<div class="command">
<pre>[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.16.10
NETMASK=255.255.255.0
GATEWAY=192.168.16.2
# HWADDR=00:0c:29:01:e3:47</pre>
</div>
<p>設定の変更を反映させるため、netwark サービスを再起動します。 </p>
<div class="command">
<pre>/etc/init.d/network restart</pre>
</div>
<h3>yum-updatesd の削除</h3>
<p><a href="http://centossrv.com/centos5-init.shtml">centossrv.com</a> によると、「デフォルトで1時間ごとにアップデートチェックを行うようになっており、手動によるパッケージインストールと競合するとインストールが失敗する」 とのことなので、早々に削除。</p>
<div class="command">
<pre>[root@localhost ~]# /etc/rc.d/init.d/yum-updatesd stop
yum-updates 停止中:                                      [  OK  ]
[root@localhost ~]# yum -y remove yum-updatesd</pre>
</div>
<h3>iptables の停止</h3>
<p>セキュリティ関係のサービスも動いていると、切り分けに時間がかかるので、今回環境では停止。公開するサーバーでは全然ないし。必要であればあとから設定することに。</p>
<p>まずiptables のステータス確認</p>
<div class="command">
<pre>[root@localhost ~]# service iptables status</pre>
</div>
<p>なんかいっぱい出てきたら動いてる。動いてたら停止。</p>
<div class="command">
<pre>[root@localhost ~]# service iptables stop
ファイアウォールルールを適用中:                            [  OK  ]
チェインポリシーを ACCEPT に設定中filter                   [  OK  ]
iptables モジュールを取り外し中
[root@localhost ~]# chkconfig iptables off
[root@localhost ~]# chkconfig --list iptables
iptables        0:off   1:off   2:off   3:off   4:off   5:off   6:off
 </pre>
</div>
<h3>SElinux の停止</h3>
<p>getenforce が SELinux の状態確認 Permisive が停止状態。自動起動の停止は sysconfig の selinux を編集する。</p>
<div class="command">
<pre>[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]# vi /etc/sysconfig/selinux
SELINUX=<span style="color: red">disabled</span></pre>
</div>
<h2>Apatch のインストール</h2>
<div class="command">
<pre>[root@localhost ~]# yum -y install httpd</pre>
</div>
<p>※httpd.conf の設定項目は考え中</p>
<p>httpd サービスの開始と自動起動の設定</p>
<div class="command">
<pre>/etc/rc.d/init.d/httpd start
[root@centos ~]# chkconfig httpd on
[root@centos ~]# chkconfig --list httpd
httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off</pre>
</div>
<p>簡単な動作確認</p>
<div class="command">
<pre>[root@centos ~]# echo test &gt;&gt; /var/www/html/index.html </pre>
</div>
<h2>PHP のインストール</h2>
<div class="command">
<pre>[root@localhost ~]# yum -y install php php-{mbstring,pgsql}</pre>
</div>
<p>動作確認として、phpinfo() を出力してみる。</p>
<div class="command">
<pre>[root@centos ~]# vi /var/www/html/test.php
&lt;?php
  phpinfo();
?&gt;</pre>
</div>
<p>test.php にアクセスして、ページが表示されれば OK。また、phpinfo() の中に php-psgsql の項目があることを確認する。</p>
<p>必要に応じて、エラー表示を行うように、php.ini を設定</p>
<div class="command">
<pre>[root@centos ~]# vi /etc/php.ini
(省略)
display_errors = On</pre>
</div>
<p>&#160;</p>
<h2>PostgreSQL のインストール</h2>
<p>依存関係ではまるのを防ぎ、素早くインストールを行うため、yum を使ってインストールを行う。</p>
<h3>yum リポジトリの登録</h3>
<p>この操作は、標準のリポジトリからは取得できないバージョンの PostgreSQL をインストールする場合に行う。標準のリポジトリからインストールできる PostgreSQL のバージョンは yum install postgresql-server を実行すると確認できる（Is this ok [y/N]:N で中止）。</p>
<p><a href="http://yum.pgsqlrpms.org/reporpms/repoview/letter_p.group.html">Packages beginning with letter &quot;P&quot;.</a>から、インストールしたい PostgreSQL のバージョンの yum リポジトリを探し、wget で rpm をダウンロードする。ダウンロードした rpm はそのままインストール。インストールが正常にできると、/etc/yum.repos.d/ に、PostgreSQL の yum リポジトリの .repo ファイルができる。</p>
<div class="command">
<pre>[root@centos ~]# wget http://yum.pgsqlrpms.org/reporpms/8.3/pgdg-centos-8.3-6.noarch.rpm
[root@centos ~]# rpm -ivh pgdg-centos-8.3-6.noarch.rpm
[root@centos ~]# ls /etc/yum.repos.d/
CentOS-Base.repo  CentOS-Media.repo  <span style="color: red">pgdg-83-centos.repo</span></pre>
</div>
<h3>既存リポジトリとの競合を防止</h3>
<p>CentOS 標準の yum リポジトリを Postgre 関連の rpm を身に行かないように設定。赤字のとこを追記。</p>
<div class="command">
<pre>[root@centos ~]# vi /etc/yum.repos.d/CentOS-Base.repo
（省略）
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
<span style="color: red">exclude=postgresql*</span>

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
<span style="color: red">exclude=postgresql*</span></pre>
</div>
<h3>インストール実行</h3>
<p>あとは、yum で普通にインストール。途中でバージョンも表示される。</p>
<div class="command">
<pre>[root@centos ~]# yum install postgresql-server</pre>
</div>
<h3>初期設定</h3>
<p>データベース初期化</p>
<div class="command">
<pre>[root@centos ~]# service postgresql initdb</pre>
</div>
<p>サービスの開始と自動起動の登録</p>
<div class="command">
<pre>[root@centos ~]# service postgresql start
postgresql サービスを開始中:                               [  OK  ]
[root@centos ~]# chkconfig postgresql on
[root@centos ~]# chkconfig postgresql --list
postgresql      0:off   1:off   2:on    3:on    4:on    5:on    6:off</pre>
</div>
<p>システム側の postgres ユーザーにパスワードを設定</p>
<div class="command">
<pre>[root@centos ~]# passwd postgres</pre>
</div>
<p>PostgreSQL の postgres ユーザーにパスワードを設定</p>
<div class="command">
<pre>root@centos ~]# su - postgres
-bash-3.2$ psql template1
（省略）
template1=# alter role postgres with password 'パスワード';
ALTER ROLE</pre>
</div>
<p>テスト用のユーザー（システム側とpostgreSQL 側の両方で）を作成</p>
<div class="command">
<pre>[root@centos ~]# useradd centos
[root@centos ~]# passwd centos
（省略）
[root@centos ~]# su - postgres
-bash-3.2$ psql　postgres
postgres=# create role centos with login createdb　password 'パスワード';
CREATE ROLE</pre>
</div>
<p>テスト用データベースの作成</p>
<div class="command">
<pre>[root@centos ~]# su - centos
[centos@centos ~]$ psql postgres
postgres=&gt; CREATE DATABASE sampledb;
CREATE DATABASE</pre>
</div>
<p>テスト用データデータの作成</p>
<div class="command">
<pre>[centos@centos ~]$ psql sampledb
（省略）
sampledb=&gt; create table test(num int, name varchar(50));
CREATE TABLE
sampledb=&gt; \d test
            Table &quot;public.test&quot;
 Column |         Type          | Modifiers
--------+-----------------------+-----------
 num    | integer               |
 name   | character varying(50) |
sampledb=&gt; insert into test values(1,'サイヤ人');
INSERT 0 1
sampledb=&gt; insert into test values(2,'スーパーサイヤ人');
INSERT 0 1
sampledb=&gt; select * from test;
 num |       name
-----+------------------
   1 | サイヤ人
   2 | スーパーサイヤ人
(2 rows)</pre>
</div>
<h2>PostgreSQL と PHP 接続用の設定</h2>
<div class="command">
<pre>[root@centos ~]# vi /var/lib/pgsql/data/postgresql.conf
(かなり省略)
listen_addresses = '*'

[root@centos data]# vi /var/lib/pgsql/data/pg_hba.conf
(かなり省略)
host    all         all         192.168.0.*/32       md5</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.a-magic-web.com/server_linux/build/test_env_alpha01.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>自宅でVMware + CentOS &#8211; その6　CentOS 初期設定</title>
		<link>http://www.a-magic-web.com/server_linux/build/vmware-centos-6.html</link>
		<comments>http://www.a-magic-web.com/server_linux/build/vmware-centos-6.html#comments</comments>
		<pubDate>Sun, 19 Apr 2009 14:25:14 +0000</pubDate>
		<dc:creator>vohedge</dc:creator>
				<category><![CDATA[構築（テスト環境）]]></category>

		<guid isPermaLink="false">http://www.a-magic-web.com/?p=111</guid>
		<description><![CDATA[まだ続いております。 自宅でも気軽に WEB のテストができる環境がほしいと思い立ち、宅内にテスト環境として、専用の PC に VMware をいれ、その上に CentOS で WEB サーバーを建ててしまおう！というのが目標です。Linux 初心者の作業ログですのであしからず。 前回までに、CentOS のインストールが完了しています。今回は CentOS の初期設定を行います。 作業用ユーザーの作成 いつも root で作業していると、大事なシステムファイルを消してしまったりとか、危険がつきもの。そこで、通常では必要な時のみ root の権限を使い、それ以外はユーザー権限で作業を行うようです。 そこで、まず作業用のユーザーを作成します。今回はテスト用として &#8220;user&#8221; というアカウントを作成します。 [root@centos ~]# useradd user アカウントは作成した段階ではパスワードが設定されておらず、ログインすることができません。そこで passwd コマンドでパスワードを設定します。 [root@centos ~]# passwd user Changing password for user user. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully. [...]]]></description>
			<content:encoded><![CDATA[<p>まだ続いております。<br />
自宅でも気軽に WEB のテストができる環境がほしいと思い立ち、宅内にテスト環境として、専用の PC に VMware をいれ、その上に CentOS で WEB サーバーを建ててしまおう！というのが目標です。Linux 初心者の作業ログですのであしからず。<br />
前回までに、CentOS のインストールが完了しています。今回は CentOS の初期設定を行います。</p>
<h2>作業用ユーザーの作成</h2>
<p>いつも root で作業していると、大事なシステムファイルを消してしまったりとか、危険がつきもの。そこで、通常では必要な時のみ root の権限を使い、それ以外はユーザー権限で作業を行うようです。<br />
そこで、まず作業用のユーザーを作成します。今回はテスト用として &#8220;user&#8221; というアカウントを作成します。</p>
<div class="command">
<pre>
[root@centos ~]# useradd user
</pre>
</div>
<p>アカウントは作成した段階ではパスワードが設定されておらず、ログインすることができません。そこで passwd コマンドでパスワードを設定します。</p>
<div class="command">
<pre>
[root@centos ~]# passwd user
Changing password for user user.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@centos ~]#
</pre>
</div>
<p>&#8220;user&#8221; というアカウントがでているか確認のため、実際にログインしてみます。root に戻るときは exit コマンドで戻ることができます。</p>
<div class="command">
<pre>
[root@centos ~]# su - user
[user@centos ~]$
</pre>
</div>
<h2>root になれるアカウントを限定</h2>
<p>上で作成した &#8220;user&#8221; アカウントを root になれるアカウントに設定します。まず、&#8221;user&#8221; を　wheel グループにいれます。どこのサイトを見ても当たり前のように wheel に追加する手順がでてくるのですが、この wheel グループとは何なんでしょうか ? 調べてもあまり情報がでてこないのですが、当たり前すぎることなのでしょうか。。今後の宿題です。</p>
<p>この作業も root でサクッと。</p>
<div class="command">
<pre>
[root@centos ~]# usermod -G wheel user
</pre>
</div>
<p>次に、PAM の su の設定ファイルを変更します。PAM とは何か、また、Linux の各種設定ファイルを編集する &#8220;vi&#8221; エディタも予習済みなので、さらっと行きます。</p>
<p>PAM の su の設定ファイルの場所は、/etc/pam.d ディレクトリです。ここに、su をはじめ、PAM で認証を行うアプリケーションそれぞれの設定ファイルが、そのままのファイル名であります。今回はその中の su の # (赤いとこ) を削除</p>
<div class="command">
<pre>
[root@centos ~]# vi /etc/pam.d/su

#%PAM-1.0
auth            sufficient      pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth           sufficient      pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
<span style="color:red">#</span>auth            required        pam_wheel.so use_uid
auth            include         system-auth
account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
account         include         system-auth
password        include         system-auth
session         include         system-auth
session         optional        pam_xauth.so
~
~
~
"/etc/pam.d/su" 12L, 486C written
[root@centos ~]#
</pre>
</div>
<p>設定したアカウント &#8220;user&#8221; 以外のアカウントで su &#8211; が実行できないことを確認します。そのためにアカウントを作るのもどうかと思いますが、今回は &#8220;user02&#8243; をデフォルト設定で作成し、</p>
<div class="command">
<pre>
[root@centos ~]# useradd user02
[root@centos ~]# passwd user02
Changing password for user user02.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@centos ~]#
</pre>
</div>
<p>それぞれのアカウントでログインしなおして、su &#8211; できるか確認確認。</p>
<div class="command">
<pre>
[user@centos ~]$ su -
パスワード:
[root@centos ~]#
</pre>
</div>
<p>&#8220;user&#8221; では無事 root に。</p>
<div class="command">
<pre>
[user02@centos ~]$ su -
パスワード:
su: パスワードが違います
[user02@centos ~]$
</pre>
</div>
<p>確認用に作った &#8220;user02&#8243; では、su &#8211; で root になることができません。でも、その時のメッセージって「パスワードが違います」なんですね。。</p>
<h2>yum の初期設定</h2>
<p>このあたり、手順は完全に<a href="http://centossrv.com/centos5-init.shtml">CentOS5初期設定</a>を参考にさせていただいています。</p>
<p>さて、CentOS の初期設定の情報は WEB 上にたくさんありますが、yum の設定を行っているのは他であまり見なかったので、その理由を引用させていただきます。</p>
<blockquote><p>
・デフォルトで1時間ごとにアップデートチェックを行うようになっており、手動によるパッケージインストールと競合するとインストールが失敗する<br />
・大量にメモリを消費する(約10MB以上使用)<br />
<a href="http://centossrv.com/centos5-init.shtml">http://centossrv.com/centos5-init.shtml</a>
</p></blockquote>
<p>cd で init.d ディレクトリまで行って tum-updatesd の停止削除を行ってみました。場所は、/etc/rc.d/init.d/ です。yum コマンドに指定している -y オプションは確認メッセージを非表示にするものです。</p>
<p>tum-updatesd の停止削除ですが、tum-updatesd は、のちほどインストールする yum-cron と同じく、アプリケーションを一括でアップデートしてくれるアプリケーションです。違いとして、常駐型でメモリリークを起こしやすいとのこと。<br />
<a href="http://wingse.blog57.fc2.com/blog-entry-143.html">http://wingse.blog57.fc2.com/blog-entry-143.html</a><br />
そこで、tum-updatesd をアンインストールしてしまうわけですね。</p>
<div class="command">
<pre>
[root@centos init.d]# yum-updatesd stop
[root@centos init.d]# yum -y remove yum-updatesd
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package yum-updatesd.noarch 1:0.9-2.el5 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package                Arch             Version                Repository           Size
==========================================================================================
Removing:
 yum-updatesd           noarch           1:0.9-2.el5            installed            55 k

Transaction Summary
==========================================================================================
Install      0 Package(s)
Update       0 Package(s)
Remove       1 Package(s)

Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing        : yum-updatesd                                      [1/1]

Removed: yum-updatesd.noarch 1:0.9-2.el5
Complete!
[root@centos init.d]#
</pre>
</div>
<p>ずいぶん長いものがでましたが、成功したようです。</p>
<p>次は、fastestmirrorプラグインインストールをインストールします。このプラグインを入れると yum コマンドを実行する際、ミラーリストから自動で早いリポジトリを選択<br />
してくれるようです。比較すると劇的に変わるらしいのですが、やったことがないので、なんとも。。手早く先へ進むため、検証なしで GO! </p>
<div class="command">
<pre>
[root@centos init.d]# yum -y install yum-fastestmirror
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * updates: rsync.atworks.co.jp
 * addons: ftp.riken.jp
 * extras: ftp.riken.jp
Setting up Install Process
Parsing package install arguments
Package yum-fastestmirror-1.1.16-13.el5.centos.noarch already installed and latest version
Nothing to do
</pre>
</div>
<p>と、思ったら最初から入ってるんですね、yum-fastestmirror。OS CentOS 5.3 です。<br />
う?ん、はじめての yum だったのに。</p>
<p>インストール済パッケージの一括アップデートです。若干時間がかかります。</p>
<div class="command">
<pre>
[root@centos /]# yum -y update
</pre>
</div>
<p>続いて、yum-cron のインストールです。yum-cron はアプリケーションのアップデートを自動でやってくれるアプリケーションです。<br />
以下のコマンドを実行。</p>
<div class="command">
<pre>
[root@centos /]# yum -y install yum-cron

http://centossrv.com/bbshtml/webpatio/1185.shtml
</pre>
</div>
<p>ところが、エラーが発生。</p>
<div class="command">
<pre>
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * updates: rsync.atworks.co.jp
 * addons: ftp.riken.jp
 * extras: ftp.riken.jp
Setting up Install Process
Parsing package install arguments
No package yum-cron available.
Nothing to do
</pre>
</div>
<p>パッケージが見つからないと、、調べてみると、CentOS 5.3 には yum-cron がない模様<br />
<a href="http://centossrv.com/bbshtml/webpatio/1185.shtml">http://centossrv.com/bbshtml/webpatio/1185.shtml</a><br />
今回はテスト環境づくりなので、最悪自動アップデートはできなくてもいいけど、できたいなあ、、</p>
<p>宿題がふえました。</p>
<h2>root宛メールを転送</h2>
<p>、、の設定をためしたのですが、さっぱりうまくゆかず、いつかやろうということに。最終的には qmail を使うので、それで回避できればなあと。。</p>
<p>やってみたこと。<br />
・sendmail-cfインストール<br />
・sendmail設定ファイル編集<br />
・sendmail.mcからsendmail.cfを作成　←　ここでエラー　ディレクトリが見つからない。。スペルミスかな。。</p>
<p>・旧root宛メール転送設定削除<br />
・/etc/aliases に root: hoge@nifty.com を追加<br />
・newaliases 実行<br />
・echo test|mail root　→　やっぱりメールは来ない。</p>
<p>はまりそうなので、また今度?</p>
<h2>SELinuxの無効化</h2>
<p>引き続き<a href="http://centossrv.com/centos5-init.shtml">CentOS5初期設定</a>を参考にさせていただいています。でも、なぜ SELinux を無効化するのかが書いていなかったので、調べてみました。</p>
<p>さっと調べた限りでは、あまり有力な情報はなかったけれど、どうやら SELinux がいろんな方面に影響してシステム設定がやっかいなことになるらしい。それなら、全部の設定が完了してから有効にするほうがよさそう、ということみたいです。</p>
<div class="command">
<pre>
[root@centos /]# getenforce
Enforcing
[root@centos /]# setenforce 0
[root@centos /]# getenforce
Permissive
</pre>
</div>
<p>次は、起動時に SELinux を無効にする設定です。</p>
<div class="command">
<pre>
[root@centos /]# vi /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted
</pre>
</div>
<p>リブートして、再度 SELinux の状況を確認。</p>
<div class="command">
<pre>
[root@uotarou ~]# getenforce
Disabled
</pre>
</div>
<p>無効化成功です！</p>
<p>つづきます。</p>
<p>今回の宿題：<br />
・システムからのメール転送設定<br />
・yum-cron をどうしよう。。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.a-magic-web.com/server_linux/build/vmware-centos-6.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>自宅でVMware + CentOS &#8211; その5　CentOS インストール 2</title>
		<link>http://www.a-magic-web.com/server_linux/build/vmware-centos-5.html</link>
		<comments>http://www.a-magic-web.com/server_linux/build/vmware-centos-5.html#comments</comments>
		<pubDate>Wed, 15 Apr 2009 14:10:41 +0000</pubDate>
		<dc:creator>vohedge</dc:creator>
				<category><![CDATA[構築（テスト環境）]]></category>

		<guid isPermaLink="false">http://www.a-magic-web.com/?p=83</guid>
		<description><![CDATA[前回までのあらすじ。 自宅でも気軽に WEB のテストができる環境がほしいと思い立ち、宅内にテスト環境として、専用の PC に VMware をいれ、その上に CentOS で WEB サーバーを建ててしまおう！というのが目標で、前回までに、Vmware Server をインストールして、ゲスト OS を作り、CentOSのインストールの半分まできています。 今回は、CentOS 5.3 のインストール後半です。 CentOS 5.3 のインストール後半 [Desktop - KDE] のチェックをはずして [次へ] インストールするオプションを選択します。今回はできるだけ少ない構成でインストールを行います。 チェックを付けたのは以下の通り。 ・開発 &#8211; 開発ツール ・ベースシステム &#8211; ベース ・言語 &#8211; 日本語のサポート [次へ] をクリック &#8220;次の CD が必要です&#8221; [続行] をクリック。 インストール途中で 2枚目の CD-ROM の挿入を求められます。 VMware のウインドウの右下のあたりの CD-ROM のアイコンをダブルクリックします。 [Use iso [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.a-magic-web.com/os/centos53_install/">前回</a>までのあらすじ。<br />
自宅でも気軽に WEB のテストができる環境がほしいと思い立ち、宅内にテスト環境として、専用の PC に VMware をいれ、その上に CentOS で WEB サーバーを建ててしまおう！というのが目標で、前回までに、Vmware Server をインストールして、ゲスト OS を作り、CentOSのインストールの半分まできています。</p>
<p>今回は、CentOS 5.3 のインストール後半です。</p>
<h2>CentOS 5.3 のインストール後半</h2>
<p>[Desktop - KDE] のチェックをはずして [次へ]<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install018.jpg" alt="centos53install018" title="centos53install018" width="480" height="433" class="alignnone size-full wp-image-87" /></p>
<p>インストールするオプションを選択します。今回はできるだけ少ない構成でインストールを行います。</p>
<p>チェックを付けたのは以下の通り。</p>
<p>・開発 &#8211; 開発ツール<br />
・ベースシステム &#8211; ベース<br />
・言語 &#8211; 日本語のサポート<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install019.jpg" alt="centos53install019" title="centos53install019" width="480" height="433" class="alignnone size-full wp-image-88" /></p>
<p>[次へ] をクリック<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install027.jpg" alt="centos53install027" title="centos53install027" width="480" height="433" class="alignnone size-full wp-image-96" /></p>
<p>&#8220;次の CD が必要です&#8221; [続行] をクリック。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install028.jpg" alt="centos53install028" title="centos53install028" width="480" height="433" class="alignnone size-full wp-image-97" /></p>
<p>インストール途中で 2枚目の CD-ROM の挿入を求められます。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install030.jpg" alt="centos53install030" title="centos53install030" width="480" height="433" class="alignnone size-full wp-image-99" /></p>
<p>VMware のウインドウの右下のあたりの CD-ROM のアイコンをダブルクリックします。</p>
<p>[Use iso image] の [Browse] で、2つ目の iso ファイルを指定します。</p>
<p>2?5枚目まで、同じように仮想ディスクを交換しながらインストールを進めます。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install031.jpg" alt="centos53install031" title="centos53install031" width="480" height="360" class="alignnone size-full wp-image-100" /></p>
<p>[再起動] をクリック。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install033.jpg" alt="centos53install033" title="centos53install033" width="480" height="433" class="alignnone size-full wp-image-101" /></p>
<p>[Setup Agent] が表示<br />
正直よくわからないので、今回はパス。調べるとインストール後に走らせることもできる模様。<br />
以下の設定ができるそう。<br />
・権限の設定<br />
・ファイアウォールの設定<br />
・ネットワーク設定<br />
・システムサービスの設定<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install034a.jpg" alt="centos53install034a" title="centos53install034a" width="480" height="349" class="alignnone size-full wp-image-104" /></p>
<p>CentOS が起動しました！<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install035.jpg" alt="centos53install035" title="centos53install035" width="480" height="349" class="alignnone size-full wp-image-84" /></p>
<p>つづく</p>
]]></content:encoded>
			<wfw:commentRss>http://www.a-magic-web.com/server_linux/build/vmware-centos-5.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>自宅でVMware + CentOS &#8211; その4　CentOS インストール 1</title>
		<link>http://www.a-magic-web.com/server_linux/build/vmware-centos-4.html</link>
		<comments>http://www.a-magic-web.com/server_linux/build/vmware-centos-4.html#comments</comments>
		<pubDate>Wed, 15 Apr 2009 13:32:51 +0000</pubDate>
		<dc:creator>vohedge</dc:creator>
				<category><![CDATA[構築（テスト環境）]]></category>

		<guid isPermaLink="false">http://www.a-magic-web.com/?p=71</guid>
		<description><![CDATA[前回までのあらすじ。 自宅でも気軽に WEB のテストができる環境がほしいと思い立ち、宅内にテスト環境として、専用の PC に VMware をいれ、その上に CentOS で WEB サーバーを建ててしまおう！というのが目標です。 前回は、VMware でゲスト OS を作成しました。今回は、いよいよ CentOS をインストールします。 CentOS のインストール 最初に、ダウンロードした .iso ファイルを、仮想 CD-ROM ドライブで指定します。 [CD-ROM] をダブルクリック [Browse] をダブルクリックして .iso ファイルを指定します。 仮想マシンを起動すると、インストール方法を選択する画面に。まだ CUI は怖いので Enter キーを押して進めます。 インストールデータのチェックができるようですが、手早くすませるため、[skip] を選択。 [Next] をクリック インストール作業を行う間の言語を選択。もちろん [日本語] キーボードも [日本語] を選択。 &#8220;初期化しますか ?&#8221; [はい] をクリック。 [選択したドライブ上のすべてのパーティションを削除してデフォルトのレイアウトを作成します。] を選択して [次へ] &#8220;本当にすべて削除しますか ?&#8221; [はい] [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.a-magic-web.com/os/test_env_003/">前回</a>までのあらすじ。<br />
自宅でも気軽に WEB のテストができる環境がほしいと思い立ち、宅内にテスト環境として、専用の PC に VMware をいれ、その上に CentOS で WEB サーバーを建ててしまおう！というのが目標です。</p>
<p>前回は、VMware でゲスト OS を作成しました。今回は、いよいよ CentOS をインストールします。</p>
<h2>CentOS のインストール</h2>
<p>最初に、ダウンロードした .iso ファイルを、仮想 CD-ROM ドライブで指定します。</p>
<p>[CD-ROM] をダブルクリック<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos013.jpg" alt="make_gestos013" title="make_gestos013" width="480" height="371" class="alignnone size-full wp-image-70" /></p>
<p>[Browse] をダブルクリックして .iso ファイルを指定します。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos012.jpg" alt="make_gestos012" title="make_gestos012" width="432" height="333" class="alignnone size-full wp-image-69" /></p>
<p>仮想マシンを起動すると、インストール方法を選択する画面に。まだ CUI は怖いので Enter キーを押して進めます。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install001.jpg" alt="centos53install001" title="centos53install001" width="480" height="451" class="alignnone size-full wp-image-73" /></p>
<p>インストールデータのチェックができるようですが、手早くすませるため、[skip] を選択。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install004.jpg" alt="centos53install004" title="centos53install004" width="480" height="349" class="alignnone size-full wp-image-74" /></p>
<p>[Next] をクリック<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install005.jpg" alt="centos53install005" title="centos53install005" width="480" height="433" class="alignnone size-full wp-image-75" /></p>
<p>インストール作業を行う間の言語を選択。もちろん [日本語]<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install006.jpg" alt="centos53install006" title="centos53install006" width="480" height="433" class="alignnone size-full wp-image-76" /></p>
<p>キーボードも [日本語] を選択。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install007.jpg" alt="centos53install007" title="centos53install007" width="480" height="433" class="alignnone size-full wp-image-77" /></p>
<p>&#8220;初期化しますか ?&#8221; [はい] をクリック。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install008.jpg" alt="centos53install008" title="centos53install008" width="480" height="433" class="alignnone size-full wp-image-78" /></p>
<p>[選択したドライブ上のすべてのパーティションを削除してデフォルトのレイアウトを作成します。] を選択して [次へ]<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install009.jpg" alt="centos53install009" title="centos53install009" width="480" height="433" class="alignnone size-full wp-image-79" /></p>
<p>&#8220;本当にすべて削除しますか ?&#8221; [はい] をクリック。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install010.jpg" alt="centos53install010" title="centos53install010" width="480" height="433" class="alignnone size-full wp-image-80" /></p>
<p>[編集] をクリック。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install011.jpg" alt="centos53install011" title="centos53install011" width="480" height="433" class="alignnone size-full wp-image-81" /></p>
<p>[Enable IPv4 support] のチェックをオン、[Manual configuration] で適当な IP アドレスとサブネットマスクを設定。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install013.jpg" alt="centos53install013" title="centos53install013" width="480" height="433" class="alignnone size-full wp-image-82" /></p>
<p>ホスト名と、デフォルトゲートウェイの IP アドレスを入力します。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install015.jpg" alt="centos53install015" title="centos53install015" width="480" height="433" class="alignnone size-full wp-image-72" /></p>
<p>[システムで UTC を使用] のチェックを外して [次へ] </p>
<p>UTC とは 協定世界時 のことで、日本の時間より 9 時間遅い。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install016.jpg" alt="centos53install016" title="centos53install016" width="480" height="433" class="alignnone size-full wp-image-85" /></p>
<p>Linux の管理者アカウントである root のパスワードを決めます。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/centos53install017.jpg" alt="centos53install017" title="centos53install017" width="480" height="433" class="alignnone size-full wp-image-86" /></p>
<p>つづく</p>
]]></content:encoded>
			<wfw:commentRss>http://www.a-magic-web.com/server_linux/build/vmware-centos-4.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>自宅でVMware + CentOS &#8211; その3　ゲストOSの作成</title>
		<link>http://www.a-magic-web.com/server_linux/build/vmware-centos-3.html</link>
		<comments>http://www.a-magic-web.com/server_linux/build/vmware-centos-3.html#comments</comments>
		<pubDate>Wed, 15 Apr 2009 12:50:04 +0000</pubDate>
		<dc:creator>vohedge</dc:creator>
				<category><![CDATA[構築（テスト環境）]]></category>

		<guid isPermaLink="false">http://www.a-magic-web.com/?p=57</guid>
		<description><![CDATA[前回までのあらすじ。 自宅でも気軽に WEB のテストができる環境がほしいと思い立ち、宅内にテスト環境として、専用の PC に VMware をいれ、その上に CentOS で WEB サーバーを建ててしまおう！というのが目標です。 前回は、CentOS をダウンロードするところまで。今回は VMware でゲスト OS を作成します。 ゲスト OS の作成 起動して [local host] に接続。 [New Virtual Machine] をクリック。 [次へ] をクリック。 [Typical] をオンにして [次へ] をクリック。 今回インストールする CentOS は Red Hat Linux のコピーのようなものなので、ここは [Linux] と [Red Hat Linux 4] を選択。 適当な名前と、仮想マシンのデータの保存場所を指定。 今回は LAN 内にホストとは別の IP で作りたかったので、[Use [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.a-magic-web.com/os/test_env_002/">前回</a>までのあらすじ。<br />
自宅でも気軽に WEB のテストができる環境がほしいと思い立ち、宅内にテスト環境として、専用の PC に VMware をいれ、その上に CentOS で WEB サーバーを建ててしまおう！というのが目標です。</p>
<p>前回は、CentOS をダウンロードするところまで。今回は VMware でゲスト OS を作成します。</p>
<h2>ゲスト OS の作成</h2>
<p>起動して [local host] に接続。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos001.jpg" alt="make_gestos001" title="make_gestos001" width="480" height="360" class="alignnone size-full wp-image-58" /></p>
<p>[New Virtual Machine] をクリック。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos003.jpg" alt="make_gestos003" title="make_gestos003" width="480" height="371" class="alignnone size-full wp-image-60" /></p>
<p>[次へ] をクリック。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos004.jpg" alt="make_gestos004" title="make_gestos004" width="360" height="267" class="alignnone size-full wp-image-61" /></p>
<p>[Typical] をオンにして [次へ] をクリック。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos005.jpg" alt="make_gestos005" title="make_gestos005" width="360" height="267" class="alignnone size-full wp-image-62" /></p>
<p>今回インストールする CentOS は Red Hat Linux のコピーのようなものなので、ここは [Linux] と [Red Hat Linux 4] を選択。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos006.jpg" alt="make_gestos006" title="make_gestos006" width="360" height="267" class="alignnone size-full wp-image-63" /></p>
<p>適当な名前と、仮想マシンのデータの保存場所を指定。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos007.jpg" alt="make_gestos007" title="make_gestos007" width="360" height="267" class="alignnone size-full wp-image-64" /></p>
<p>今回は LAN 内にホストとは別の IP で作りたかったので、[Use Bridge Netword] を選択。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos008.jpg" alt="make_gestos008" title="make_gestos008" width="360" height="267" class="alignnone size-full wp-image-65" /></p>
<p>今回このステップがよくわからなかった。<br />
とくに &#8220;Allocate all disk space now&#8221; の項目が。</p>
<p>&#8220;By allocating the full capacity of the virtual disk, you enhance performance of your virtual machine.<br />
However, the disk will take longer to create and there must be enough space on the host&#8217;s physical disk.<br />
If you do not allocate disk soace now, your virtual disk files will start small, then become larger as you add applications, files, and data to your virtual machine.&#8221;</p>
<p>直訳すると、、<br />
「すべてのディクスペースをすぐに割り当てる<br />
仮想ディスクの最大容量を割り当てることで、仮想マシンのパフォーマンスを上げることができます。しかし、仮想ディスクの作成に時間がかかり、ホストの物理ディスクに十分な容量が必要です。<br />
いますぐディスクスペースを割り当てない場合、仮想ディスクは少ない容量で作成され、アプリケーションやデータの増大に伴って大きくなります。」</p>
<p>チェックを付けると、指定したサイズで仮想ディスクが作られ、チェックをオフにすると最初は最小限のサイズで作られ、仮想マシンのデータが増えるとそれに合わせて指定した最大容量まで増えていく。この解釈でいいのかな？</p>
<p>とりあえず、[Disk size] を &#8220;10&#8243;、仮想マシンのイメージはたくさん作る気がするのでAllocate all disk space now] のチェックはオフ、[Split disk into 2 GB files] はファイルの数が増えるのがいやなのでオフに設定。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos009.jpg" alt="make_gestos009" title="make_gestos009" width="360" height="267" class="alignnone size-full wp-image-66" /></p>
<p>ここまでの作業で、ゲスト OSの作成が完了。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos010.jpg" alt="make_gestos010" title="make_gestos010" width="480" height="371" class="alignnone size-full wp-image-67" /></p>
<p>メモリはデフォルトの 256 MB のまま。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/make_gestos011.jpg" alt="make_gestos011" title="make_gestos011" width="432" height="333" class="alignnone size-full wp-image-68" /></p>
<p>つづく</p>
]]></content:encoded>
			<wfw:commentRss>http://www.a-magic-web.com/server_linux/build/vmware-centos-3.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>自宅でVMware + CentOS &#8211; その2　CentOS ダウンロード</title>
		<link>http://www.a-magic-web.com/server_linux/build/vmware-centos-2.html</link>
		<comments>http://www.a-magic-web.com/server_linux/build/vmware-centos-2.html#comments</comments>
		<pubDate>Wed, 15 Apr 2009 04:37:32 +0000</pubDate>
		<dc:creator>vohedge</dc:creator>
				<category><![CDATA[構築（テスト環境）]]></category>

		<guid isPermaLink="false">http://www.a-magic-web.com/?p=53</guid>
		<description><![CDATA[前回までのあらすじ。 自宅でも気軽に WEB のテストができる環境がほしいと思い立ち、宅内にテスト環境として、専用の PC に VMware をいれ、その上に CentOS で WEB サーバーを建ててしまおう！というのが目標です。 前回は、ハードの準備と、VMware のインストールまで。今回は、CentOS のインストールデータを用意します。 CentOS のダウンロード まず、CentOS の .iso データをダウンロードします。利用したサイトは、CentOS の公式サイトのリンクで一番上にあったもの。そこから、現時点で最新の CentOS 5.3 をダウンロード。ダウンロードデータは「i386」と「x86_64」の 2種類あります。今回使用するハードは通常の 32ビットなので「i386」を選択します。 CentOS の .iso データは、CD 版が全 6ファイル、DVD 版が 1ファイルで 3.7GB。今回は CD 版を使いましたが、1つのファイルを落とすのに 20-30分、なんだかんだで 3-4時間はかかりました。日本のミラーを探したほうがよかったなとあとから(ry http://ftp.jaist.ac.jp/pub/Linux/CentOS/5.3/isos/i386/ sha1sum.txt と md5sum.txt .iso と同じディレクトリに置かれている sha1sum.txt と md5sum.txt ってなんだろう ? と思い、調べてみました。結論から言うと、ダウンロードしたデータが壊れていないか確認するものでした。 sha1sum と md5sum [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.a-magic-web.com/software/test_env_001/">前回</a>までのあらすじ。<br />
自宅でも気軽に WEB のテストができる環境がほしいと思い立ち、宅内にテスト環境として、専用の PC に VMware をいれ、その上に CentOS で WEB サーバーを建ててしまおう！というのが目標です。</p>
<p>前回は、ハードの準備と、VMware のインストールまで。今回は、CentOS のインストールデータを用意します。</p>
<h2>CentOS のダウンロード</h2>
<p>まず、CentOS の .iso データをダウンロードします。利用したサイトは、CentOS の公式サイトのリンクで一番上にあったもの。そこから、現時点で最新の CentOS 5.3 をダウンロード。ダウンロードデータは「i386」と「x86_64」の 2種類あります。今回使用するハードは通常の 32ビットなので「i386」を選択します。</p>
<p>CentOS の .iso データは、CD 版が全 6ファイル、DVD 版が 1ファイルで 3.7GB。今回は CD 版を使いましたが、1つのファイルを落とすのに 20-30分、なんだかんだで 3-4時間はかかりました。日本のミラーを探したほうがよかったなとあとから(ry<br />
<a href="http://ftp.jaist.ac.jp/pub/Linux/CentOS/5.3/isos/i386/">http://ftp.jaist.ac.jp/pub/Linux/CentOS/5.3/isos/i386/</a><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/screenshot-2009_04_15-12_18_21.png" alt="screenshot-2009_04_15-12_18_21" title="screenshot-2009_04_15-12_18_21" width="480" height="360" class="alignnone size-full wp-image-55" /></p>
<h2>sha1sum.txt と md5sum.txt</h2>
<p>.iso と同じディレクトリに置かれている sha1sum.txt と md5sum.txt ってなんだろう ? と思い、調べてみました。結論から言うと、ダウンロードしたデータが壊れていないか確認するものでした。<br />
sha1sum と md5sum の違いは、@IT さんによると以下の違いがあるようです。</p>
<blockquote><p>
128ビットのチェックサム値が出力されるMD5よりも、160ビットのチェックサム値が出力されるSHA1の方が安全といわれている。<br />
<a href="http://www.atmarkit.co.jp/flinux/rensai/linuxtips/754sha1sum.html">http://www.atmarkit.co.jp/flinux/rensai/linuxtips/754sha1sum.html</a>
</p></blockquote>
<h2>sha1sum の実行</h2>
<p>.iso のダウンロードと同じページにあった sha1sum.txt を.iso と同じディレクトリに保存します。Windows には sha1sum コマンドが入っていないので、ダウンロードして .iso ファイルとおなじディレクトリに保存します。手順とダウンロードファイルは、<a href="http://centossrv.com/centos5.shtml">CentOSで自宅サーバー構築</a>を参考にさせていただきました。<br />
→<a href="http://sites.inka.de/tesla/download/sha1sum.exe">http://sites.inka.de/tesla/download/sha1sum.exe</a><br />
sha1sum 実行前のディレクトリのスクリーンショット<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/000.jpg" alt="000" title="000" width="508" height="289" class="alignnone size-full wp-image-56" /></p>
<p>コマンドプロンプトを起動して、まず、.iso ファイルのディレクトリに移動します。</p>
<div class="command">
<pre>
C:Documents and Settings*****>cd /d D:Centos5.3_iso
</pre>
</div>
<p>.iso と sha1sum.txt、sha1sum.exe が保存されているディレクトリで以下のコマンドを実行します。DVD イメージと netinstall (こんなイメージがあるんですね) は使わないので、下の 2つのエラーは問題なし。</p>
<div class="command">
<pre>
D:Centos5.3_iso>sha1sum -c sha1sum.txt
CentOS-5.3-i386-bin-1of6.iso: OK
CentOS-5.3-i386-bin-2of6.iso: OK
CentOS-5.3-i386-bin-3of6.iso: OK
CentOS-5.3-i386-bin-4of6.iso: OK
CentOS-5.3-i386-bin-5of6.iso: OK
CentOS-5.3-i386-bin-6of6.iso: OK
sha1sum: CentOS-5.3-i386-bin-DVD.iso: No such file or directory
CentOS-5.3-i386-bin-DVD.iso: FAILED open or read
sha1sum: CentOS-5.3-i386-netinstall.iso: No such file or directory
CentOS-5.3-i386-netinstall.iso: FAILED open or read
sha1sum: WARNING: 2 of 8 listed files could not be read
</pre>
</div>
<p>つづく</p>
]]></content:encoded>
			<wfw:commentRss>http://www.a-magic-web.com/server_linux/build/vmware-centos-2.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>自宅でVMware + CentOS &#8211; その1　VMware Server インストール</title>
		<link>http://www.a-magic-web.com/others/software/vmware/vmware-centos-1.html</link>
		<comments>http://www.a-magic-web.com/others/software/vmware/vmware-centos-1.html#comments</comments>
		<pubDate>Mon, 13 Apr 2009 13:36:04 +0000</pubDate>
		<dc:creator>vohedge</dc:creator>
				<category><![CDATA[VMware]]></category>
		<category><![CDATA[構築（テスト環境）]]></category>

		<guid isPermaLink="false">http://www.a-magic-web.com/?p=35</guid>
		<description><![CDATA[自宅で、WEB のテスト環境を作ろう！と思い立ちました。XP 上で VMware Server を使って Centos を動かし、Apatch や PHP、MySQL を使う検証作業環境をつくるところまでが今回の目標です。基本的な Ｌｉｎｕｘ のコマンドも使えるようになりたい！ ハードウエア 今回使用するのは、NECのPC-VL57E8D1Kです。む一度は完全に故障したと思われたPC-VL57E8D1K ですが、HDD と IDE ケーブルの交換で使える状態になり、さらに今回メモリを最大量の 512MBx2 に増設して使用します。 また、CD-ROM ドライブは外付け用にに外してしまっており、さらに専用のディスプレイもありません。操作は主にメイン PC から Logmein でリモート操作をする予定です。 スペック ・CPU : Athlon(tm) XP 2600+ 1.91 GHz ・メモリ : 1GB ・HDD : 160GB ・OS : Windows XP SP3 VMware のインストール 無料の仮想化ソフトは、Vmware のほかにも、Microsoft の Virtual PC 、Sun の [...]]]></description>
			<content:encoded><![CDATA[<p>自宅で、WEB のテスト環境を作ろう！と思い立ちました。XP 上で VMware Server を使って Centos を動かし、Apatch や PHP、MySQL を使う検証作業環境をつくるところまでが今回の目標です。基本的な Ｌｉｎｕｘ のコマンドも使えるようになりたい！</p>
<h2>ハードウエア</h2>
<p>今回使用するのは、NECのPC-VL57E8D1Kです。む一度は完全に故障したと思われたPC-VL57E8D1K ですが、HDD と IDE ケーブルの交換で使える状態になり、さらに今回メモリを最大量の 512MBx2 に増設して使用します。</p>
<p>また、CD-ROM ドライブは外付け用にに外してしまっており、さらに専用のディスプレイもありません。操作は主にメイン PC から Logmein でリモート操作をする予定です。</p>
<p>スペック<br />
・CPU : Athlon(tm) XP 2600+ 1.91 GHz<br />
・メモリ : 1GB<br />
・HDD : 160GB<br />
・OS : Windows XP SP3</p>
<h2>VMware のインストール</h2>
<p>無料の仮想化ソフトは、Vmware のほかにも、Microsoft の Virtual PC 、Sun の VirtualBox があるようです。Vmware Server にしたのは、Virtual PC は動作が重く、Linux のインストールがうまくいかないことがあるという情報が多かったためと、VirtualBox よりは、会社で普段使っているものの方がよいだろう、という判断です。ただし、VirtualBox には、複数のスナップショットが撮れる機能があるようで、今後検証してみたいな。</p>
<p>また、無料の VMware Server にも、バージョン 1 と 2 があり、2 では Web ブラウザを使用した管理画面になった模様。しかしこの web ベースの管理画面の出来がよくないらしいので、今回は VWware Server 1 を選択。</p>
<p>以下、インストール作業のログです。設定箇所はほとんどありません。完全にデフォルトのままインストール行い、問題なく起動しました。<br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/001.jpg" alt="001" title="001" width="480" height="360" class="alignnone size-full wp-image-49" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/003.jpg" alt="003" title="003" width="480" height="360" class="alignnone size-full wp-image-50" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/004.jpg" alt="004" title="004" width="353" height="270" class="alignnone size-full wp-image-38" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/005.jpg" alt="005" title="005" width="353" height="270" class="alignnone size-full wp-image-39" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/006.jpg" alt="006" title="006" width="353" height="270" class="alignnone size-full wp-image-41" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/007.jpg" alt="007" title="007" width="447" height="155" class="alignnone size-full wp-image-42" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/008.jpg" alt="008" title="008" width="353" height="270" class="alignnone size-full wp-image-43" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/010.jpg" alt="010" title="010" width="353" height="270" class="alignnone size-full wp-image-44" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/011.jpg" alt="011" title="011" width="353" height="270" class="alignnone size-full wp-image-45" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/012.jpg" alt="012" title="012" width="353" height="270" class="alignnone size-full wp-image-46" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/013.jpg" alt="013" title="013" width="353" height="270" class="alignnone size-full wp-image-47" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/015.jpg" alt="015" title="015" width="353" height="270" class="alignnone size-full wp-image-48" /><br />
<img src="http://www.a-magic-web.com/wp-content/uploads/2009/04/016.jpg" alt="016" title="016" width="480" height="346" class="alignnone size-full wp-image-51" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.a-magic-web.com/others/software/vmware/vmware-centos-1.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
