!!ネットワークの設定 ページ: [[1|VirtualBox1]] [[2|VirtualBox2]] [[3|VirtualBox3]] 4 [[5|VirtualBox5]] CentOS のインストールが無事完了したら、ネットワークの設定をおこないます。 ---- :: !手順1: CentOSを シャットダウン(停止) します。 root でログインして、 '''# /sbin/shutdown -h now''' を実行します。 :: !手順2: CentOS側の[設定]=>[ネットワーク] で、eth1 を 「ホストオンリーアダプタ」 に設定します。 {{ref_image pageA0.jpg}} :: !手順3: CentOSを 起動 します。 Tera Term 等で、ssh にて 192.168.56.1 へログインします。 :: !手順4: 手順3にて、もしログインできない場合は、ネットワーク定義ファイルを開いて有効にします。   '''# vi /etc/sysconfig/network-scripts/ifcfg-eth0''' DEVICE="eth0" BOOTPROTO="dhcp" HWADDR="xx:xx:xx:xx:xx:xx" NM_CONTROLLED="yes" ONBOOT="yes" TYPE="Ethernet" UUID="xxxxx" ONBOOTを no から yes に変えます。   固定IPにしたい場合は、以下のように指定します。 BOOTPROTO="static" IPADDR="192.168.xxx.xxx" NETMASK="255.255.255.0" GATEWAY="192.168.xxx.xxx" BOOTPROTOを変更し、IPADDR、NETMASK、GATEWAYを追加。 設定し終えたら、ネットワークを再起動します。 '''# /etc/init.d/network restart''' :: !手順5: 以下のコマンドを実行して、iptables (ファイアウォール)を無効にします。(デスクトップ上なので不要です。)   '''# chkconfig iptables off''' '''# chkconfig | grep iptables''' iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off   '''# /etc/init.d/iptables stop''' iptables: ファイアウォールルールを消去中: [ OK ] iptables: チェインをポリシー ACCEPT へ設定中filter [ OK ] iptables: モジュールを取り外し中: [ OK ] :: !手順6: 以下のコマンドを実行して、SELinux を無効にします。(デスクトップ上なので不要です。)   '''# vi /etc/selinux/config''' # 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 - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted   SELINUX=enforcing を disabled に変えます。 :: !手順7: 作業ユーザを作成します。   他のサーバへファイルを移動させた場合に同じユーザになるようにユーザID、グループIDを統一しておきましょう。 下記の例では、500 で統一します。   '''# groupadd -g 500 グループ名''' '''# useradd -u 500 -g グループ名 ユーザ名''' '''# passwd ユーザ名''' ユーザー xxxx のパスワードを変更。 新しいパスワード: 新しいパスワードを再入力してください: passwd: 全ての認証トークンが正しく更新できました。 :: !手順8: 作業ユーザで sudo (スーパユーザ権限)を実行できるようにします。 最後の行を追加してユーザに権限を与えます。    '''# visudo''' ## Allows members of the users group to shutdown this system # %users localhost=/sbin/shutdown -h now ## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment) #includedir /etc/sudoers.d ユーザ名 ALL=(ALL) NOPASSWD: ALL :: !手順9: ユーザでログインして確認します。   スーパユーザで ls を実行してみます。   '''# su - ユーザ名''' '''$ visudo ls'''   エラーにならなければOKです。exit で抜けてください。 :: !手順10: 最後に reboot(再起動) します。   '''# reboot'''   以降、作成したユーザでログインして作業します。 ---- !トラブルシュート FireFoxでブラウザが外部へアクセスできない場合、 CentOS側のファイヤーウォールが「無効」になっているか確認してください。 (Windowsのデスクトップ上に構築するので、ファイヤーウォールは不要です。) プロキシ経由で、yumコマンドを使う場合は、 /etc/yum.conf に次の行を加えます。 proxy=http://プロキシホスト名:ポート番号/ :: ページ: [[1|VirtualBox1]] [[2|VirtualBox2]] [[3|VirtualBox3]] 4 [[5|VirtualBox5]]