Ambari でHDP構築時のredhat-lsb-printingエラー対応 

# エラー画面
<img width="1175" alt="スクリーンショット 2017-10-21 11.34.24.png" src="https://qiita-image-store.s3.amazonaws.com/0/133516/7b3636cc-b265-fa2a-bb78-d0fe05f115b7.png">


# Error
```
stderr: 
Traceback (most recent call last):
  File "/var/lib/ambari-agent/cache/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_server.py", line 139, in <module>
    ZookeeperServer().execute()
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 329, in execute
    method(env)
  File "/var/lib/ambari-agent/cache/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_server.py", line 71, in install
    self.install_packages(env)
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 708, in install_packages
    retry_count=agent_stack_retry_count)
  File "/usr/lib/python2.6/site-packages/resource_management/core/base.py", line 166, in __init__
    self.env.run()
  File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 160, in run
    self.run_action(resource, action)
  File "/usr/lib/python2.6/site-packages/resource_management/core/environment.py", line 124, in run_action
    provider_action()
  File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/__init__.py", line 54, in action_install
    self.install_package(package_name, self.resource.use_repos, self.resource.skip_repos)
  File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py", line 53, in install_package
    self.checked_call_with_retries(cmd, sudo=True, logoutput=self.get_logoutput())
  File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/__init__.py", line 86, in checked_call_with_retries
    return self._call_with_retries(cmd, is_checked=True, **kwargs)
  File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/__init__.py", line 98, in _call_with_retries
    code, out = func(cmd, **kwargs)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 72, in inner
    result = function(command, **kwargs)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 102, in checked_call
    tries=tries, try_sleep=try_sleep, timeout_kill_strategy=timeout_kill_strategy)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 150, in _call_wrapper
    result = _call(command, **kwargs_copy)
  File "/usr/lib/python2.6/site-packages/resource_management/core/shell.py", line 303, in _call
    raise ExecutionFailed(err_msg, code, out, err)
resource_management.core.exceptions.ExecutionFailed: Execution of '/usr/bin/yum -d 0 -e 0 -y install zookeeper_2_6_2_0_205-server' returned 1. Error: Package: redhat-lsb-printing-4.1-27.el7.centos.1.x86_64 (centos-base)
           Requires: /usr/bin/gs
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
 stdout:
2017-10-21 01:58:12,607 - Stack Feature Version Info: Cluster Stack=2.6, Cluster Current Version=None, Command Stack=None, Command Version=None -> 2.6
2017-10-21 01:58:12,632 - Using hadoop conf dir: /usr/hdp/current/hadoop-client/conf
User Group mapping (user_group) is missing in the hostLevelParams
2017-10-21 01:58:12,645 - Group['hadoop'] {}
2017-10-21 01:58:12,647 - Group['users'] {}
2017-10-21 01:58:12,648 - File['/var/lib/ambari-agent/tmp/changeUid.sh'] {'content': StaticFile('changeToSecureUid.sh'), 'mode': 0555}
2017-10-21 01:58:12,650 - call['/var/lib/ambari-agent/tmp/changeUid.sh hive'] {}
2017-10-21 01:58:12,660 - call returned (0, '50112')
2017-10-21 01:58:12,661 - User['hive'] {'gid': 'hadoop', 'fetch_nonlocal_groups': True, 'groups': [u'hadoop'], 'uid': 50112}
2017-10-21 01:58:12,662 - File['/var/lib/ambari-agent/tmp/changeUid.sh'] {'content': StaticFile('changeToSecureUid.sh'), 'mode': 0555}
2017-10-21 01:58:12,664 - call['/var/lib/ambari-agent/tmp/changeUid.sh zookeeper'] {}
2017-10-21 01:58:12,675 - call returned (0, '50117')
2017-10-21 01:58:12,676 - User['zookeeper'] {'gid': 'hadoop', 'fetch_nonlocal_groups': True, 'groups': [u'hadoop'], 'uid': 50117}
2017-10-21 01:58:12,677 - File['/var/lib/ambari-agent/tmp/changeUid.sh'] {'content': StaticFile('changeToSecureUid.sh'), 'mode': 0555}
2017-10-21 01:58:12,678 - call['/var/lib/ambari-agent/tmp/changeUid.sh ams'] {}
2017-10-21 01:58:12,685 - call returned (0, '50121')
2017-10-21 01:58:12,686 - User['ams'] {'gid': 'hadoop', 'fetch_nonlocal_groups': True, 'groups': [u'hadoop'], 'uid': 50121}
2017-10-21 01:58:12,687 - User['ambari-qa'] {'gid': 'hadoop', 'fetch_nonlocal_groups': True, 'groups': [u'users'], 'uid': None}
2017-10-21 01:58:12,688 - File['/var/lib/ambari-agent/tmp/changeUid.sh'] {'content': StaticFile('changeToSecureUid.sh'), 'mode': 0555}
2017-10-21 01:58:12,689 - call['/var/lib/ambari-agent/tmp/changeUid.sh tez'] {}
2017-10-21 01:58:12,699 - call returned (0, '50114')
2017-10-21 01:58:12,700 - User['tez'] {'gid': 'hadoop', 'fetch_nonlocal_groups': True, 'groups': [u'users'], 'uid': 50114}
2017-10-21 01:58:12,701 - File['/var/lib/ambari-agent/tmp/changeUid.sh'] {'content': StaticFile('changeToSecureUid.sh'), 'mode': 0555}
2017-10-21 01:58:12,702 - call['/var/lib/ambari-agent/tmp/changeUid.sh hdfs'] {}
2017-10-21 01:58:12,715 - call returned (0, '50101')
2017-10-21 01:58:12,716 - User['hdfs'] {'gid': 'hadoop', 'fetch_nonlocal_groups': True, 'groups': [u'hadoop'], 'uid': 50101}
2017-10-21 01:58:12,717 - File['/var/lib/ambari-agent/tmp/changeUid.sh'] {'content': StaticFile('changeToSecureUid.sh'), 'mode': 0555}
2017-10-21 01:58:12,718 - call['/var/lib/ambari-agent/tmp/changeUid.sh yarn'] {}
2017-10-21 01:58:12,725 - call returned (0, '50103')
2017-10-21 01:58:12,726 - User['yarn'] {'gid': 'hadoop', 'fetch_nonlocal_groups': True, 'groups': [u'hadoop'], 'uid': 50103}
2017-10-21 01:58:12,727 - File['/var/lib/ambari-agent/tmp/changeUid.sh'] {'content': StaticFile('changeToSecureUid.sh'), 'mode': 0555}
2017-10-21 01:58:12,728 - call['/var/lib/ambari-agent/tmp/changeUid.sh hcat'] {}
2017-10-21 01:58:12,735 - call returned (0, '50113')
2017-10-21 01:58:12,736 - User['hcat'] {'gid': 'hadoop', 'fetch_nonlocal_groups': True, 'groups': [u'hadoop'], 'uid': 50113}
2017-10-21 01:58:12,737 - File['/var/lib/ambari-agent/tmp/changeUid.sh'] {'content': StaticFile('changeToSecureUid.sh'), 'mode': 0555}
2017-10-21 01:58:12,738 - call['/var/lib/ambari-agent/tmp/changeUid.sh mapred'] {}
2017-10-21 01:58:12,746 - call returned (0, '50102')
2017-10-21 01:58:12,746 - User['mapred'] {'gid': 'hadoop', 'fetch_nonlocal_groups': True, 'groups': [u'hadoop'], 'uid': 50102}
2017-10-21 01:58:12,748 - File['/var/lib/ambari-agent/tmp/changeUid.sh'] {'content': StaticFile('changeToSecureUid.sh'), 'mode': 0555}
2017-10-21 01:58:12,750 - Execute['/var/lib/ambari-agent/tmp/changeUid.sh ambari-qa /tmp/hadoop-ambari-qa,/tmp/hsperfdata_ambari-qa,/home/ambari-qa,/tmp/ambari-qa,/tmp/sqoop-ambari-qa 0'] {'not_if': '(test $(id -u ambari-qa) -gt 1000) || (false)'}
2017-10-21 01:58:12,756 - Skipping Execute['/var/lib/ambari-agent/tmp/changeUid.sh ambari-qa /tmp/hadoop-ambari-qa,/tmp/hsperfdata_ambari-qa,/home/ambari-qa,/tmp/ambari-qa,/tmp/sqoop-ambari-qa 0'] due to not_if
2017-10-21 01:58:12,757 - Group['hdfs'] {}
2017-10-21 01:58:12,757 - User['hdfs'] {'fetch_nonlocal_groups': True, 'groups': [u'hadoop', u'hdfs']}
2017-10-21 01:58:12,757 - FS Type: 
2017-10-21 01:58:12,758 - Directory['/etc/hadoop'] {'mode': 0755}
2017-10-21 01:58:12,789 - File['/usr/hdp/current/hadoop-client/conf/hadoop-env.sh'] {'content': InlineTemplate(...), 'owner': 'hdfs', 'group': 'hadoop'}
2017-10-21 01:58:12,790 - Directory['/var/lib/ambari-agent/tmp/hadoop_java_io_tmpdir'] {'owner': 'hdfs', 'group': 'hadoop', 'mode': 01777}
2017-10-21 01:58:12,828 - Initializing 2 repositories
2017-10-21 01:58:12,829 - Repository['HDP-2.6'] {'base_url': 'http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.2.0', 'action': ['create'], 'components': [u'HDP', 'main'], 'repo_template': '[{{repo_id}}]\nname={{repo_id}}\n{% if mirror_list %}mirrorlist={{mirror_list}}{% else %}baseurl={{base_url}}{% endif %}\n\npath=/\nenabled=1\ngpgcheck=0', 'repo_file_name': 'HDP', 'mirror_list': None}
2017-10-21 01:58:12,846 - File['/etc/yum.repos.d/HDP.repo'] {'content': '[HDP-2.6]\nname=HDP-2.6\nbaseurl=http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.2.0\n\npath=/\nenabled=1\ngpgcheck=0'}
2017-10-21 01:58:12,846 - Repository['HDP-UTILS-1.1.0.21'] {'base_url': 'http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7', 'action': ['create'], 'components': [u'HDP-UTILS', 'main'], 'repo_template': '[{{repo_id}}]\nname={{repo_id}}\n{% if mirror_list %}mirrorlist={{mirror_list}}{% else %}baseurl={{base_url}}{% endif %}\n\npath=/\nenabled=1\ngpgcheck=0', 'repo_file_name': 'HDP-UTILS', 'mirror_list': None}
2017-10-21 01:58:12,849 - File['/etc/yum.repos.d/HDP-UTILS.repo'] {'content': '[HDP-UTILS-1.1.0.21]\nname=HDP-UTILS-1.1.0.21\nbaseurl=http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7\n\npath=/\nenabled=1\ngpgcheck=0'}
2017-10-21 01:58:12,850 - Package['unzip'] {'retry_on_repo_unavailability': False, 'retry_count': 5}
2017-10-21 01:58:13,008 - Skipping installation of existing package unzip
2017-10-21 01:58:13,008 - Package['curl'] {'retry_on_repo_unavailability': False, 'retry_count': 5}
2017-10-21 01:58:13,028 - Skipping installation of existing package curl
2017-10-21 01:58:13,028 - Package['hdp-select'] {'retry_on_repo_unavailability': False, 'retry_count': 5}
2017-10-21 01:58:13,049 - Skipping installation of existing package hdp-select
2017-10-21 01:58:13,412 - Package['zookeeper_2_6_2_0_205'] {'retry_on_repo_unavailability': False, 'retry_count': 5}
2017-10-21 01:58:13,549 - Skipping installation of existing package zookeeper_2_6_2_0_205
2017-10-21 01:58:13,551 - Package['zookeeper_2_6_2_0_205-server'] {'retry_on_repo_unavailability': False, 'retry_count': 5}
2017-10-21 01:58:13,572 - Installing package zookeeper_2_6_2_0_205-server ('/usr/bin/yum -d 0 -e 0 -y install zookeeper_2_6_2_0_205-server')
2017-10-21 01:58:21,830 - Execution of '/usr/bin/yum -d 0 -e 0 -y install zookeeper_2_6_2_0_205-server' returned 1. Error: Package: redhat-lsb-printing-4.1-27.el7.centos.1.x86_64 (centos-base)
           Requires: /usr/bin/gs
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
2017-10-21 01:58:21,831 - Failed to install package zookeeper_2_6_2_0_205-server. Executing '/usr/bin/yum clean metadata'
2017-10-21 01:58:22,231 - Retrying to install package zookeeper_2_6_2_0_205-server after 30 seconds

Command failed after 1 tries

```

# Solution
```
[user@ambari01 ~/tools]$ cat installGostScript.sh
sudo yum install ghostscript-fonts libICE* libSM* libX11* libXext* libXt* libfontconfig* libfontconfig.so.1liblcms2* libpng15* poppler-data urw-fonts  liblcms2* -y

mkdir /tmp/tools/
cd /tmp/tools/
#wget ftp://ftp.icm.edu.pl/vol/rzm5/linux-slc/centos/7.0.1406/cr/x86_64/Packages/ghostscript-9.07-18.el7.x86_64.rpm
wget ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7.1/x86_64/os/Packages/ghostscript-9.07-18.el7.x86_64.rpm
sudo rpm -ivh ghostscript-9.07-18.el7.x86_64.rpm
```

# リトライして、成功
<img width="1185" alt="スクリーンショット 2017-10-21 11.48.42.png" src="https://qiita-image-store.s3.amazonaws.com/0/133516/7c096bf3-3dfb-490a-ce1f-d84413facb5c.png">