在ubuntu12.04.5 bit环境下,经常配置radosgw,所以写了个脚本搞定radosgw一键安装,不含ssl的配置,需要的自己添加一下。ceph0.80.x测试通过。
<!-- lang: shell -->
#!/bin/bash
wget -q -O- https://raw.github.com/ceph/ceph/master/keys/autobuild.asc | sudo apt-key add -
echo deb http://gitbuilder.ceph.com/apache2-deb-$(lsb_release -sc)-x86_64-basic/ref/master $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph-apache.list
echo deb http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-$(lsb_release -sc)-x86_64-basic/ref/master $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph-fastcgi.list
HOSTNAME=`hostname`
apt-get install apache2 libapache2-mod-fastcgi radosgw -y
ceph-authtool --create-keyring /etc/ceph/ceph.client.radosgw.$HOSTNAME.keyring
cd /etc/ceph/
chmod +r ceph.client.radosgw.$HOATNAME.keyring
ceph-authtool /etc/ceph/ceph.client.radosgw.$HOSTNAME.keyring -n client.radosgw.$HOSTNAME --gen-key
ceph-authtool -n client.radosgw.$HOSTNAME --cap osd 'allow rwx' --cap mon 'allow rwx' /etc/ceph/ceph.client.radosgw.$HOSTNAME.keyring
ceph -k /etc/ceph/ceph.client.admin.keyring auth add client.radosgw.$HOSTNAME -i /etc/ceph/ceph.client.radosgw.$HOSTNAME.keyring
echo -n "
[client.radosgw.$HOSTNAME]
host = $HOSTNAME
keyring = /etc/ceph/ceph.client.radosgw.$HOSTNAME.keyring
rgw socket path = /tmp/radosgw.sock
log file = /var/log/ceph/radosgw.$HOSTNAME.log
rgw dns name = $HOSTNAME
" >> /etc/ceph/ceph.conf
echo -n "#!/bin/sh
exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n client.radosgw.$HOSTNAME" > /var/www/s3gw.fcgi
chmod +x /var/www/s3gw.fcgi
echo -n "FastCgiExternalServer /var/www/s3gw.fcgi -socket /tmp/radosgw.sock
<VirtualHost *:80>
ServerName $HOSTNAME
DocumentRoot /var/www
RewriteEngine On
RewriteRule ^/(.*) /s3gw.fcgi?%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
<IfModule mod_fastcgi.c>
<Directory /var/www>
Options +ExecCGI
AllowOverride All
SetHandler fastcgi-script
Order allow,deny
Allow from all
AuthBasicAuthoritative Off
</Directory>
</IfModule>
AllowEncodedSlashes On
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
ServerSignature Off
</VirtualHost>
" > /etc/apache2/sites-available/rgw.conf
echo "ServerName $HOSTNAME" >> /etc/apache2/apache2.conf
sudo a2enmod rewrite
sudo a2enmod fastcgi
a2ensite rgw.conf
a2dissite default
service ceph restart
service apache2 restart
/etc/init.d/radosgw start