Add Fedora 19 support

* Hadoop installation on Fedora 19
* setup Fedora 19 first-boot
* small fixes to ssh configuration

Fixes: bug #1201794

Change-Id: I3e5cae6b95ffef6f7004801d69de39146a1c6611
This commit is contained in:
Ivan Berezovskiy 2013-07-17 19:31:29 +04:00
parent 40931bdb5f
commit c4ff43713b
5 changed files with 66 additions and 72 deletions

View File

@ -40,6 +40,13 @@ Steps how to create cloud image with Apache Hadoop installed using diskimage-bui
JAVA_FILE=jdk-7u21-linux-x64.tar.gz DIB_HADOOP_VERSION=1.1.2 DIB_IMAGE_SIZE=10 disk-image-create base vm fedora hadoop root-passwd -o fedora_hadoop_1_1_2
Note: If you build Fedora 19 image from a non-Fedora 19 host (e.g. Ubuntu or Fedora 18), you should use the parameter 'WORKAROUND_BUG_1204824'. If this bug doesn't have status 'fix-commited', give to parameter 'WORKAROUND_BUG_1204824' not empty value.
Bug: https://bugs.launchpad.net/diskimage-builder/+bug/1204824
.. sourcecode:: bash
WORKAROUND_BUG_1204824=true JAVA_FILE=jdk-7u21-linux-x64.tar.gz DIB_HADOOP_VERSION=1.1.2 DIB_IMAGE_SIZE=10 disk-image-create base vm fedora hadoop root-passwd -o fedora_hadoop_1_1_2
In this command 'DIB_HADOOP_VERSION' parameter is version of hadoop needs to be installed.
You can use 'JAVA_DOWNLOAD_URL' parameter to specify download link for JDK (tarball or bin).
'DIB_IMAGE_SIZE' is parameter that specifes a volume of hard disk of instance. You need to specify it because Fedora doesn't use all available volume.

View File

@ -1,10 +1,4 @@
#!/bin/bash
# Common
chown root:root /mnt
mkdir -p /var/run/hadoop ; chown hadoop:hadoop /var/run/hadoop
mkdir -p /mnt/log/hadoop ; chown hadoop:hadoop /mnt/log/hadoop
distro=$(lsb_release -is || :)
case "$distro" in
Ubuntu )
@ -15,11 +9,20 @@ case "$distro" in
chown -R ubuntu:ubuntu /home/ubuntu
;;
Fedora )
sleep 10
sleep 20
rm /etc/resolv.conf
service network restart
chown -R ec2-user:ec2-user /home/ec2-user
chown -R ec2-user:ec2-user /etc/hadoop
if [ $(lsb_release -rs) = '19' ]; then
chown -R fedora:fedora /etc/hadoop
chown -R fedora:fedora /home/fedora
# we should use this command for corretly connection by ssh to the instanse with this image
# without this command we will get an error: "unable to get context for user 'fedora'"
#TODO: remove this after fixing bug (https://bugs.launchpad.net/savanna/+bug/1204824)
test -z "$WORKAROUND_BUG_1204824" || setenforce 0
else
chown -R ec2-user:ec2-user /home/ec2-user
chown -R ec2-user:ec2-user /etc/hadoop
fi
#TODO: configure iptables (https://bugs.launchpad.net/savanna/+bug/1195744)
iptables -F
;;
@ -28,3 +31,8 @@ case "$distro" in
exit 1
;;
esac
# Common
chown root:root /mnt
mkdir -p /var/run/hadoop ; chown hadoop:hadoop /var/run/hadoop
mkdir -p /mnt/log/hadoop ; chown hadoop:hadoop /mnt/log/hadoop

View File

@ -1,62 +0,0 @@
#!/bin/bash
echo "Adjusting ssh configuration"
# /etc/ssh/sshd_config is provided by openssh-server
# /etc/ssh/ssh_config is provided by openssh-client
# Note: You need diskimage-builder w/ SHA 82eacdec (11 July 2013) for
# this install to work on Fedora - https://review.openstack.org/#/c/36739/
install-packages augeas-tools openssh-server openssh-client
##
## ssh server configuration
##
# Unique to Ubuntu
augtool -s set /files/etc/ssh/sshd_config/PasswordAuthentication yes
augtool -s set /files/etc/ssh/sshd_config/GSSAPICleanupCredentials yes
augtool -s set /files/etc/ssh/sshd_config/AuthorizedKeysFile .ssh/authorized_keys
# Unique to Fedora
augtool -s set /files/etc/ssh/sshd_config/SyslogFacility AUTH
augtool -s set /files/etc/ssh/sshd_config/PermitRootLogin yes
augtool -s set /files/etc/ssh/sshd_config/StrictModes yes
augtool -s set /files/etc/ssh/sshd_config/RSAAuthentication yes
augtool -s set /files/etc/ssh/sshd_config/PubkeyAuthentication yes
augtool -s set /files/etc/ssh/sshd_config/IgnoreRhosts yes
# Common
augtool -s set /files/etc/ssh/sshd_config/GSSAPIAuthentication no
augtool -s set /files/etc/ssh/sshd_config/UseDNS no
augtool -s set /files/etc/ssh/sshd_config/PermitTunnel yes
##
## ssh client configuration
##
# Unique to Ubuntu
#none
# Unique to Fedora
augtool -s set /files/etc/ssh/ssh_config/Host/GSSAPIDelegateCredentials no
# Common
augtool -s set /files/etc/ssh/ssh_config/Host/StrictHostKeyChecking no
augtool -s set /files/etc/ssh/ssh_config/Host/GSSAPIAuthentication no
##
## Misc configuration
##
# Unique to Fedora
# No known augeas lense for cloud-init config
sed -i 's/ssh_pwauth: 0/ssh_pwauth: 1/' /etc/cloud/cloud.cfg
# Unique to Fedora
augtool -s clear /files/etc/sudoers/Defaults[type=':nrpe']/requiretty/negate
# Exit with success, even if the last config update failed
:

View File

@ -0,0 +1,37 @@
#!/bin/bash
echo "Adjusting ssh configuration"
# /etc/ssh/sshd_config is provided by openssh-server
# /etc/ssh/ssh_config is provided by openssh-client
# Note: You need diskimage-builder w/ SHA 82eacdec (11 July 2013) for
# this install to work on Fedora - https://review.openstack.org/#/c/36739/
install-packages augeas-tools openssh-server openssh-client
augtool -s set /files/etc/ssh/sshd_config/GSSAPIAuthentication no
augtool -s set /files/etc/ssh/sshd_config/UseDNS no
augtool -s set /files/etc/ssh/sshd_config/PermitTunnel yes
# ssh-client configuration
# Common
augtool -s set /files/etc/ssh/ssh_config/Host/StrictHostKeyChecking no
augtool -s set /files/etc/ssh/ssh_config/Host/GSSAPIAuthentication no
distro=$(lsb_release -is || :)
echo $distro
case "$distro" in
Ubuntu )
augtool -s set /files/etc/ssh/sshd_config/PasswordAuthentication yes
augtool -s set /files/etc/ssh/sshd_config/GSSAPICleanupCredentials yes
augtool -s set /files/etc/ssh/sshd_config/AuthorizedKeysFile .ssh/authorized_keys
;;
Fedora )
sed -i 's/ssh_pwauth: 0/ssh_pwauth: 1/' /etc/cloud/cloud.cfg
augtool -s clear /files/etc/sudoers/Defaults[type=':nrpe']/requiretty/negate
augtool -s set /files/etc/ssh/sshd_config/SyslogFacility AUTH
augtool -s set /files/etc/ssh/sshd_config/PermitRootLogin yes
augtool -s set /files/etc/ssh/sshd_config/StrictModes yes
augtool -s set /files/etc/ssh/sshd_config/RSAAuthentication yes
augtool -s set /files/etc/ssh/sshd_config/PubkeyAuthentication yes
;;
esac

View File

@ -43,7 +43,11 @@ case "$distro" in
dpkg -i $tmp_dir/$package
;;
Fedora )
rpm -ivh --replacefiles $tmp_dir/$package
if [ $(lsb_release -rs) = '19' ]; then
rpm -i $tmp_dir/$package --relocate /usr=/usr --replacefiles
else
rpm -ivh --replacefiles $tmp_dir/$package
fi
chmod 755 /usr/sbin/start-*
chmod 755 /usr/sbin/stop-*
chmod 755 /usr/sbin/slaves.sh