2011年4月25日星期一
试用Amazon EC2云计算服务
Ubuntu 10.10 版本发布以后,口号是 “10 out of 10″,Canonical联合 Amazon 免费为尝鲜者提供1小时的 Ubuntu 10.10 Server 版本的试用,有点像当初 Ubuntu 桌面版免费寄光盘的味道,现在光盘驱动器安装操作系统的方式已经过时了,云时代流行 iso 和模板安装。
可以通过 Try Ubuntu 10.10 Server in Amazon EC2 链接申请免费试用1个小时的Amazon EC2云计算服务,不要被 “云” 吓到,实际上就是1个 Xen VPS 而已。
1、 Try Ubuntu 10.10 Server in Amazon EC2 —>Try Ubuntu 10.10—>Sign in to Ubuntu AWS Trial,用Ubuntu One帐号登录试用。
登录成功后显示
Sign in to Ubuntu AWS Trial
If you proceed, the following information will be available to Ubuntu AWS Trial:
- Full name: woody
- Username: woody-shi
- Email address: woody.shi@gmail.com
Yes, sign me in or cancel
点击Yes, sign me in.
2、经过一番初始化配置,并且选择应用为Wordpress,最后会得到页面如下。
可以通过SSH对该服务器进行管理,ip地址是50.16.72.11,管理帐户ubuntu:Z4uufJMHK,同时提示在初次登录后必须修改口令,并提供云服务器的SSH Key 指纹。
3、可以通过http://ec2-50-16-72-11.compute-1.amazonaws.com/访问Wordpress服务,并通过点击Cloud-Config查看云服务器的配置。如下
#cloud-config
apt_update: true
#apt_upgrade: true
packages:
- wordpress
- mysql-server
- apache2-mpm-prefork
- php5
- php5-mysql
- libapache2-mod-php5
- curl
- postfix
fixroutingsilliness:
- &fix_routing_silliness |
public_ipv4=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
ifconfig eth0:0 $public_ipv4 up
configapache:
- &config_apache |
public_hostname=$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)
public_ipv4=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
cat > /etc/apache2/sites-available/wordpress <
UseCanonicalName off
Options All
ServerAdmin webmaster@localhost
ServerName $public_hostname
ServerAlias $public_ipv4
VirtualDocumentRoot /var/www/%0
RewriteEngine on
RewriteRule ^/wp-uploads/(.*)$ /var/www/wp-uploads/%{HTTP_HOST}/\$1
ErrorLog \${APACHE_LOG_DIR}/wordpress-error.log
LogLevel warn
CustomLog \${APACHE_LOG_DIR}/wordpress-access.log combined
EOF
a2enmod rewrite vhost_alias
a2ensite wordpress
configpostfix:
- &config_postfix |
public_hostname=$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)
postconf -e myhostname=$public_hostname
postconf -e mydestination=$public_hostname,localhost
echo $public_hostname > /etc/mailname
postfix reload
configmysql:
- &config_mysql |
public_hostname=$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)
/etc/init.d/mysql restart
bash /usr/share/doc/wordpress/examples/setup-mysql -n wordpress $public_hostname
restartapache:
- &restart_apache |
/etc/init.d/apache2 restart
runcmd:
- [ sh, -c, *fix_routing_silliness ]
- [ sh, -c, *config_postfix ]
- [ sh, -c, *config_mysql ]
- [ sh, -c, *config_apache ]
- [ sh, -c, *restart_apache ]
- touch /tmp/done
ok!
标签: Amazon EC2, Ubuntu 10.10
订阅 博文 [Atom]