Create: 2014/10/03
LastUpdate: 2014/10/03
「 [XenServer6.2] CentOS7 のインストール」で作成した PV の CentOS7 には、最小構成のパッケージしか入っていないので、GNOMEデスクトップとVNCサーバを追加インストールして、GUI環境を構築してみます。
1.SELinuxの設定
SELinux は無効にします。
以下は設定ファイルの内容です。赤字部分は変更箇所です。
# cat /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, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
2.ファイヤーウォールの設定
ファイヤーウォールは無効にします。
以下のようにコマンドを実行して、fairewalld を無効にし、最後に iptables コマンドでファイヤーウォールの設定がクリアされていることを確認します。
# iptables -F # systemctl stop firewalld.service [ 1189.258181] Ebtables v2.0 unregistered # systemctl disable firewalld.service rm '/etc/systemd/system/basic.target.wants/firewalld.service' rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service' # iptables -L -n [ 1215.443999] ip_tables: (C) 2000-2006 Netfilter Core Team Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination
3.ポートの設定
VNCが使用するポート(5900)を登録します。
以下は、/etc/services に追加した設定を表示しています。
# grep "vnc-server" /etc/services
vnc-server 5900/tcp # VNC Server
vnc-server 5900/udp # VNC Server
4.パッケージの追加インストール
GNOMEデスクトップを追加インストールします。
# yum -y groupinstall "GNOME Desktop"
VNCサーバ、xinetd を追加インストールします。後で、VNCサーバは、xinetd から起動するように設定します。
# yum -y install tigervnc-server xinetd
5.GDMの設定
GDM(GNOMEディスプレーマネージャ)の設定ファイルを修正します。
以下は設定ファイルの内容です。赤字が追加した設定です。
# cat /etc/gdm/custom.conf # GDM configuration storage [daemon] GtkModulesList= AddGtkModules=false RemoteGreeter=/usr/libexec/gdmgreeter [security] AllowRemoteRoot=true [xdmcp] Enable=true [greeter] [chooser] [debug]
6.xinetd の設定
xinetd を設定します。
以下は、新規作成した VNCサーバ用の設定です。
# cat /etc/xinetd.d/vnc-server
service vnc-server
{
socket_type = stream
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd -query localhost -once -SecurityTypes none
log_on_failure += USERID
disable = no
}
xinetd.d の自動起動をONにします。# systemctl enable xinetd
7.ランレベルの変更
ランレベル5(グラフィカルログイン)に変更します。
# systemctl set-default graphical.target
rm '/etc/systemd/system/default.target'
ln -s '/usr/lib/systemd/system/graphical.target' '/etc/systemd/system/default.target'
8.動作確認(グラフィカルログイン)
上記設定変更がすべて完了したら、VNC Viewer で仮想マシンにログインできるか確認します。
ちなみに、仮想マシンには、xen-tools を入れていないので XenCenter からグラフィカルログインすることはできません。
まず、仮想マシンをリブートします。
# rebootリブート完了後、PCのVNC Viewer を起動して、仮想マシンのIPアドレスを指定します。
下図のように、仮想マシン(CentOS7)のログイン画面が表示されます。
[アカウントが見つかりませんか?] をクリックします。
[ユーザ名]を入力して、[次へ]をクリックします。
[パスワード]を入力して[サインイン]をクリックします。
下図のような GNOMEデスクトップが表示されたらログイン成功です。
ログアウトしたい場合は、画面の右上(赤枠)に表示されているユーザ名をクリックするとメニューが表示されるので[サインアウト]を選択します。