2017年10月16日月曜日

VagrantでTalend Open Studio for Data IntegrationとGnome Desktop環境、XRDPがインストールされた仮想マシン(CentOS7.4)を構築する

TalendはオープンソースのETLソフトウェアです。

仮想マシンの構築方法

以下のVagrantfileを使用して、Talend Open Studio for Data IntegrationとGnome Desktop環境、XRDPをインストールした仮想マシンを構築できます。
XRDPがインストールされているので、Windowsのリモートデスクトップで接続することができます。ユーザ名はVagrant、パスワードもVagrantでログオンします。
Talend Open Studio for Data Integrationを起動するには、デスクトップにあるTOS_DIという名称のアイコンをダブルクリックします。

Vagrantfile
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "bento/centos-7.4"
  config.vm.hostname = "co74tosdi641"
  config.vm.network :public_network, ip:"192.168.1.117"
  config.vm.provider :virtualbox do |vbox|
     vbox.name = "co74tosdi641"
     vbox.gui = true
     vbox.cpus = 4
     vbox.memory = 4096
  end
  config.vm.provision "shell", inline: <<-SHELL
yum -y install wget

# 日本語のロケールを設定
localectl set-locale LANG=ja_JP.UTF-8

# GUIに関連するパッケージをインストール
sudo yum -y groupinstall "Server with GUI"
# 不要なダイアログを表示されないようにする
sudo sh -c "echo 'X-GNOME-Autostart-enabled=false' >> /etc/xdg/autostart/gnome-welcome-tour.desktop"
sudo sh -c "echo 'X-GNOME-Autostart-enabled=false' >> /etc/xdg/autostart/gnome-software-service.desktop"
sudo sh -c "echo 'X-GNOME-Autostart-enabled=false' >> /etc/xdg/autostart/gnome-settings-daemon.desktop"
sudo systemctl disable initial-setup-graphical.service
sudo systemctl disable initial-setup-text.service

sudo systemctl set-default graphical.target

# いったんAutomatic Loginモードに変更
cp /etc/gdm/custom.conf /etc/gdm/custom.conf.org
cat << EOF > /etc/gdm/custom.conf
# GDM configuration storage

[daemon]
AutomaticLogin=vagrant
AutomaticLoginEnable=True
[security]

[xdmcp]

[chooser]

[debug]
# Uncomment the line below to turn on debugging
#Enable=true
EOF
cat << EOF >> /home/vagrant/.bashrc
if [[ -v DISPLAY ]]; then
   setxkbmap jp -model jp106
fi
EOF
service gdm restart
sleep 10
sudo -u vagrant sh -c "export DISPLAY=:0 && gsettings set org.gnome.desktop.input-sources sources \\"[('ibus', 'kkc'), ('xkb', 'us')]\\""
sudo -u vagrant sh -c "export DISPLAY=:0 && gsettings set org.gnome.desktop.wm.keybindings switch-input-source \\"['space']\\""
sudo -u vagrant sh -c "export DISPLAY=:0 && gsettings set org.gnome.settings-daemon.plugins.keyboard active false"

# Automatic Loginモード終了
cp -f /etc/gdm/custom.conf.org /etc/gdm/custom.conf
service gdm restart


# XRDPをインストールして、リモートデスクトップでログインできるようにする。
yum -y install epel-release
yum -y install xrdp tigervnc-server

chcon -t bin_t /usr/sbin/xrdp
chcon -t bin_t /usr/sbin/xrdp-sesman
sed -i "s/max_bpp=32/max_bpp=24/" /etc/xrdp/xrdp.ini
systemctl start xrdp.service
systemctl enable xrdp.service

# install java
yum -y install java-1.8.0-openjdk


wget 'https://sourceforge.net/projects/talend-studio/files/Talend%20Open%20Studio/6.4.1/TOS_DI-20170623_1246-V6.4.1.zip';
unzip TOS_DI-20170623_1246-V6.4.1.zip
mv TOS_DI-20170623_1246-V6.4.1 /opt/tosdi

# Talend Open Studio for Data Integrationのショートカットを作成
mkdir -p /home/vagrant/デスクトップ/
chown vagrant:vagrant /home/vagrant/デスクトップ/
cat << EOF > /home/vagrant/デスクトップ/TOS_DI.desktop
#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=sh -c "setxkbmap jp -model jp106 && /opt/tosdi/TOS_DI-linux-gtk-x86_64"
Name=TOS_DI
EOF
chmod +x /home/vagrant/デスクトップ/TOS_DI.desktop
chown vagrant:vagrant /home/vagrant/デスクトップ/TOS_DI.desktop

telinit 5
SHELL
end

Talend Open Studio for Data Integration起動後の画面

関連情報

・Talendに関する他の記事はこちらを参照してください。

0 件のコメント:

コメントを投稿